diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-19 13:49:36 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-19 13:49:36 +0200 |
| commit | 60dfc4cab91b0076901cac81ba6cb1f2d198b06c (patch) | |
| tree | b5408e86171782eb28017702b79e47f0ca03ed89 /src/administration.cpp | |
| parent | 18bfbc423d188683973a0a3d6c31c9225158e262 (diff) | |
new tax rate format, ui and r/w
Diffstat (limited to 'src/administration.cpp')
| -rw-r--r-- | src/administration.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/administration.cpp b/src/administration.cpp index d01ec61..93af778 100644 --- a/src/administration.cpp +++ b/src/administration.cpp @@ -1045,6 +1045,45 @@ tax_rate administration::tax_rate_create_empty() return result; } +a_err administration::tax_rate_remove(tax_rate data) +{ + list_iterator_start(&g_administration.tax_rates); + while (list_iterator_hasnext(&g_administration.tax_rates)) { + tax_rate* c = (tax_rate *)list_iterator_next(&g_administration.tax_rates); + + if (strcmp(c->internal_code, data.internal_code) == 0) + { + list_iterator_stop(&g_administration.tax_rates); + if (list_delete(&g_administration.tax_rates, c) != 0) return A_ERR_GENERIC; + + char filename[MAX_LEN_PATH]; + strops::format(filename, sizeof(filename), "T/%s", c->internal_code); + if (data_deleted_event_callback) data_deleted_event_callback(filename); + return A_ERR_SUCCESS; + } + } + list_iterator_stop(&g_administration.tax_rates); + + return A_ERR_NOT_FOUND; +} + +a_err administration::tax_rate_exists(tax_rate data) +{ + list_iterator_start(&g_administration.tax_rates); + while (list_iterator_hasnext(&g_administration.tax_rates)) { + tax_rate c = *(tax_rate *)list_iterator_next(&g_administration.tax_rates); + + if (strcmp(c.internal_code, data.internal_code) == 0) + { + list_iterator_stop(&g_administration.tax_rates); + return A_ERR_SUCCESS; + } + } + list_iterator_stop(&g_administration.tax_rates); + + return A_ERR_NOT_FOUND; +} + a_err administration::tax_rate_get_by_shorthandle(tax_rate* buffer, char* handle) { assert(buffer); |
