diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-16 20:24:28 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-16 20:24:28 +0200 |
| commit | 543aa7d53136037f07302a5653bba90751ac1552 (patch) | |
| tree | 0911a4fbba487fbb28acb6a5934af0a95c024c64 /include/administration.hpp | |
| parent | 50848b2dd97093dd407ed7199118bca011f1aa4c (diff) | |
more refactors
Diffstat (limited to 'include/administration.hpp')
| -rw-r--r-- | include/administration.hpp | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/include/administration.hpp b/include/administration.hpp index 219ece0..3415b3a 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -20,18 +20,20 @@ #define MAX_LEN_BUSINESSID 32 #define MAX_LEN_TAX_SECTION 16 +#define MAX_BILLING_ITEMS 50 + typedef struct { - char id[MAX_LEN_ID]; - char country_code[MAX_LEN_COUNTRY_CODE]; - float rate; // 0-100 - char description[MAX_LEN_SHORT_DESC]; + char id[MAX_LEN_ID]; // T/[id] + char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code + float rate; // 0-100% + char description[MAX_LEN_SHORT_DESC]; // Currently only used for global tax brackets } country_tax_bracket; typedef struct { - char id[MAX_LEN_ID]; - char code[MAX_LEN_CODE]; + char id[MAX_LEN_ID]; // C/[id] + char code[MAX_LEN_CODE]; // Internal 4 letter code char description[MAX_LEN_LONG_DESC]; } cost_center; @@ -39,7 +41,7 @@ typedef struct { char address1[MAX_LEN_ADDRESS]; char address2[MAX_LEN_ADDRESS]; - char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code. + char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code } address; typedef enum @@ -50,12 +52,12 @@ typedef enum typedef struct { - char id[MAX_LEN_ID]; + char id[MAX_LEN_ID]; // C/[id] char name[MAX_LEN_LONG_DESC]; address address; contact_type type; - char taxid[MAX_LEN_TAXID]; - char businessid[MAX_LEN_TAXID]; + char taxid[MAX_LEN_TAXID]; // Required for business contact + char businessid[MAX_LEN_TAXID]; // Required for business contact char email[MAX_LEN_EMAIL]; char phone_number[MAX_LEN_PHONE]; char bank_account[MAX_LEN_BANK]; @@ -70,11 +72,11 @@ typedef enum typedef struct { - char id[MAX_LEN_ID]; + char id[MAX_LEN_ID]; // P/[id] char description[MAX_LEN_LONG_DESC]; project_state state; time_t start_date; - time_t end_date; + time_t end_date; // Set when project is cancelled } project; typedef enum @@ -91,8 +93,8 @@ typedef enum typedef struct { - char id[MAX_LEN_ID]; - char invoice_id[MAX_LEN_ID]; + char id[MAX_LEN_ID]; // B/[id] + char invoice_id[MAX_LEN_ID]; // I/[id] float amount; bool amount_is_percentage; char description[MAX_LEN_LONG_DESC]; @@ -100,21 +102,21 @@ typedef struct float discount; bool discount_is_percentage; float net; - char currency[MAX_LEN_CURRENCY]; - char tax_bracket_id[MAX_LEN_ID]; + char currency[MAX_LEN_CURRENCY]; // 3 letter code + char tax_bracket_id[MAX_LEN_ID]; // T/[id] float tax; float total; - // todo + // TODO uninplemented char tax_section[MAX_LEN_TAX_SECTION]; } billing_item; typedef struct { - char id[MAX_LEN_ID]; + char id[MAX_LEN_ID]; // I/[id] char sequential_number[MAX_LEN_SEQ_NUM]; // INV0000000000 - INV9999999999 - char customer_id[MAX_LEN_ID]; - char supplier_id[MAX_LEN_ID]; + char customer_id[MAX_LEN_ID]; // C/[id] + char supplier_id[MAX_LEN_ID]; // C/[id] contact addressee; time_t issued_at; time_t expires_at; @@ -129,14 +131,14 @@ typedef struct float tax; float net; - char currency[MAX_LEN_CURRENCY]; + char currency[MAX_LEN_CURRENCY]; // 3 letter code bool is_triangulation; // True of addressee != customer invoice_status status; - bool is_intra_community; // TODO - time_t payment_on_account_date; // TODO - char tax_representative[MAX_LEN_LONG_DESC]; // TODO - char corrected_sequential_number[MAX_LEN_ID]; // TODO + bool is_intra_community; // TODO uninplemented + time_t payment_on_account_date; // TODO uninplemented + char tax_representative[MAX_LEN_LONG_DESC]; // TODO uninplemented + char corrected_sequential_number[MAX_LEN_ID]; // TODO uninplemented // Used for forms, not stored on disk. Filled when retrieved. contact supplier; @@ -179,7 +181,9 @@ bool administration_contact_remove(contact data); bool administration_contact_is_valid(contact data); bool administration_contact_can_be_deleted(contact data); +bool administration_contact_equals(contact c1, contact c2); +bool administration_contact_get_by_id(contact* buffer, char* id); int administration_contact_get_autocompletions(contact* buffer, int buf_size, char* name); u32 administration_contact_get_partial_list(u32 page_index, u32 page_size, contact* buffer); @@ -224,6 +228,7 @@ u32 administration_invoice_count(); invoice administration_invoice_create_empty(); bool administration_invoice_add(invoice* invoice); bool administration_invoice_update(invoice* invoice); +bool administration_invoice_remove(invoice* invoice); void administration_invoice_set_currency(invoice* invoice, char* currency); invoice administration_invoice_create_copy(invoice* invoice); @@ -234,7 +239,7 @@ u32 administration_invoice_get_partial_list(u32 page_index, u32 page_size, i // Billing item functions. // ======================= -u32 administration_billing_items_count(invoice* invoice); +u32 administration_billing_item_count(invoice* invoice); billing_item administration_billing_item_create_empty(); bool administration_billing_item_add_to_invoice(invoice* invoice, billing_item item); bool administration_billing_item_update_in_invoice(invoice* invoice, billing_item item); |
