summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 20:28:18 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 20:28:18 +0200
commit1c53bd3ac83cc7a985983ac656bc2599276808a4 (patch)
tree47b890b696649fcf85462d71058fb66c078bdca0 /include
parent8aa66a6c6c0d8984b7d2668c03bad5a3b29e3a33 (diff)
country data, working on tax reports
Diffstat (limited to 'include')
-rw-r--r--include/administration.hpp26
-rw-r--r--include/config.hpp3
-rw-r--r--include/countries.hpp42
3 files changed, 70 insertions, 1 deletions
diff --git a/include/administration.hpp b/include/administration.hpp
index 75f5b52..54f8aac 100644
--- a/include/administration.hpp
+++ b/include/administration.hpp
@@ -37,6 +37,8 @@
#define MAX_LEN_TAX_SECTION 16
#define MAX_LEN_API_KEY 256
+#define MAX_LEN_TAX_REPORT_LINES 50
+#define MAX_LEN_TAX_REPORT_QUARTERS 400
#define MAX_LEN_INCOME_STATEMENT_REPORT_QUARTERS 400
#define MAX_LEN_QUARTERLY_REPORT_PROJECTS 200
#define MAX_LEN_PROJECT_REPORT_COSTCENTERS 50
@@ -326,6 +328,29 @@ typedef struct
quarterly_report quarters[MAX_LEN_INCOME_STATEMENT_REPORT_QUARTERS];
} income_statement;
+typedef struct
+{
+ char tax_category[MAX_LEN_SHORT_DESC];
+ float total_net;
+ float total_tax;
+} tax_line;
+
+typedef struct
+{
+ bool is_empty;
+ u16 year; // 00-99
+ u8 quarter; // 0-3
+ char quarter_str[MAX_LEN_SHORT_DESC];
+ u32 line_count;
+ tax_line lines[MAX_LEN_TAX_REPORT_LINES];
+} tax_report;
+
+typedef struct
+{
+ u32 quarter_count;
+ tax_report reports[MAX_LEN_TAX_REPORT_QUARTERS];
+} tax_statement;
+
// Administration callback functions.
// These are called when adding/updating/deleting entries.
// These are NOT called when using import functions.
@@ -438,6 +463,7 @@ namespace administration {
void set_ai_service(ai_service provider);
void create_income_statement(income_statement* statement);
+ void create_tax_statement(tax_statement* statement);
bool can_create_invoices();
// Contact functions.
diff --git a/include/config.hpp b/include/config.hpp
index 5fe4a2c..aecec75 100644
--- a/include/config.hpp
+++ b/include/config.hpp
@@ -31,7 +31,8 @@
namespace config {
static const char* PROGRAM_VERSION = "0.1.0"; // major.minor.patch
-
+
+ // TODO get rid of this and use country iter
static const char* country_codes[] = {
"AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR",
"DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL",
diff --git a/include/countries.hpp b/include/countries.hpp
new file mode 100644
index 0000000..0849ed6
--- /dev/null
+++ b/include/countries.hpp
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2025 Aldrik Ramaekers <aldrik.ramaekers@gmail.com>
+*
+* Permission to use, copy, modify, and/or distribute this software for any
+* purpose with or without fee is hereby granted, provided that the above
+* copyright notice and this permission notice appear in all copies.
+*
+* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#pragma once
+
+#include "administration.hpp"
+
+typedef struct
+{
+ char* country_code;
+ bool is_EU;
+ time_t (*get_default_invoice_expire_duration)();
+ void (*fill_tax_report_with_categories)(tax_report* report);
+ char* (*get_tax_category_for_billing_item)(invoice* inv, billing_item* item);
+} country_impl;
+
+namespace country {
+
+ s32 get_count();
+ char* get_code_by_index(s32 index);
+
+ time_t get_default_invoice_expire_duration(char* country_code);
+
+ bool is_EU(char* country_code);
+ bool tax_is_implemented(char* country_code);
+ void fill_tax_report_with_categories(char* country_code, tax_report* report);
+ char* get_tax_category_for_billing_item(char* country_code, invoice* inv, billing_item* item);
+
+} \ No newline at end of file