diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-22 20:01:43 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-22 20:01:43 +0200 |
| commit | a11dc0aaf7f99e9b606cf1676a04027f4435c596 (patch) | |
| tree | 1c89c21bf31c54b567dee741d03500f73f3a9691 /tests/test_core.c | |
| parent | 3f07edf64f74cab68cb379e49841fdf6b24674e9 (diff) | |
| download | bokf-0.1.65.tar.gz bokf-0.1.65.zip | |
reports: VAT report skips the momsomföring and imported closingsv0.1.65
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_core.c')
| -rw-r--r-- | tests/test_core.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_core.c b/tests/test_core.c index 018b0aa..54e73f5 100644 --- a/tests/test_core.c +++ b/tests/test_core.c @@ -4170,6 +4170,52 @@ static void test_moms_rules(struct tctx *t) yyjson_doc_free(d); } +/* The momsomföring (26xx -> 2650) inside the period must not zero the boxes. */ +static void test_vat_settlement(struct tctx *t) +{ + (void)t; + yyjson_doc *d; + + d = call(reqf("{\"v\":1,\"id\":\"vs1\",\"cmd\":\"org.create\"," + "\"session\":\"%s\",\"args\":{\"name\":\"Omföring AB\"}}", + g_session)); + CHECK_OK(d); + int org = (int)jint(d, "result.id"); + yyjson_doc_free(d); + + const char *rows[] = { + "{\"account\":\"1930\",\"debit_ore\":125000}," + "{\"account\":\"3001\",\"credit_ore\":100000}," + "{\"account\":\"2611\",\"credit_ore\":25000}", + "{\"account\":\"6540\",\"debit_ore\":8000}," + "{\"account\":\"2641\",\"debit_ore\":2000}," + "{\"account\":\"1930\",\"credit_ore\":10000}", + "{\"account\":\"2611\",\"debit_ore\":25000}," + "{\"account\":\"2641\",\"credit_ore\":2000}," + "{\"account\":\"2650\",\"credit_ore\":23000}", + }; + const char *dates[] = { "2026-03-01", "2026-03-02", "2026-03-31" }; + for (size_t i = 0; i < 3; i++) { + d = call(reqf("{\"v\":1,\"id\":\"vs2\",\"cmd\":\"voucher.post\"," + "\"session\":\"%s\",\"org\":%d,\"args\":{\"date\":" + "\"%s\",\"description\":\"Moms\",\"rows\":[%s]}}", + g_session, org, dates[i], rows[i])); + CHECK_OK(d); + yyjson_doc_free(d); + } + + d = call(reqf("{\"v\":1,\"id\":\"vs3\",\"cmd\":\"report.vat\"," + "\"session\":\"%s\",\"org\":%d,\"args\":" + "{\"from\":\"2026-03-01\",\"to\":\"2026-03-31\"}}", + g_session, org)); + CHECK_OK(d); + CHECK(vat_box(d, "05") == 100000); + CHECK(vat_box(d, "10") == 25000); + CHECK(vat_box(d, "48") == -2000); + CHECK(vat_box(d, "49") == 23000); + yyjson_doc_free(d); +} + static void test_rules_editor(struct tctx *t) { yyjson_doc *d; @@ -5746,6 +5792,7 @@ static const struct ttest TESTS[] = { { "invoice_send", test_invoice_send, "invoices" }, { "moms_rules", test_moms_rules, "org_members" }, { "rules_editor", test_rules_editor, "moms_rules" }, + { "vat_settlement", test_vat_settlement, "org_members" }, { "bokslut", test_bokslut, "moms_rules" }, { "sru", test_sru, "bokslut" }, { "year_close", test_year_close, "fiscal_years" }, |
