summaryrefslogtreecommitdiff
path: root/src/ui/ui_settings.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-16 19:26:15 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-16 19:26:15 +0200
commit8d5c72406c1848dc7ab83daf4702fa13ce754530 (patch)
treee991400e6ef8a245f49a0cdadc15dc7b4687a877 /src/ui/ui_settings.cpp
parent9091a313b2bb2dafd2919fddb989745ddafa15d9 (diff)
renamed country_tax_bracket to tax_rate
Diffstat (limited to 'src/ui/ui_settings.cpp')
-rw-r--r--src/ui/ui_settings.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp
index ae251d9..06cefe6 100644
--- a/src/ui/ui_settings.cpp
+++ b/src/ui/ui_settings.cpp
@@ -12,8 +12,8 @@ extern void draw_contact_form(contact* buffer, bool viewing_only = false);
static contact company_info;
-u32 tax_bracket_count;
-country_tax_bracket* tax_brackets = 0;
+u32 tax_rate_count;
+tax_rate* tax_rates = 0;
u32 cost_center_count;
cost_center* cost_centers = 0;
@@ -22,7 +22,7 @@ static int select_company_tab = 0;
void ui_destroy_settings()
{
- free(tax_brackets);
+ free(tax_rates);
free(cost_centers);
}
@@ -31,9 +31,9 @@ void ui_setup_settings()
select_company_tab = 1;
company_info = administration_company_info_get();
- tax_bracket_count = administration_tax_bracket_count();
- tax_brackets = (country_tax_bracket*)malloc(tax_bracket_count * sizeof(country_tax_bracket));
- administration_tax_bracket_get_all(tax_brackets);
+ tax_rate_count = administration_tax_rate_count();
+ tax_rates = (tax_rate*)malloc(tax_rate_count * sizeof(tax_rate));
+ administration_tax_rate_get_all(tax_rates);
cost_center_count = administration_cost_center_count();
cost_centers = (cost_center*)malloc(cost_center_count * sizeof(cost_center));
@@ -43,7 +43,7 @@ void ui_setup_settings()
static void ui_draw_vat_rates()
{
static bool is_adding_item = false;
- static country_tax_bracket new_tax_bracket;
+ static tax_rate new_tax_rate;
static bool is_editing_item = false;
static u32 editing_item_index = 0;
@@ -57,8 +57,8 @@ static void ui_draw_vat_rates()
char prev_country[MAX_LEN_COUNTRY_CODE];
prev_country[0] = 0;
- for (u32 i = 0; i < tax_bracket_count; i++) {
- country_tax_bracket c = tax_brackets[i];
+ for (u32 i = 0; i < tax_rate_count; i++) {
+ tax_rate c = tax_rates[i];
// Set to false for shared rates.
bool can_be_modified = false;
@@ -98,8 +98,8 @@ static void ui_draw_vat_rates()
if (ImGui::Button(btn_name, ImVec2(20,20))) {
is_adding_item = true;
is_editing_item = false;
- new_tax_bracket = administration_tax_bracket_create_empty();
- strops_copy(new_tax_bracket.country_code, c.country_code, 3);
+ new_tax_rate = administration_tax_rate_create_empty();
+ strops_copy(new_tax_rate.country_code, c.country_code, 3);
}
ImGui::PopStyleVar();
}
@@ -107,7 +107,7 @@ static void ui_draw_vat_rates()
ImGui::TableSetColumnIndex(1); ImGui::Text("");
}
- // Column 1: description of tax bracket. Is only displayed on shared tax brackets for clarity.
+ // Column 1: description of tax rate. Is only displayed on shared tax rates for clarity.
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
@@ -120,17 +120,17 @@ static void ui_draw_vat_rates()
ImGui::TableSetColumnIndex(1);
if (is_editing_item && editing_item_index == i)
{
- ImGui::InputFloat("##Rate", &new_tax_bracket.rate, 1.0f, 5.0f, "%.2f");
+ ImGui::InputFloat("##Rate", &new_tax_rate.rate, 1.0f, 5.0f, "%.2f");
- if (new_tax_bracket.rate < 0.0f) new_tax_bracket.rate = 0.0f;
- if (new_tax_bracket.rate > 100.0f) new_tax_bracket.rate = 100.0f;
+ if (new_tax_rate.rate < 0.0f) new_tax_rate.rate = 0.0f;
+ if (new_tax_rate.rate > 100.0f) new_tax_rate.rate = 100.0f;
ImGui::SameLine();
if (ImGui::Button(localize("form.save"))) {
is_editing_item = false;
is_adding_item = false;
- administration_tax_bracket_update(new_tax_bracket);
+ administration_tax_rate_update(new_tax_rate);
ui_destroy_settings();
ui_setup_settings();
@@ -140,7 +140,7 @@ static void ui_draw_vat_rates()
if (ImGui::Button(localize("form.cancel"))) {
is_editing_item = false;
is_adding_item = false;
- memset(&new_tax_bracket, 0, sizeof(new_tax_bracket));
+ memset(&new_tax_rate, 0, sizeof(new_tax_rate));
}
}
else
@@ -152,31 +152,31 @@ static void ui_draw_vat_rates()
is_editing_item = true;
is_adding_item = false;
editing_item_index = i;
- new_tax_bracket = c;
+ new_tax_rate = c;
}
}
// When adding a new entry it is displayed at the bottom of the list of the country we are adding to.
// Check for end of list (for last country in the list), or check if next country differs from current country.
// If it is different we have reached the end of the list for the current country.
- if (i == tax_bracket_count-1 || (i < tax_bracket_count-1 && strcmp(tax_brackets[i+1].country_code, c.country_code) != 0))
+ if (i == tax_rate_count-1 || (i < tax_rate_count-1 && strcmp(tax_rates[i+1].country_code, c.country_code) != 0))
{
- if (is_adding_item && strcmp(new_tax_bracket.country_code, prev_country) == 0)
+ if (is_adding_item && strcmp(new_tax_rate.country_code, prev_country) == 0)
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::Text("");
ImGui::TableSetColumnIndex(1);
- ImGui::InputFloat("##Rate", &new_tax_bracket.rate, 1.0f, 5.0f, "%.2f");
+ ImGui::InputFloat("##Rate", &new_tax_rate.rate, 1.0f, 5.0f, "%.2f");
- if (new_tax_bracket.rate < 0.0f) new_tax_bracket.rate = 0.0f;
- if (new_tax_bracket.rate > 100.0f) new_tax_bracket.rate = 100.0f;
+ if (new_tax_rate.rate < 0.0f) new_tax_rate.rate = 0.0f;
+ if (new_tax_rate.rate > 100.0f) new_tax_rate.rate = 100.0f;
ImGui::SameLine();
if (ImGui::Button(localize("form.save"))) {
is_editing_item = false;
is_adding_item = false;
- administration_tax_bracket_add(new_tax_bracket);
+ administration_tax_rate_add(new_tax_rate);
ui_destroy_settings();
ui_setup_settings();
@@ -186,7 +186,7 @@ static void ui_draw_vat_rates()
if (ImGui::Button(localize("form.cancel"))) {
is_editing_item = false;
is_adding_item = false;
- memset(&new_tax_bracket, 0, sizeof(new_tax_bracket));
+ memset(&new_tax_rate, 0, sizeof(new_tax_rate));
}
}
}