From d337defb092b7480b5bd00e2bd2ea6ffe2225efd Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 7 Mar 2019 17:05:25 -0600 Subject: [PATCH] Expose new "calculated" invoice totals for receiving batch, rows --- tailbone/views/purchasing/batch.py | 34 +++++++++++++++++++++++--- tailbone/views/purchasing/receiving.py | 14 ++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py index 50484583..1c7ccaba 100644 --- a/tailbone/views/purchasing/batch.py +++ b/tailbone/views/purchasing/batch.py @@ -144,6 +144,7 @@ class PurchasingBatchView(BatchMasterView): 'invoice_line_number', 'invoice_unit_cost', 'invoice_total', + 'invoice_total_calculated', 'status_code', 'credits', ] @@ -205,6 +206,14 @@ class PurchasingBatchView(BatchMasterView): g.filters['complete'].default_active = True g.filters['complete'].default_verb = 'is_true' + # invoice_total + g.set_type('invoice_total', 'currency') + g.set_label('invoice_total', "Total") + + # invoice_total_calculated + g.set_type('invoice_total_calculated', 'currency') + g.set_label('invoice_total_calculated', "Total") + g.set_label('date_ordered', "Ordered") g.set_label('date_received', "Received") @@ -347,6 +356,10 @@ class PurchasingBatchView(BatchMasterView): f.set_readonly('invoice_total') f.set_type('invoice_total', 'currency') + # invoice_total_calculated + f.set_readonly('invoice_total_calculated') + f.set_type('invoice_total_calculated', 'currency') + # vendor_email f.set_readonly('vendor_email') f.set_renderer('vendor_email', self.render_vendor_email) @@ -603,7 +616,6 @@ class PurchasingBatchView(BatchMasterView): g.set_type('cases_received', 'quantity') g.set_type('units_received', 'quantity') g.set_type('po_total', 'currency') - g.set_type('invoice_total', 'currency') g.set_type('credits', 'boolean') # we only want the grid column to have abbreviated label, but *not* the filter @@ -617,8 +629,15 @@ class PurchasingBatchView(BatchMasterView): g.set_label('units_received', "Units Rec.") g.filters['units_received'].label = "Units Received" - g.set_label('po_total', "Total") + # invoice_total + g.set_type('invoice_total', 'currency') g.set_label('invoice_total', "Total") + + # invoice_total_calculated + g.set_type('invoice_total_calculated', 'currency') + g.set_label('invoice_total_calculated', "Total") + + g.set_label('po_total', "Total") g.set_label('credits', "Credits?") def make_row_grid_tools(self, batch): @@ -664,11 +683,20 @@ class PurchasingBatchView(BatchMasterView): f.set_type('po_unit_cost', 'currency') f.set_type('po_total', 'currency') f.set_type('invoice_unit_cost', 'currency') - f.set_type('invoice_total', 'currency') # upc f.set_type('upc', 'gpc') + # invoice total + f.set_readonly('invoice_total') + f.set_type('invoice_total', 'currency') + f.set_label('invoice_total', "Invoice Total (Orig.)") + + # invoice total_calculated + f.set_readonly('invoice_total_calculated') + f.set_type('invoice_total_calculated', 'currency') + f.set_label('invoice_total_calculated', "Invoice Total (Calc.)") + # credits f.set_readonly('credits') f.set_renderer('credits', self.render_row_credits) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index b34fabd8..aea318b9 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -161,6 +161,7 @@ class ReceivingBatchView(PurchasingBatchView): 'created', 'created_by', 'rowcount', + 'invoice_total_calculated', 'status_code', 'executed', ] @@ -191,6 +192,7 @@ class ReceivingBatchView(PurchasingBatchView): 'invoice_date', 'invoice_number', 'invoice_total', + 'invoice_total_calculated', 'notes', 'created', 'created_by', @@ -221,7 +223,7 @@ class ReceivingBatchView(PurchasingBatchView): 'cases_received', 'units_received', # 'po_total', - 'invoice_total', + 'invoice_total_calculated', 'credits', 'status_code', 'truck_dump_status', @@ -252,6 +254,7 @@ class ReceivingBatchView(PurchasingBatchView): 'invoice_line_number', 'invoice_unit_cost', 'invoice_total', + 'invoice_total_calculated', 'status_code', 'truck_dump_status', 'claims', @@ -418,6 +421,10 @@ class ReceivingBatchView(PurchasingBatchView): if not self.editing: f.remove_field('order_quantities_known') + # invoice totals + f.set_label('invoice_total', "Invoice Total (Orig.)") + f.set_label('invoice_total_calculated', "Invoice Total (Calc.)") + def template_kwargs_create(self, **kwargs): kwargs = super(ReceivingBatchView, self).template_kwargs_create(**kwargs) if self.allow_truck_dump: @@ -849,7 +856,12 @@ class ReceivingBatchView(PurchasingBatchView): f.set_readonly('units_ordered') f.set_readonly('po_unit_cost') f.set_readonly('po_total') + + # invoice totals f.set_readonly('invoice_total') + f.set_label('invoice_total', "Invoice Total (Orig.)") + f.set_readonly('invoice_total_calculated') + f.set_label('invoice_total_calculated', "Invoice Total (Calc.)") # claims f.set_readonly('claims')