diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-11 09:41:14 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-11 09:41:14 +0200 |
| commit | d83e5e8cd66f05ca7e6aa9fc645788313d89dfe7 (patch) | |
| tree | 987e9c3acc0232e2df2109d776f410bee591eacd /tests/nl_tax_tests.cpp | |
| parent | cf5dfa405fa3d9b480794f7f2c32e325fdfd134c (diff) | |
multi currency invoice handling for tax report
Diffstat (limited to 'tests/nl_tax_tests.cpp')
| -rw-r--r-- | tests/nl_tax_tests.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/nl_tax_tests.cpp b/tests/nl_tax_tests.cpp index bd7b51d..31382ed 100644 --- a/tests/nl_tax_tests.cpp +++ b/tests/nl_tax_tests.cpp @@ -106,9 +106,44 @@ TEST _nl_tax_1e(void) PASS(); } +TEST _nl_tax_2currency(void) +{ + administration::create_default(test_file_path); + administration::company_info_set(_create_nl_business()); + + invoice inv = _create_nl_b2b_inv_outgoing(); + administration::invoice_set_currency(&inv, "USD"); + + administration::billing_item_add_to_invoice(&inv, _create_bi(1, 20.0f, "NL/21.00")); + administration::billing_item_add_to_invoice(&inv, _create_bi(1, 30.0f, "NL/21.00")); + + float eur_usd_exchange_rate = 1.2f; + + inv.net = 50.0f / eur_usd_exchange_rate; + inv.tax = inv.net * 0.21f; + inv.allowance = 0.0f; + inv.total = inv.net + inv.tax; + + ASSERT_EQ(administration::invoice_add(&inv), A_ERR_SUCCESS); + + tax_statement statement; + administration::create_tax_statement(&statement); + ASSERT_EQ(statement.report_count, 1); + + tax_line* tl = administration::get_tax_line_from_report(&statement.reports[0], "1a"); + GREATEST_ASSERT_FEQ(tl->total_net, inv.net); + GREATEST_ASSERT_FEQ(tl->total_tax, inv.tax); + + tax_line* tl2 = administration::get_tax_line_from_report(&statement.reports[0], "5a"); + GREATEST_ASSERT_FEQ(tl2->total_tax, inv.tax); + + PASS(); +} + SUITE(nl_tax_statement) { RUN_TEST(_nl_tax_1a); RUN_TEST(_nl_tax_1b); RUN_TEST(_nl_tax_1d); RUN_TEST(_nl_tax_1e); + RUN_TEST(_nl_tax_2currency); }
\ No newline at end of file |
