summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-06 17:52:54 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-06 17:52:54 +0200
commit17e035839a19a8b10d329c28ccaa44ff608d3a33 (patch)
treeac1e8a9bd087d24c695d07fa492fe2d729a08b2e /src/ui
parent68d0ef1586a90ddef6d0cef7ebd593828282c76a (diff)
peppol file generation work
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_invoices.cpp18
-rw-r--r--src/ui/ui_settings.cpp5
2 files changed, 17 insertions, 6 deletions
diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp
index d6bb157..8cdf959 100644
--- a/src/ui/ui_invoices.cpp
+++ b/src/ui/ui_invoices.cpp
@@ -59,12 +59,16 @@ void draw_tax_bracket_selector(char* tax_bracket_id, country_tax_bracket* buffer
}
int selected_tax_bracket_index = -1;
- char rate_str_buf[20];
+ char rate_str_buf[40];
rate_str_buf[0] = 0;
if (selected_tax_bracket)
{
- if (strcmp(selected_tax_bracket->country_code, "00") == 0) snprintf(rate_str_buf, 20, "%s", localize(selected_tax_bracket->description));
- else snprintf(rate_str_buf, 20, "%s/%.1f%%", selected_tax_bracket->country_code, selected_tax_bracket->rate);
+ if (strcmp(selected_tax_bracket->country_code, "00") == 0) {
+ char category_code_desc[MAX_LEN_LONG_DESC];
+ snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", selected_tax_bracket->category_code);
+ snprintf(rate_str_buf, 40, "%s", localize(category_code_desc));
+ }
+ else snprintf(rate_str_buf, 40, "%s/%.1f%%", selected_tax_bracket->country_code, selected_tax_bracket->rate);
}
if (ImGui::BeginCombo("##Tax Bracket", rate_str_buf))
@@ -73,8 +77,12 @@ void draw_tax_bracket_selector(char* tax_bracket_id, country_tax_bracket* buffer
{
bool is_selected = selected_tax_bracket && strcmp(selected_tax_bracket->id, buffer[n].id) == 0;
- if (strcmp(buffer[n].country_code, "00") == 0) snprintf(rate_str_buf, 20, "%s", localize(buffer[n].description));
- else snprintf(rate_str_buf, 20, "%s/%.1f%%", buffer[n].country_code, buffer[n].rate);
+ if (strcmp(buffer[n].country_code, "00") == 0) {
+ char category_code_desc[MAX_LEN_LONG_DESC];
+ snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", buffer[n].category_code);
+ snprintf(rate_str_buf, 40, "%s", localize(category_code_desc));
+ }
+ else snprintf(rate_str_buf, 40, "%s/%.1f%%", buffer[n].country_code, buffer[n].rate);
if (ImGui::Selectable(rate_str_buf, is_selected)) {
selected_tax_bracket_index = n;
diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp
index 1d6a5f4..dea58ec 100644
--- a/src/ui/ui_settings.cpp
+++ b/src/ui/ui_settings.cpp
@@ -107,7 +107,10 @@ static void ui_draw_vat_rates()
// Column 1: description of tax bracket. Is only displayed on shared tax brackets for clarity.
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
- ImGui::Text(can_be_modified ? "" : localize(c.description));
+
+ char category_code_desc[MAX_LEN_LONG_DESC];
+ snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", c.category_code);
+ ImGui::Text(can_be_modified ? "" : localize(category_code_desc));
// Column 2: When editing, show input for new rate. Else we display the stored rate and check for modify request.