From 2cf031b91d5248561fbeff78ceccb0b2d6c73809 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 9 Aug 2025 11:18:02 +0200 Subject: refactors, working on settings view --- include/administration.hpp | 77 +++++++++++++++++++++++++++++++++++++++++++--- include/locales.hpp | 3 -- include/ui.hpp | 12 ++++++-- 3 files changed, 83 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/administration.hpp b/include/administration.hpp index 9506246..79ca6ab 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -5,11 +5,23 @@ typedef struct { - char id[16]; - char name[64]; + char country_code[3]; + float rate; + char description[16]; +} country_tax_bracket; + +typedef struct +{ char address1[128]; char address2[128]; char country[128]; +} address; + +typedef struct +{ + char id[16]; + char name[64]; + address address; char taxid[32]; char businessid[32]; char email[64]; @@ -33,16 +45,70 @@ typedef struct time_t end_date; } project; +typedef enum +{ + INVOICE_PAID, + INVOICE_EXPIRED, + INVOICE_CANCELLED, + INVOICE_REFUNDED, + INVOICE_CORRECTED, +} invoice_status; + +typedef struct +{ + char id[16]; + char invoice_id[16]; + char description[128]; + country_tax_bracket tax_bracket; + char tax_section[16]; + s32 amount; + s32 net_per_item; + s32 net; + s32 discount; + s32 tax; + bool is_intra_community; + bool is_triangulation; + char currency[16]; + char internal_code[64]; +} billing_item; + +typedef struct +{ + char id[16]; + char sequential_number[16]; + char customer_id[16]; + char supplier_id[16]; + time_t issued_at; + time_t delivered_at; + time_t expires_at; + char document[255]; + list_t billing_items; + char project_id[16]; + char cost_center_id[16]; + char cost_unit_id[16]; + s32 total; + s32 tax; + s32 net; + invoice_status status; + address shipping_address; + char currency[16]; + time_t keep_untill; + time_t payment_on_account_date; + char tax_representative[64]; + char corrected_sequential_number[16]; +} invoice; + typedef struct { contact company_info; s32 next_id; char path[4096]; char program_version[10]; - char country_code[2]; + char country_code[3]; list_t contacts; list_t projects; - // invoices + list_t invoices; + list_t tax_brackets; char ai_service[16]; char ai_key[32]; char email_service[16]; @@ -55,6 +121,9 @@ void administration_destroy(); char* administration_get_file_path(); s32 administration_create_id(); +contact administration_get_company_info(); +void administration_set_company_info(contact data); + bool administration_remove_contact(contact data); bool administration_create_contact(contact data); bool administration_update_contact(contact data); diff --git a/include/locales.hpp b/include/locales.hpp index 78bb682..ff116d5 100644 --- a/include/locales.hpp +++ b/include/locales.hpp @@ -1,8 +1,5 @@ #pragma once -#include -#include - typedef struct { const char* key; const char* value; diff --git a/include/ui.hpp b/include/ui.hpp index 827980c..85a5c2f 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -8,8 +8,16 @@ typedef enum VIEW, } view_state; -void view_draw_required_tag(); +void ui_helper_draw_required_tag(); +void ui_helper_show_toast(const char* msg); +void ui_helper_draw_toasts(); void ui_draw_main(); void ui_draw_contacts(); -void ui_draw_projects(); \ No newline at end of file +void ui_draw_projects(); +void ui_draw_invoices(); +void ui_draw_settings(); + +void ui_setup_contacts(); +void ui_setup_projects(); +void ui_setup_settings(); \ No newline at end of file -- cgit v1.2.3-70-g09d2