summaryrefslogtreecommitdiff
path: root/include/administration.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/administration.hpp')
-rw-r--r--include/administration.hpp89
1 files changed, 52 insertions, 37 deletions
diff --git a/include/administration.hpp b/include/administration.hpp
index e7cb9b0..e617166 100644
--- a/include/administration.hpp
+++ b/include/administration.hpp
@@ -3,26 +3,43 @@
#include "config.hpp"
#include "simclist.h"
+#define MAX_LEN_SEQ_NUM 16
+#define MAX_LEN_ID 16
+#define MAX_LEN_COUNTRY_CODE 3
+#define MAX_LEN_CODE 5
+#define MAX_LEN_ADDRESS 128
+#define MAX_LEN_FILENAME 255
+#define MAX_LEN_PATH 4096
+#define MAX_LEN_CURRENCY 8
+#define MAX_LEN_SHORT_DESC 32
+#define MAX_LEN_LONG_DESC 64
+#define MAX_LEN_EMAIL 64
+#define MAX_LEN_PHONE 16
+#define MAX_LEN_BANK 32
+#define MAX_LEN_TAXID 32
+#define MAX_LEN_BUSINESSID 32
+#define MAX_LEN_TAX_SECTION 16
+
typedef struct
{
- char id[16];
- char country_code[3];
+ char id[MAX_LEN_ID];
+ char country_code[MAX_LEN_COUNTRY_CODE];
float rate; // 0-100
- char description[32];
+ char description[MAX_LEN_SHORT_DESC];
} country_tax_bracket;
typedef struct
{
- char id[16];
- char code[5];
- char description[64];
+ char id[MAX_LEN_ID];
+ char code[MAX_LEN_CODE];
+ char description[MAX_LEN_LONG_DESC];
} cost_center;
typedef struct
{
- char address1[128];
- char address2[128];
- char country_code[3]; // 2 letter country code.
+ char address1[MAX_LEN_ADDRESS];
+ char address2[MAX_LEN_ADDRESS];
+ char country_code[MAX_LEN_COUNTRY_CODE]; // 2 letter country code.
} address;
typedef enum
@@ -33,15 +50,15 @@ typedef enum
typedef struct
{
- char id[16];
- char name[64];
+ char id[MAX_LEN_ID];
+ char name[MAX_LEN_LONG_DESC];
address address;
contact_type type;
- char taxid[32];
- char businessid[32];
- char email[64];
- char phone_number[16];
- char bank_account[32];
+ char taxid[MAX_LEN_TAXID];
+ char businessid[MAX_LEN_TAXID];
+ char email[MAX_LEN_EMAIL];
+ char phone_number[MAX_LEN_PHONE];
+ char bank_account[MAX_LEN_BANK];
} contact;
typedef enum
@@ -53,8 +70,8 @@ typedef enum
typedef struct
{
- char id[16];
- char description[64];
+ char id[MAX_LEN_ID];
+ char description[MAX_LEN_LONG_DESC];
project_state state;
time_t start_date;
time_t end_date;
@@ -72,53 +89,51 @@ typedef enum
INVOICE_CORRECTED,
} invoice_status;
-#define CURRENCY_LENGTH 8
-
typedef struct
{
- char id[16];
- char invoice_id[16];
+ char id[MAX_LEN_ID];
+ char invoice_id[MAX_LEN_ID];
float amount;
bool amount_is_percentage;
- char description[128];
+ char description[MAX_LEN_LONG_DESC];
float net_per_item;
float discount;
bool discount_is_percentage;
float net;
- char currency[CURRENCY_LENGTH];
- char tax_bracket_id[16];
+ char currency[MAX_LEN_CURRENCY];
+ char tax_bracket_id[MAX_LEN_ID];
float tax;
float total;
// todo
- char tax_section[16];
+ char tax_section[MAX_LEN_TAX_SECTION];
} billing_item;
typedef struct
{
- char id[16];
- char sequential_number[16]; // INV0000000000 - INV9999999999
- char customer_id[16];
- char supplier_id[16];
+ char id[MAX_LEN_ID];
+ char sequential_number[MAX_LEN_SEQ_NUM]; // INV0000000000 - INV9999999999
+ char customer_id[MAX_LEN_ID];
+ char supplier_id[MAX_LEN_ID];
contact addressee;
time_t issued_at;
time_t expires_at;
time_t delivered_at;
- char document[255]; // path to copy of document for incomming invoice.
- char project_id[16];
- char cost_center_id[16];
+ char document[MAX_LEN_PATH]; // path to copy of document for incomming invoice.
+ char project_id[MAX_LEN_ID];
+ char cost_center_id[MAX_LEN_ID];
list_t billing_items;
float total;
float tax;
float net;
- char currency[CURRENCY_LENGTH];
+ char currency[MAX_LEN_CURRENCY];
bool is_triangulation;
bool is_intra_community; // TODO
invoice_status status; // TODO
time_t payment_on_account_date; // TODO
- char tax_representative[64]; // TODO
- char corrected_sequential_number[16]; // TODO
+ char tax_representative[MAX_LEN_LONG_DESC]; // TODO
+ char corrected_sequential_number[MAX_LEN_ID]; // TODO
// Used for forms, not stored on disk. Filled when retrieved.
contact supplier;
@@ -132,7 +147,7 @@ typedef struct
s32 next_id; // Shared across all objects that have an ID.
s32 next_sequence_number; // Sequence number for generating invoice numbers.
- char path[4096];
+ char path[MAX_LEN_PATH];
char program_version[10];
list_t contacts;
list_t projects;