diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-09-07 08:39:01 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-09-07 08:39:01 +0200 |
| commit | 026e38982f5388cede0cd7ebad2ea7571d1d57ed (patch) | |
| tree | 5d164c41bec4f0589e991740c1e0050fe746501a /include/administration.hpp | |
| parent | 17e035839a19a8b10d329c28ccaa44ff608d3a33 (diff) | |
income statement generation
Diffstat (limited to 'include/administration.hpp')
| -rw-r--r-- | include/administration.hpp | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/include/administration.hpp b/include/administration.hpp index 015b1c3..45effee 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -20,6 +20,9 @@ #define MAX_LEN_BUSINESSID 32 #define MAX_LEN_TAX_SECTION 16 +#define MAX_LEN_INCOME_STATEMENT_REPORT_QUARTERS 400 +#define MAX_LEN_QUARTERLY_REPORT_PROJECTS 200 +#define MAX_LEN_PROJECT_REPORT_COSTCENTERS 50 #define MAX_BILLING_ITEMS 50 typedef struct @@ -237,7 +240,7 @@ typedef struct time_t expires_at; time_t delivered_at; char document[MAX_LEN_PATH]; // path to copy of document for incomming invoice. - char project_id[MAX_LEN_ID]; // For incomming invoices. optional. + char project_id[MAX_LEN_ID]; // Optional. char cost_center_id[MAX_LEN_ID]; // For incomming invoices. optional. list_t billing_items; @@ -265,6 +268,43 @@ typedef struct typedef struct { + char cost_center_id[MAX_LEN_ID]; + char description[MAX_LEN_LONG_DESC]; + float total; +} project_expense; + +typedef struct +{ + char project_id[MAX_LEN_ID]; + char description[MAX_LEN_LONG_DESC]; + u32 expense_count; + project_expense expenses[MAX_LEN_PROJECT_REPORT_COSTCENTERS]; + float expenses_total; // Sum of all expenses. (incl uncategorized) + float revenue; + float taxes; +} project_report; + +typedef struct +{ + float uncategorized_expenses; // Sum of expenses without project. + float uncategorized_revenue; + float uncategorized_taxes; + + u32 report_count; + project_report reports[MAX_LEN_QUARTERLY_REPORT_PROJECTS]; + u16 year; // 00-99 + u8 quarter; // 0-3 + char quarter_str[MAX_LEN_SHORT_DESC]; +} quarterly_report; + +typedef struct +{ + u32 quarter_count; + quarterly_report quarters[MAX_LEN_INCOME_STATEMENT_REPORT_QUARTERS]; +} income_statement; + +typedef struct +{ contact company_info; // Company info used for invoices. User cannot create invoices when this is empty/invalid. s32 next_id; // Id increment shared across all objects that have an ID. s32 next_sequence_number; // Sequence number for generating invoice numbers. @@ -286,12 +326,13 @@ typedef struct void administration_create(); void administration_destroy(); -// General functions. +// Other functions. // ======================= -administration* administation_get(); +administration* administration_get(); char* administration_file_path_get(); contact administration_company_info_get(); void administration_company_info_set(contact data); +void administration_create_income_statement(income_statement* statement); // Contact functions. // ======================= @@ -324,6 +365,7 @@ bool administration_project_is_valid(project data); char* administration_project_get_status_string(project data); u32 administration_project_get_all(project* buffer); u32 administration_project_get_partial_list(u32 page_index, u32 page_size, project* buffer); +bool administration_project_get_by_id(project* buffer, char* id); // Tax bracket functions. // ======================= @@ -345,12 +387,13 @@ bool administration_cost_center_verify_code(char* code); bool administration_cost_center_verify_description(char* text); u32 administration_cost_center_get_all(cost_center* buffer); +bool administration_cost_center_get_by_id(cost_center* buffer, char* id); // Invoice functions. // ======================= u32 administration_invoice_count(); -u32 administation_invoice_get_incomming_count(); -u32 administation_invoice_get_outgoing_count(); +u32 administration_invoice_get_incomming_count(); +u32 administration_invoice_get_outgoing_count(); invoice administration_invoice_create_empty(); bool administration_invoice_add(invoice* invoice); bool administration_invoice_update(invoice* invoice); |
