From 946a0c939c0cb7c28c9af9b7e4e2b20c45dd3702 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 20 Sep 2025 20:25:14 +0200 Subject: billing item validation --- include/administration.hpp | 5 ++++- include/ui.hpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/administration.hpp b/include/administration.hpp index 0d15195..e2ff80d 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -121,7 +121,6 @@ typedef enum typedef struct { char id[MAX_LEN_ID]; // B/[id] - char invoice_id[MAX_LEN_ID]; // I/[id] float amount; bool amount_is_percentage; char description[MAX_LEN_LONG_DESC]; @@ -368,6 +367,8 @@ typedef struct #define A_ERR_MAX_ITEMS_REACHED (1ULL << 15) #define A_ERR_MISSING_CODE (1ULL << 16) #define A_ERR_MISSING_EMAIL (1ULL << 17) +#define A_ERR_MISSING_TAX_RATE (1ULL << 18) +#define A_ERR_INVALID_BILLING_ITEM (1ULL << 19) typedef uint32_t a_err; @@ -497,4 +498,6 @@ a_err administration_billing_item_add_to_invoice(invoice* invoice, billing_ite a_err administration_billing_item_update_in_invoice(invoice* invoice, billing_item item); a_err administration_billing_item_remove_from_invoice(invoice* invoice, billing_item item); +a_err administration_billing_item_is_valid(billing_item item); + u32 administration_billing_item_get_all_for_invoice(invoice* invoice, billing_item* buffer); \ No newline at end of file diff --git a/include/ui.hpp b/include/ui.hpp index 3a8ce66..ebfa210 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -95,6 +95,7 @@ void ui_destroy_earnings(); // Custom imgui widgets. namespace ImGui { + void InputTextWithError(const char* text, char* buffer, size_t buf_size, bool has_error); int TextInputWithAutocomplete(const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count, bool has_error); void FormContactAutocomplete(contact* buffer, bool has_error); @@ -103,7 +104,7 @@ namespace ImGui void FormContactTypeCombo(contact_type* type); void FormCostCenterCombo(char* costcenter_id); void FormProjectCombo(char* project_id); - void FormTaxRateCombo(char* tax_rate_id, char* orig_country, char* dest_country); + void FormTaxRateCombo(char* tax_rate_id, char* orig_country, char* dest_country, bool has_error); bool FormCurrencyCombo(char* currency); void FormToggleCombo(bool *buffer, char* option1, char* option2); } \ No newline at end of file -- cgit v1.2.3-70-g09d2