summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-08-16 11:10:29 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-08-16 11:10:29 +0200
commit05bc81cd42c5aeff7cfb6cf6b18f88792e7c16c9 (patch)
tree7bc9c0439507b4531ed78578e441b12cba4dda4e /include
parentf67e92f55b6223f2806c3d5ef1cbe2a638920562 (diff)
invoice form work
Diffstat (limited to 'include')
-rw-r--r--include/administration.hpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/include/administration.hpp b/include/administration.hpp
index af9b29e..fd55978 100644
--- a/include/administration.hpp
+++ b/include/administration.hpp
@@ -69,22 +69,28 @@ typedef enum
INVOICE_CORRECTED,
} invoice_status;
+#define CURRENCY_LENGTH 8
+
typedef struct
{
char id[16];
char invoice_id[16];
- char description[128];
- country_tax_bracket tax_bracket;
- char tax_section[16];
float amount;
bool amount_is_percentage;
- s32 net_per_item;
- s32 net;
- s32 discount;
- s32 tax;
+ char description[128];
+ float net_per_item;
+ float discount;
+ bool discount_is_percentage;
+ float net;
+ char currency[CURRENCY_LENGTH];
+ char tax_bracket_id[16];
+
+ // todo
+ char tax_section[16];
+ float tax;
+ float total;
bool is_intra_community;
bool is_triangulation;
- char currency[16];
char internal_code[64];
} billing_item;
@@ -103,15 +109,15 @@ typedef struct
char cost_center_id[16];
list_t billing_items;
- s32 total;
- s32 tax;
- s32 net;
+ float total;
+ float tax;
+ float net;
invoice_status status;
- char currency[8];
- time_t keep_untill;
- time_t payment_on_account_date;
- char tax_representative[64];
- char corrected_sequential_number[16];
+ char currency[CURRENCY_LENGTH];
+
+ time_t payment_on_account_date; // TODO
+ char tax_representative[64]; // TODO
+ char corrected_sequential_number[16]; // TODO
// Not stored.
contact supplier;
@@ -120,7 +126,9 @@ typedef struct
typedef struct
{
+ // Company info used for invoices. User should not be able to create invoices when this is empty.
contact company_info;
+
s32 next_id; // Shared across all objects that have an ID.
s32 next_sequence_number; // Sequence number for generating invoice numbers.
char path[4096];
@@ -163,6 +171,7 @@ u32 administration_get_all_projects(project* buffer);
u32 administration_get_tax_bracket_count();
u32 administration_get_tax_brackets(country_tax_bracket* buffer);
+u32 administration_get_tax_brackets_for_country(country_tax_bracket* buffer, char* country_code);
bool administration_add_tax_bracket(country_tax_bracket data);
bool administration_update_tax_bracket(country_tax_bracket data);
@@ -173,4 +182,11 @@ bool administration_verify_cost_center_description(char* text);
bool administration_add_cost_center(cost_center data);
bool administration_update_cost_center(cost_center data);
-invoice administration_create_empty_invoice(); \ No newline at end of file
+invoice administration_create_empty_invoice();
+void administration_invoice_set_currency(invoice* invoice, char* currency);
+
+billing_item administration_create_empty_billing_item();
+u32 administration_get_all_billing_items_for_invoice(invoice* invoice, billing_item* buffer);
+u32 administration_get_billing_items_count(invoice* invoice);
+bool administration_add_billing_item_to_invoice(invoice* invoice, billing_item item);
+bool administration_update_billing_item_of_invoice(invoice* invoice, billing_item item); \ No newline at end of file