summaryrefslogtreecommitdiff
path: root/src/administration.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-08-09 12:51:47 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-08-09 12:51:47 +0200
commit94e52baaed095f571c41cabe80d3a6b7e03653d2 (patch)
tree9486f29b22aa34ef47cae6ccc70b0edb8914024c /src/administration.cpp
parent5854629f246aed30e1e7e4239c9283e2a6c8053f (diff)
localize
Diffstat (limited to 'src/administration.cpp')
-rw-r--r--src/administration.cpp181
1 files changed, 101 insertions, 80 deletions
diff --git a/src/administration.cpp b/src/administration.cpp
index 5e323d0..0353276 100644
--- a/src/administration.cpp
+++ b/src/administration.cpp
@@ -15,7 +15,7 @@ static void administration_create_default_tax_brackets()
country_tax_bracket* tb = (country_tax_bracket*)malloc(sizeof(country_tax_bracket));\
memcpy(tb->country_code, _country, sizeof(tb->country_code));\
tb->rate = _rate;\
- memcpy(tb->description, _country, sizeof(tb->description));\
+ memcpy(tb->description, _description, sizeof(tb->description));\
list_append(&g_administration.tax_brackets, tb);\
}
@@ -24,136 +24,136 @@ static void administration_create_default_tax_brackets()
ADD_BRACKET("00", 0.0f, "tax.exempt");
// Austria
- ADD_BRACKET("AT", 20.0f, "Standard");
- ADD_BRACKET("AT", 10.0f, "Reduced");
- ADD_BRACKET("AT", 13.0f, "Reduced");
+ ADD_BRACKET("AT", 20.0f, "tax.standard");
+ ADD_BRACKET("AT", 10.0f, "tax.reduced");
+ ADD_BRACKET("AT", 13.0f, "tax.reduced");
// Belgium
- ADD_BRACKET("BE", 21.0f, "Standard");
- ADD_BRACKET("BE", 6.0f, "Reduced");
- ADD_BRACKET("BE", 12.0f, "Reduced");
+ ADD_BRACKET("BE", 21.0f, "tax.standard");
+ ADD_BRACKET("BE", 6.0f, "tax.reduced");
+ ADD_BRACKET("BE", 12.0f, "tax.reduced");
// Bulgaria
- ADD_BRACKET("BG", 20.0f, "Standard");
- ADD_BRACKET("BG", 9.0f, "Reduced");
+ ADD_BRACKET("BG", 20.0f, "tax.standard");
+ ADD_BRACKET("BG", 9.0f, "tax.reduced");
// Cyprus
- ADD_BRACKET("CY", 19.0f, "Standard");
- ADD_BRACKET("CY", 5.0f, "Reduced");
- ADD_BRACKET("CY", 9.0f, "Reduced");
+ ADD_BRACKET("CY", 19.0f, "tax.standard");
+ ADD_BRACKET("CY", 5.0f, "tax.reduced");
+ ADD_BRACKET("CY", 9.0f, "tax.reduced");
// Czechia
- ADD_BRACKET("CZ", 21.0f, "Standard");
- ADD_BRACKET("CZ", 12.0f, "Reduced");
+ ADD_BRACKET("CZ", 21.0f, "tax.standard");
+ ADD_BRACKET("CZ", 12.0f, "tax.reduced");
// Croatia
- ADD_BRACKET("HR", 25.0f, "Standard");
- ADD_BRACKET("HR", 5.0f, "Reduced");
- ADD_BRACKET("HR", 13.0f, "Reduced");
+ ADD_BRACKET("HR", 25.0f, "tax.standard");
+ ADD_BRACKET("HR", 5.0f, "tax.reduced");
+ ADD_BRACKET("HR", 13.0f, "tax.reduced");
// Denmark
- ADD_BRACKET("DK", 25.0f, "Standard");
+ ADD_BRACKET("DK", 25.0f, "tax.standard");
// Estonia
- ADD_BRACKET("EE", 22.0f, "Standard");
- ADD_BRACKET("EE", 9.0f, "Reduced");
+ ADD_BRACKET("EE", 22.0f, "tax.standard");
+ ADD_BRACKET("EE", 9.0f, "tax.reduced");
// Finland
- ADD_BRACKET("FI", 25.5f, "Standard");
- ADD_BRACKET("FI", 10.0f, "Reduced");
- ADD_BRACKET("FI", 14.0f, "Reduced");
+ ADD_BRACKET("FI", 25.5f, "tax.standard");
+ ADD_BRACKET("FI", 10.0f, "tax.reduced");
+ ADD_BRACKET("FI", 14.0f, "tax.reduced");
// France
- ADD_BRACKET("FR", 20.0f, "Standard");
- ADD_BRACKET("FR", 5.5f, "Reduced");
- ADD_BRACKET("FR", 10.0f, "Reduced");
- ADD_BRACKET("FR", 2.1f, "SuperReduced");
+ ADD_BRACKET("FR", 20.0f, "tax.standard");
+ ADD_BRACKET("FR", 5.5f, "tax.reduced");
+ ADD_BRACKET("FR", 10.0f, "tax.reduced");
+ ADD_BRACKET("FR", 2.1f, "tax.superReduced");
// Germany
- ADD_BRACKET("DE", 19.0f, "Standard");
- ADD_BRACKET("DE", 7.0f, "Reduced");
+ ADD_BRACKET("DE", 19.0f, "tax.standard");
+ ADD_BRACKET("DE", 7.0f, "tax.reduced");
// Greece
- ADD_BRACKET("GR", 24.0f, "Standard");
- ADD_BRACKET("GR", 6.0f, "Reduced");
- ADD_BRACKET("GR", 13.0f, "Reduced");
+ ADD_BRACKET("GR", 24.0f, "tax.standard");
+ ADD_BRACKET("GR", 6.0f, "tax.reduced");
+ ADD_BRACKET("GR", 13.0f, "tax.reduced");
// Hungary
- ADD_BRACKET("HU", 27.0f, "Standard");
- ADD_BRACKET("HU", 5.0f, "Reduced");
- ADD_BRACKET("HU", 18.0f, "Reduced");
+ ADD_BRACKET("HU", 27.0f, "tax.standard");
+ ADD_BRACKET("HU", 5.0f, "tax.reduced");
+ ADD_BRACKET("HU", 18.0f, "tax.reduced");
// Ireland
- ADD_BRACKET("IE", 23.0f, "Standard");
- ADD_BRACKET("IE", 9.0f, "Reduced");
- ADD_BRACKET("IE", 13.5f, "Reduced");
- ADD_BRACKET("IE", 4.8f, "SuperReduced");
+ ADD_BRACKET("IE", 23.0f, "tax.standard");
+ ADD_BRACKET("IE", 9.0f, "tax.reduced");
+ ADD_BRACKET("IE", 13.5f, "tax.reduced");
+ ADD_BRACKET("IE", 4.8f, "tax.superReduced");
// Italy
- ADD_BRACKET("IT", 22.0f, "Standard");
- ADD_BRACKET("IT", 5.0f, "Reduced");
- ADD_BRACKET("IT", 10.0f, "Reduced");
- ADD_BRACKET("IT", 4.0f, "SuperReduced");
+ ADD_BRACKET("IT", 22.0f, "tax.standard");
+ ADD_BRACKET("IT", 5.0f, "tax.reduced");
+ ADD_BRACKET("IT", 10.0f, "tax.reduced");
+ ADD_BRACKET("IT", 4.0f, "tax.superReduced");
// Latvia
- ADD_BRACKET("LV", 21.0f, "Standard");
- ADD_BRACKET("LV", 5.0f, "Reduced");
- ADD_BRACKET("LV", 12.0f, "Reduced");
+ ADD_BRACKET("LV", 21.0f, "tax.standard");
+ ADD_BRACKET("LV", 5.0f, "tax.reduced");
+ ADD_BRACKET("LV", 12.0f, "tax.reduced");
// Lithuania
- ADD_BRACKET("LT", 21.0f, "Standard");
- ADD_BRACKET("LT", 5.0f, "Reduced");
- ADD_BRACKET("LT", 9.0f, "Reduced");
+ ADD_BRACKET("LT", 21.0f, "tax.standard");
+ ADD_BRACKET("LT", 5.0f, "tax.reduced");
+ ADD_BRACKET("LT", 9.0f, "tax.reduced");
// Luxembourg
- ADD_BRACKET("LU", 17.0f, "Standard");
- ADD_BRACKET("LU", 8.0f, "Reduced");
- ADD_BRACKET("LU", 14.0f, "Reduced");
- ADD_BRACKET("LU", 3.0f, "SuperReduced");
+ ADD_BRACKET("LU", 17.0f, "tax.standard");
+ ADD_BRACKET("LU", 8.0f, "tax.reduced");
+ ADD_BRACKET("LU", 14.0f, "tax.reduced");
+ ADD_BRACKET("LU", 3.0f, "tax.superReduced");
// Malta
- ADD_BRACKET("MT", 18.0f, "Standard");
- ADD_BRACKET("MT", 5.0f, "Reduced");
- ADD_BRACKET("MT", 7.0f, "Reduced");
+ ADD_BRACKET("MT", 18.0f, "tax.standard");
+ ADD_BRACKET("MT", 5.0f, "tax.reduced");
+ ADD_BRACKET("MT", 7.0f, "tax.reduced");
// Netherlands
- ADD_BRACKET("NL", 21.0f, "Standard");
- ADD_BRACKET("NL", 9.0f, "Reduced");
+ ADD_BRACKET("NL", 21.0f, "tax.standard");
+ ADD_BRACKET("NL", 9.0f, "tax.reduced");
// Poland
- ADD_BRACKET("PL", 23.0f, "Standard");
- ADD_BRACKET("PL", 5.0f, "Reduced");
- ADD_BRACKET("PL", 8.0f, "Reduced");
+ ADD_BRACKET("PL", 23.0f, "tax.standard");
+ ADD_BRACKET("PL", 5.0f, "tax.reduced");
+ ADD_BRACKET("PL", 8.0f, "tax.reduced");
// Portugal
- ADD_BRACKET("PT", 23.0f, "Standard");
- ADD_BRACKET("PT", 6.0f, "Reduced");
- ADD_BRACKET("PT", 13.0f, "Reduced");
+ ADD_BRACKET("PT", 23.0f, "tax.standard");
+ ADD_BRACKET("PT", 6.0f, "tax.reduced");
+ ADD_BRACKET("PT", 13.0f, "tax.reduced");
// Romania
- ADD_BRACKET("RO", 19.0f, "Standard");
- ADD_BRACKET("RO", 5.0f, "Reduced");
- ADD_BRACKET("RO", 9.0f, "Reduced");
+ ADD_BRACKET("RO", 19.0f, "tax.standard");
+ ADD_BRACKET("RO", 5.0f, "tax.reduced");
+ ADD_BRACKET("RO", 9.0f, "tax.reduced");
// Slovakia
- ADD_BRACKET("SK", 23.0f, "Standard");
- ADD_BRACKET("SK", 5.0f, "Reduced");
- ADD_BRACKET("SK", 19.0f, "Reduced");
+ ADD_BRACKET("SK", 23.0f, "tax.standard");
+ ADD_BRACKET("SK", 5.0f, "tax.reduced");
+ ADD_BRACKET("SK", 19.0f, "tax.reduced");
// Slovenia
- ADD_BRACKET("SI", 22.0f, "Standard");
- ADD_BRACKET("SI", 5.0f, "Reduced");
- ADD_BRACKET("SI", 9.5f, "Reduced");
+ ADD_BRACKET("SI", 22.0f, "tax.standard");
+ ADD_BRACKET("SI", 5.0f, "tax.reduced");
+ ADD_BRACKET("SI", 9.5f, "tax.reduced");
// Spain
- ADD_BRACKET("ES", 21.0f, "Standard");
- ADD_BRACKET("ES", 10.0f, "Reduced");
- ADD_BRACKET("ES", 4.0f, "SuperReduced");
+ ADD_BRACKET("ES", 21.0f, "tax.standard");
+ ADD_BRACKET("ES", 10.0f, "tax.reduced");
+ ADD_BRACKET("ES", 4.0f, "tax.superReduced");
// Sweden
- ADD_BRACKET("SE", 25.0f, "Standard");
- ADD_BRACKET("SE", 6.0f, "Reduced");
- ADD_BRACKET("SE", 12.0f, "Reduced");
+ ADD_BRACKET("SE", 25.0f, "tax.standard");
+ ADD_BRACKET("SE", 6.0f, "tax.reduced");
+ ADD_BRACKET("SE", 12.0f, "tax.reduced");
}
void administration_create()
@@ -161,7 +161,7 @@ void administration_create()
list_init(&g_administration.contacts);
list_init(&g_administration.projects);
list_init(&g_administration.tax_brackets);
- strops_copy(g_administration.path, "[unsaved project]", sizeof(g_administration.path)); // @localize
+ strops_copy(g_administration.path, "", sizeof(g_administration.path));
administration_create_default_tax_brackets();
}
@@ -357,4 +357,25 @@ contact administration_get_company_info()
void administration_set_company_info(contact data)
{
g_administration.company_info = data;
+}
+
+u32 administration_get_tax_bracket_count()
+{
+ return list_size(&g_administration.tax_brackets);
+}
+
+u32 administration_get_tax_brackets(country_tax_bracket* buffer)
+{
+ assert(buffer);
+
+ u32 write_cursor = 0;
+
+ list_iterator_start(&g_administration.tax_brackets);
+ while (list_iterator_hasnext(&g_administration.tax_brackets)) {
+ country_tax_bracket c = *(country_tax_bracket *)list_iterator_next(&g_administration.tax_brackets);
+ buffer[write_cursor++] = c;
+ }
+ list_iterator_stop(&g_administration.tax_brackets);
+
+ return write_cursor;
} \ No newline at end of file