summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c
index 1034b31..e16ba75 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -3600,6 +3600,25 @@ static yyjson_mut_val *h_report_voucher_list(struct req *r)
return res;
}
+static yyjson_mut_val *h_report_vat_eskd(struct req *r)
+{
+ const char *from = arg_str(r->args, "from");
+ const char *to = arg_str(r->args, "to");
+ if (!from || !to)
+ return fail(r, "INVALID_ARGS", "from and to are required");
+ char *err = NULL;
+ yyjson_mut_val *res =
+ report_vat_eskd(r->rdoc, r->db, r->org_id, from, to,
+ arg_str(r->args, "upplysning"), &err);
+ if (!res) {
+ yyjson_mut_val *e = fail(r, "INVALID_ARGS",
+ err ? err : "could not build the eSKD file");
+ free(err);
+ return e;
+ }
+ return res;
+}
+
static unsigned char *read_file(const char *path, size_t *out_len)
{
FILE *f = fopen(path, "rb");
@@ -3841,6 +3860,8 @@ const struct command g_commands[] = {
h_report_general_ledger },
{ "report.voucher_list", "Verifikationslista", PERM_READ, 1, 0, 0,
h_report_voucher_list },
+ { "report.vat_eskd", "eSKD XML for the momsdeklaration (ISO-8859-1)",
+ PERM_READ, 1, 0, 0, h_report_vat_eskd },
{ "sie.export", "Export SIE 4 (PC8)", PERM_READ, 1, 0, 0, h_sie_export },
{ "sie.import", "Import SIE 4 into an empty fiscal year", PERM_WRITE, 1, 1,
1, h_sie_import },