From b3f53fa6278180c34ac554742ed214bf96fff116 Mon Sep 17 00:00:00 2001 From: Steve Ireland Date: Mon, 4 Feb 2019 22:20:51 -0500 Subject: [PATCH] Fix tax group rendering issue triggered by "% CE" --- application/libraries/Tax_lib.php | 9 +++------ application/models/Sale.php | 1 + application/views/sales/invoice.php | 2 +- application/views/sales/invoice_email.php | 2 +- application/views/sales/quote.php | 2 +- application/views/sales/quote_email.php | 2 +- application/views/sales/receipt_default.php | 2 +- application/views/sales/receipt_email.php | 2 +- application/views/sales/receipt_short.php | 2 +- application/views/sales/register.php | 2 +- application/views/sales/tax_invoice.php | 2 +- application/views/sales/work_order.php | 2 +- 12 files changed, 14 insertions(+), 16 deletions(-) diff --git a/application/libraries/Tax_lib.php b/application/libraries/Tax_lib.php index 33b054f41..7c03c625c 100644 --- a/application/libraries/Tax_lib.php +++ b/application/libraries/Tax_lib.php @@ -81,7 +81,6 @@ class Tax_lib foreach($tax_info as $tax) { // This computes tax for each line item and adds it to the tax type total - $tax_group = (float)$tax['percent'] . '% ' . $tax['name']; $tax_basis = $this->CI->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], TRUE); $tax_amount = 0.0; @@ -99,7 +98,7 @@ class Tax_lib if($tax_amount <> 0) { $tax_group_sequence++; - $this->update_taxes($taxes, $tax_type, $tax_group, $tax['percent'], $tax_basis, $tax_amount, $tax_group_sequence, Rounding_mode::HALF_UP, -1, $tax['name']); + $this->update_taxes($taxes, $tax_type, $tax['name'], $tax['percent'], $tax_basis, $tax_amount, $tax_group_sequence, Rounding_mode::HALF_UP, -1, $tax['name']); $tax_group_sequence += 1; } $items_taxes_detail = array(); @@ -161,7 +160,7 @@ class Tax_lib */ public function update_taxes(&$taxes, $tax_type, $tax_group, $tax_rate, $tax_basis, $item_tax_amount, $tax_group_sequence, $rounding_code, $sale_id, $name = '', $tax_code_id = NULL, $jurisdiction_id = NULL,$tax_category_id = NULL ) { - $tax_group_index = $this->clean('X' . $tax_group); + $tax_group_index = $this->clean('X' . (float)$tax_rate . '% ' . $tax_group); if(!array_key_exists($tax_group_index, $taxes)) { @@ -336,12 +335,10 @@ class Tax_lib $cascade_tax_amount = $cascade_tax_amount + $tax_amount; } - $tax_group = (float)$tax_rate . '% ' . $tax['tax_group']; - if($tax_amount != 0) { - $this->update_taxes($taxes, $tax_type, $tax_group, $tax_rate, $tax_basis, $tax_amount, $tax['tax_group_sequence'], $rounding_code, $sale_id, $tax['tax_group'], $tax_code_id, $tax['rate_jurisdiction_id'], $item['tax_category_id']); + $this->update_taxes($taxes, $tax_type, $tax['tax_group'], $tax_rate, $tax_basis, $tax_amount, $tax['tax_group_sequence'], $rounding_code, $sale_id, $tax['tax_group'], $tax_code_id, $tax['rate_jurisdiction_id'], $item['tax_category_id']); } $item_taxes_detail = array(); diff --git a/application/models/Sale.php b/application/models/Sale.php index ca4fd61f2..44c20abfd 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -729,6 +729,7 @@ class Sale extends CI_Model { foreach($sales_taxes as $line=>$sales_tax) { + $sales_tax['tax_group'] = (float)$sales_tax['tax_rate'] . '% ' . $sales_tax['tax_group']; $sales_tax['sale_id'] = $sale_id; $this->db->insert('sales_taxes', $sales_tax); } diff --git a/application/views/sales/invoice.php b/application/views/sales/invoice.php index 8957852f7..ea06a41d8 100755 --- a/application/views/sales/invoice.php +++ b/application/views/sales/invoice.php @@ -180,7 +180,7 @@ $(document).ready(function() ?> - + - + - + - + - : + : - : + : - : + : - + - + - +