summaryrefslogtreecommitdiff
path: root/src/ui/ui_invoices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_invoices.cpp')
-rw-r--r--src/ui/ui_invoices.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp
index 8cdf959..9d6f8a2 100644
--- a/src/ui/ui_invoices.cpp
+++ b/src/ui/ui_invoices.cpp
@@ -18,14 +18,17 @@ static invoice selected_for_removal = {0};
static country_tax_bracket* tax_bracket_list_buffer = 0;
static billing_item* invoice_items_buffer = 0;
+static project* project_list_buffer = 0;
void ui_draw_address_form(address* buffer);
void draw_contact_form_ex(contact* buffer, bool viewing_only = false, bool with_autocomplete = false, bool* on_autocomplete = 0);
+void draw_project_selector(char* project_id, project* buffer);
void ui_destroy_invoices()
{
free(tax_bracket_list_buffer);
free(invoice_items_buffer);
+ free(project_list_buffer);
}
void ui_setup_invoices()
@@ -38,6 +41,9 @@ void ui_setup_invoices()
u32 invoice_items_count = MAX_BILLING_ITEMS;
invoice_items_buffer = (billing_item*)malloc(sizeof(billing_item) * invoice_items_count);
+
+ u32 project_count = administration_project_count();
+ project_list_buffer = (project*) malloc(sizeof(project) * project_count);
}
void draw_tax_bracket_selector(char* tax_bracket_id, country_tax_bracket* buffer, char* country_code)
@@ -328,6 +334,9 @@ static void draw_invoice_form(invoice* buffer, bool viewing_only = false)
}
ImGui::Separator();
+ // 9. Project selection
+ draw_project_selector(buffer->project_id, project_list_buffer);
+
ImGui::Spacing();
ImGui::Spacing();
ImGui::Spacing();
@@ -364,7 +373,7 @@ static void ui_draw_invoices_list()
invoice invoice_list[items_per_page];
u32 invoice_count = administration_invoice_get_partial_list_outgoing(current_page, items_per_page, invoice_list);
- u32 total_invoice_count = administation_invoice_get_outgoing_count();
+ u32 total_invoice_count = administration_invoice_get_outgoing_count();
s32 max_page = (total_invoice_count + items_per_page - 1) / items_per_page;
if (max_page == 0) max_page = 1;