summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/administration.hpp227
1 files changed, 119 insertions, 108 deletions
diff --git a/include/administration.hpp b/include/administration.hpp
index 09e0cb2..c099318 100644
--- a/include/administration.hpp
+++ b/include/administration.hpp
@@ -44,6 +44,10 @@
#define MAX_LEN_PROJECT_REPORT_COSTCENTERS 50
#define MAX_BILLING_ITEMS 50
+#define ACTIVITY_MAX_PARAMS 3
+#define ACTIVITY_USER "user"
+#define ACTIVITY_SYSTEM "system"
+
#define MY_COMPANY_ID "C/1"
typedef enum
@@ -398,6 +402,16 @@ typedef struct
typedef struct
{
+ time_t timestamp;
+ char user_name[MAX_LEN_SHORT_DESC];
+ char ref_id[MAX_LEN_ID];
+
+ char message[MAX_LEN_LONG_DESC];
+ char params[ACTIVITY_MAX_PARAMS][MAX_LEN_LONG_DESC];
+} activity;
+
+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.
@@ -408,9 +422,10 @@ typedef struct
list_t contacts;
list_t projects;
- list_t tax_rates; // Enabled tax rates.
- list_t all_tax_rates; // Tax rates for all countries.
+ list_t tax_rates; // Enabled tax rates.
+ list_t all_tax_rates; // Tax rates for all countries.
list_t cost_centers;
+ list_t activities;
u32 invoice_count;
u32 expense_count;
@@ -449,152 +464,148 @@ namespace administration {
// Setup functions.
// =======================
- void create_empty(char* save_file);
- void create_default(char* save_file);
- void create_from_file(char* save_file);
- void destroy();
+ void create_empty(char* save_file);
+ void create_default(char* save_file);
+ void create_from_file(char* save_file);
+ void destroy();
+ void sort_data();
// Callback functions.
// =======================
- void set_administration_data_changed_event_callback(data_changed_event ev);
- void set_data_deleted_event_callback(data_deleted_event ev);
- void set_invoice_changed_event_callback(invoice_changed_event ev);
- void set_contact_changed_event_callback(contact_changed_event ev);
- void set_taxrate_changed_event_callback(taxrate_changed_event ev);
- void set_costcenter_changed_event_callback(costcenter_changed_event ev);
- void set_project_changed_event_callback(project_changed_event ev);
+ void set_administration_data_changed_event_callback(data_changed_event ev);
+ void set_data_deleted_event_callback(data_deleted_event ev);
+ void set_invoice_changed_event_callback(invoice_changed_event ev);
+ void set_contact_changed_event_callback(contact_changed_event ev);
+ void set_taxrate_changed_event_callback(taxrate_changed_event ev);
+ void set_costcenter_changed_event_callback(costcenter_changed_event ev);
+ void set_project_changed_event_callback(project_changed_event ev);
// Company info functions.
// =======================
- contact company_info_get();
- void company_info_import(contact data);
- void company_info_set(contact data);
+ contact company_info_get();
+ void company_info_import(contact data);
+ void company_info_set(contact data);
// Tax functions.
// =======================
- tax_line* get_tax_line_from_report(tax_report* quarter, char* category);
- void create_tax_statement(tax_statement* statement);
+ tax_line* get_tax_line_from_report(tax_report* quarter, char* category);
+ void create_tax_statement(tax_statement* statement);
// Other functions.
// =======================
- char* get_file_path();
- s32 get_next_id();
- s32 get_next_sequence_number();
- char* get_currency_symbol_for_currency(char* code);
- char* get_default_currency();
- time_t get_default_invoice_expire_duration();
- ai_service get_ai_service();
-
- void set_file_path(char* path);
- void set_next_id(s32 nr);
- void set_next_sequence_number(s32 nr);
- void set_ai_service(ai_service provider);
-
- void create_income_statement(income_statement* statement);
- bool can_create_invoices();
+ char* get_file_path();
+ s32 get_next_id();
+ s32 get_next_sequence_number();
+ char* get_currency_symbol_for_currency(char* code);
+ char* get_default_currency();
+ time_t get_default_invoice_expire_duration();
+ ai_service get_ai_service();
+ void set_file_path(char* path);
+ void set_next_id(s32 nr);
+ void set_next_sequence_number(s32 nr);
+ void set_ai_service(ai_service provider);
+ void create_income_statement(income_statement* statement);
+ bool can_create_invoices();
// Contact functions.
// =======================
- u32 contact_count(contact_filter* filter = 0);
- contact contact_create_empty();
- a_err contact_import(contact data);
- a_err contact_add(contact data);
- a_err contact_update(contact data);
- a_err contact_remove(contact data);
-
- a_err addressee_is_valid(delivery_info data);
- a_err contact_is_valid(contact data);
- bool contact_equals(contact c1, contact c2);
-
- a_err contact_get_by_id(contact* buffer, char* id);
- int contact_get_autocompletions(contact* buffer, int buf_size, char* name);
- u32 contact_get_partial_list(u32 page_index, u32 page_size, contact* buffer, contact_filter* filter = 0);
- u32 contact_get_all(contact* buffer);
+ u32 contact_count(contact_filter* filter = 0);
+ contact contact_create_empty();
+ a_err contact_import(contact data);
+ a_err contact_add(contact data);
+ a_err contact_update(contact data);
+ a_err contact_remove(contact data);
+ a_err addressee_is_valid(delivery_info data);
+ a_err contact_is_valid(contact data);
+ bool contact_equals(contact c1, contact c2);
+ a_err contact_get_by_id(contact* buffer, char* id);
+ int contact_get_autocompletions(contact* buffer, int buf_size, char* name);
+ u32 contact_get_partial_list(u32 page_index, u32 page_size, contact* buffer, contact_filter* filter = 0);
+ u32 contact_get_all(contact* buffer);
// Project functions.
// =======================
- u32 project_count();
- project project_create_empty();
- a_err project_import(project data);
- a_err project_add(project data);
- a_err project_update(project data);
- a_err project_remove(project data);
- void project_cancel(project data);
-
- a_err project_is_valid(project data);
-
- char* project_get_status_string(project data);
- u32 project_get_all(project* buffer);
- u32 project_get_partial_list(u32 page_index, u32 page_size, project* buffer);
- a_err project_get_by_id(project* buffer, char* id);
+ u32 project_count();
+ project project_create_empty();
+ a_err project_import(project data);
+ a_err project_add(project data);
+ a_err project_update(project data);
+ a_err project_remove(project data);
+ void project_cancel(project data);
+ a_err project_is_valid(project data);
+ char* project_get_status_string(project data);
+ u32 project_get_all(project* buffer);
+ u32 project_get_partial_list(u32 page_index, u32 page_size, project* buffer);
+ a_err project_get_by_id(project* buffer, char* id);
// Tax rate functions.
// =======================
- u32 tax_rate_count();
- tax_rate tax_rate_create_empty();
- a_err tax_rate_import(tax_rate data);
- a_err tax_rate_enable(tax_rate data);
- a_err tax_rate_is_enabled(tax_rate data);
- a_err tax_rate_disable(tax_rate data);
+ u32 tax_rate_count();
+ tax_rate tax_rate_create_empty();
+ a_err tax_rate_import(tax_rate data);
+ a_err tax_rate_enable(tax_rate data);
+ a_err tax_rate_is_enabled(tax_rate data);
+ a_err tax_rate_disable(tax_rate data);
/// @brief Find tax rate by internal code, across all available tax rates.
- a_err tax_rate_get_by_internal_code(tax_rate* buffer, char* id);
+ a_err tax_rate_get_by_internal_code(tax_rate* buffer, char* id);
/// @brief Get all enabled tax rates.
/// @return tax rate count
- u32 tax_rate_get_all(tax_rate* buffer, tax_rate_type type);
+ u32 tax_rate_get_all(tax_rate* buffer, tax_rate_type type);
// Cost center functions.
// =======================
- u32 cost_center_count();
+ u32 cost_center_count();
cost_center cost_center_create_empty();
- a_err cost_center_import(cost_center data);
- a_err cost_center_add(cost_center data);
- a_err cost_center_update(cost_center data);
-
- a_err cost_center_is_valid(cost_center data);
-
- u32 cost_center_get_all(cost_center* buffer);
- a_err cost_center_get_by_id(cost_center* buffer, char* id);
+ a_err cost_center_import(cost_center data);
+ a_err cost_center_add(cost_center data);
+ a_err cost_center_update(cost_center data);
+ a_err cost_center_is_valid(cost_center data);
+ u32 cost_center_get_all(cost_center* buffer);
+ a_err cost_center_get_by_id(cost_center* buffer, char* id);
// Invoice functions.
// =======================
- u32 invoice_count();
- u32 invoice_get_incomming_count();
- u32 invoice_get_outgoing_count();
- invoice invoice_create_empty();
- a_err invoice_import(invoice* invoice);
- a_err invoice_add(invoice* invoice);
- a_err invoice_update(invoice* invoice);
- a_err invoice_remove(invoice* invoice);
- void invoice_set_currency(invoice* invoice, char* currency);
- invoice invoice_create_copy(invoice* invoice);
- void invoice_destroy(invoice* invoice);
-
- a_err invoice_is_valid(invoice* invoice);
- bool invoice_has_intra_community_services(invoice* invoice);
-
- char* invoice_get_status_string(invoice* invoice);
- u32 invoice_get_partial_list_outgoing(u32 page_index, u32 page_size, invoice* buffer);
- u32 invoice_get_partial_list_incomming(u32 page_index, u32 page_size, invoice* buffer);
- u32 invoice_get_all(invoice* buffer);
- a_err invoice_get_by_id(invoice* buffer, char* id);
- u32 invoice_get_tax_rates(invoice* invoice, tax_rate* buffer);
- bool invoice_get_subtotal_for_tax_rate(invoice* invoice, tax_rate rate, tax_subtotal* buffer);
+ u32 invoice_count();
+ u32 invoice_get_incomming_count();
+ u32 invoice_get_outgoing_count();
+ invoice invoice_create_empty();
+ a_err invoice_import(invoice* invoice);
+ a_err invoice_add(invoice* invoice);
+ a_err invoice_update(invoice* invoice);
+ a_err invoice_remove(invoice* invoice);
+ void invoice_set_currency(invoice* invoice, char* currency);
+ invoice invoice_create_copy(invoice* invoice);
+ void invoice_destroy(invoice* invoice);
+ a_err invoice_is_valid(invoice* invoice);
+ bool invoice_has_intra_community_services(invoice* invoice);
+ char* invoice_get_status_string(invoice* invoice);
+ u32 invoice_get_partial_list_outgoing(u32 page_index, u32 page_size, invoice* buffer);
+ u32 invoice_get_partial_list_incomming(u32 page_index, u32 page_size, invoice* buffer);
+ u32 invoice_get_all(invoice* buffer);
+ a_err invoice_get_by_id(invoice* buffer, char* id);
+ u32 invoice_get_tax_rates(invoice* invoice, tax_rate* buffer);
+ bool invoice_get_subtotal_for_tax_rate(invoice* invoice, tax_rate rate, tax_subtotal* buffer);
// Billing item functions.
// =======================
- u32 billing_item_count(invoice* invoice);
+ u32 billing_item_count(invoice* invoice);
billing_item billing_item_create_empty();
- a_err billing_item_import_to_invoice(invoice* invoice, billing_item item);
- a_err billing_item_add_to_invoice(invoice* invoice, billing_item item);
- a_err billing_item_update_in_invoice(invoice* invoice, billing_item item);
- a_err billing_item_remove_from_invoice(invoice* invoice, billing_item item);
+ a_err billing_item_import_to_invoice(invoice* invoice, billing_item item);
+ a_err billing_item_add_to_invoice(invoice* invoice, billing_item item);
+ a_err billing_item_update_in_invoice(invoice* invoice, billing_item item);
+ a_err billing_item_remove_from_invoice(invoice* invoice, billing_item item);
tax_subtotal billing_item_convert_to_default_currency(invoice* invoice, billing_item item);
- a_err billing_item_is_valid(billing_item item);
+ a_err billing_item_is_valid(billing_item item);
+
+ u32 billing_item_get_all_for_invoice(invoice* invoice, billing_item* buffer);
- u32 billing_item_get_all_for_invoice(invoice* invoice, billing_item* buffer);
+ // Activity functions.
+ // ===================
+ a_err activity_add(char* user, char* ref_id, char* message, ...);
+ u32 activity_get_all_for_object(activity* buffer, char* ref_id);
} \ No newline at end of file