summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/administration.hpp53
-rw-r--r--include/ui.hpp3
2 files changed, 51 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);
diff --git a/include/ui.hpp b/include/ui.hpp
index c0bdcf8..044eff5 100644
--- a/include/ui.hpp
+++ b/include/ui.hpp
@@ -41,16 +41,19 @@ void ui_draw_projects();
void ui_draw_invoices();
void ui_draw_settings();
void ui_draw_expenses();
+void ui_draw_earnings();
void ui_setup_invoices();
void ui_setup_contacts();
void ui_setup_projects();
void ui_setup_settings();
void ui_setup_expenses();
+void ui_setup_earnings();
void ui_destroy_invoices();
void ui_destroy_settings();
void ui_destroy_expenses();
+void ui_destroy_earnings();
// Custom imgui widgets.
int TextInputWithAutocomplete(const char* label, const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count); \ No newline at end of file