summaryrefslogtreecommitdiff
path: root/src/administration_writer.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-19 16:11:09 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-19 16:11:09 +0200
commit1bfeb2751bf07cdc81ea9344ec941e671cb216a8 (patch)
tree6bc8c691eba2c6c34c3ad0d272aef9029256b616 /src/administration_writer.cpp
parent7dc2a4d511a0f9e30a63be6bc8ecca0bea0b8c3f (diff)
update tests for new tax rates
Diffstat (limited to 'src/administration_writer.cpp')
-rw-r--r--src/administration_writer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp
index ebc0056..aae264b 100644
--- a/src/administration_writer.cpp
+++ b/src/administration_writer.cpp
@@ -427,10 +427,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
strops::replace_float(tax_entry_file_content, tax_entry_buf_length, "{{TAXABLE_AMOUNT}}", subtotal.net, 2);
strops::replace_float(tax_entry_file_content, tax_entry_buf_length, "{{TAX_AMOUNT}}", subtotal.tax, 2);
- char tax_category[10];
- tax_category[0] = 0; // TODO get tax category
-
- strops::replace(tax_entry_file_content, tax_entry_buf_length, "{{TAX_CATEGORY}}", tax_category);
+ strops::replace(tax_entry_file_content, tax_entry_buf_length, "{{TAX_CATEGORY}}", tax_rate_buffer[i].category_code);
strops::replace_float(tax_entry_file_content, tax_entry_buf_length, "{{TAX_PERCENT}}", tax_rate_buffer[i].rate, 2);
u32 content_len = (u32)strlen(tax_entry_file_content);
@@ -475,7 +472,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
strops::replace(billing_item_file_content, billing_item_buf_length, "{{LINE_ID}}", bi.id);
strops::replace(billing_item_file_content, billing_item_buf_length, "{{LINE_TAX_ID}}", bi.tax_internal_code);
strops::replace(billing_item_file_content, billing_item_buf_length, "{{ITEM_NAME}}", bi.description);
- strops::replace(billing_item_file_content, billing_item_buf_length, "{{LINE_TAX_CATEGORY}}", "S"); // TODO get from tax code
+ strops::replace(billing_item_file_content, billing_item_buf_length, "{{LINE_TAX_CATEGORY}}", rate.category_code);
strops::replace_float(billing_item_file_content, billing_item_buf_length, "{{LINE_TAX_PERCENT}}", rate.rate, 2);
strops::replace_float(billing_item_file_content, billing_item_buf_length, "{{LINE_AMOUNT}}", bi.net, 2); // line amount = net_per_item * items_count - discount
strops::replace_float(billing_item_file_content, billing_item_buf_length, "{{QUANTITY}}", bi.amount, 2);
@@ -670,7 +667,8 @@ bool administration_writer::save_tax_rate_blocking(tax_rate rate)
strops::replace(file_content, buf_length, "{{TAXBRACKET_INTERNAL_CODE}}", rate.internal_code);
strops::replace_float(file_content, buf_length, "{{TAXBRACKET_RATE}}", rate.rate, 2);
- strops::replace_int32(file_content, buf_length, "{{TAXBRACKET_TYPE}}", static_cast<int>(rate.type));
+ strops::replace_int32(file_content, buf_length, "{{TAXBRACKET_TYPE}}", static_cast<int>(rate.type));
+ strops::replace(file_content, buf_length, "{{TAXBRACKET_CATEGORY}}", rate.category_code);
char tax_sections_buffer[MAX_LEN_LONG_DESC];
char* write_cursor = tax_sections_buffer;