diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-18 23:10:20 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-18 23:10:20 +0200 |
| commit | 18bfbc423d188683973a0a3d6c31c9225158e262 (patch) | |
| tree | e88ab359e6455d44dc7687769ae1281133485acc /include | |
| parent | e5e059538bbbf1993df854bd95e9bbf4bb1d7aaa (diff) | |
tax rate refactor
Diffstat (limited to 'include')
| -rw-r--r-- | include/administration.hpp | 18 | ||||
| -rw-r--r-- | include/countries.hpp | 19 |
2 files changed, 27 insertions, 10 deletions
diff --git a/include/administration.hpp b/include/administration.hpp index 5053d7e..151df2a 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -46,12 +46,28 @@ #define MY_COMPANY_ID "C/1" +typedef enum +{ + TAX_RATE_OUTGOING_INVOICE, + TAX_RATE_INCOMMING_INVOICE, + + TAX_RATE_TYPE_END, +} tax_rate_type; + +#define MAX_TAX_SECTION_PER_RATE 3 typedef struct { char id[MAX_LEN_ID]; // T/[id] - char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code + char internal_code[MAX_LEN_SHORT_DESC]; float rate; // 0-100% + u32 tax_section_count; + char tax_sections[MAX_TAX_SECTION_PER_RATE][MAX_LEN_SHORT_DESC]; // Country specific tax section + tax_rate_type type; + + // depricated: + char tax_section[MAX_LEN_SHORT_DESC]; char category_code[MAX_LEN_CODE]; // Category code. https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL5305/ + char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code } tax_rate; typedef struct diff --git a/include/countries.hpp b/include/countries.hpp index 8b4bb88..68b6fa0 100644 --- a/include/countries.hpp +++ b/include/countries.hpp @@ -20,13 +20,14 @@ typedef struct { - char* country_code; - bool is_EU; - time_t (*get_default_invoice_expire_duration)(); - void (*fill_tax_report_with_categories)(tax_report* report); - bool (*add_billing_item_to_tax_report)(tax_report* report, invoice* inv, billing_item* item); - float (*calculate_tax_report_final)(tax_report* report); - time_t (*get_invoice_date_to_use_for_tax_report)(invoice* inv); + char* country_code; + bool is_EU; + time_t (*get_default_invoice_expire_duration)(); + void (*fill_tax_report_with_categories)(tax_report* report); + bool (*add_billing_item_to_tax_report)(tax_report* report, invoice* inv, billing_item* item); + float (*calculate_tax_report_final)(tax_report* report); + time_t (*get_invoice_date_to_use_for_tax_report)(invoice* inv); + u32 (*get_available_tax_rates)(tax_rate* buffer, u32 buffer_size); } country_impl; namespace country { @@ -41,6 +42,6 @@ namespace country { void fill_tax_report_with_categories(char* country_code, tax_report* report); bool add_billing_item_to_tax_report(char* country_code, tax_report* report, invoice* inv, billing_item* item); float calculate_tax_report_final(char* country_code, tax_report* report); - time_t get_invoice_date_to_use_for_tax_report(char* country_code, invoice* inv); - + time_t get_invoice_date_to_use_for_tax_report(char* country_code, invoice* inv); + u32 get_available_tax_rates(char* country_code, tax_rate* buffer, u32 buffer_size); }
\ No newline at end of file |
