diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-18 21:35:10 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-18 21:35:10 +0200 |
| commit | 251eb8c54c77029f0b43aa987ea50c44016147f3 (patch) | |
| tree | 2bf4284ce2daab191d48579a6c5a84882060d398 /src/commands.c | |
| parent | 64c0d5d79b31dafcbdb68ff938a92bd6f136d4a7 (diff) | |
| download | bokf-0.1.28.tar.gz bokf-0.1.28.zip | |
eskd: generate the momsdeklaration file (eSKDUpload 6.0)v0.1.28
report.vat_eskd builds the ISO-8859-1 XML from report.vat: whole
kronor with öre truncated like the blankett, box 48 positive as filed,
MomsBetala computed from the whole-krona boxes, and an optional
upplysning converted from UTF-8, XML-escaped and capped at 300
characters. The TUI momsrapport gains "s = spara eSKD", prompting for a
path and writing the bytes verbatim.
Verified against the FY2027 Kapitas report: 05=703200, 10=175800,
20=1453, 30=851, 48=1030, 49=175621.
Diffstat (limited to 'src/commands.c')
| -rw-r--r-- | src/commands.c | 21 |
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 }, |
