diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 1132947d3..c1fce53b5 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -750,7 +750,8 @@ class Config extends Secure_Controller 'email_receipt_check_behaviour' => $this->input->post('email_receipt_check_behaviour'), 'print_receipt_check_behaviour' => $this->input->post('print_receipt_check_behaviour'), 'receipt_show_company_name' => $this->input->post('receipt_show_company_name') != NULL, - 'receipt_show_taxes' => $this->input->post('receipt_show_taxes') != NULL, + 'receipt_show_taxes' => ($this->input->post('receipt_show_taxes') != NULL), + 'receipt_show_tax_ind' => ($this->input->post('receipt_show_tax_ind') != NULL), 'receipt_show_total_discount' => $this->input->post('receipt_show_total_discount') != NULL, 'receipt_show_description' => $this->input->post('receipt_show_description') != NULL, 'receipt_show_serialnumber' => $this->input->post('receipt_show_serialnumber') != NULL, @@ -762,7 +763,7 @@ class Config extends Secure_Controller 'print_bottom_margin' => $this->input->post('print_bottom_margin'), 'print_right_margin' => $this->input->post('print_right_margin') ); - + $result = $this->Appconfig->batch_save($batch_save_data); $success = $result ? TRUE : FALSE; diff --git a/application/language/en-GB/config_lang.php b/application/language/en-GB/config_lang.php index 4ed6eec71..158a93cb3 100644 --- a/application/language/en-GB/config_lang.php +++ b/application/language/en-GB/config_lang.php @@ -231,6 +231,7 @@ $lang["config_receipt_short"] = "Short"; $lang["config_receipt_show_company_name"] = "Show Company Name"; $lang["config_receipt_show_description"] = "Show Description"; $lang["config_receipt_show_serialnumber"] = "Show Serial Number"; +$lang["config_receipt_show_tax_ind"] = "Show Tax Indicator"; $lang["config_receipt_show_taxes"] = "Show Taxes"; $lang["config_receipt_show_total_discount"] = "Show Total Discount"; $lang["config_receipt_template"] = "Receipt Template"; diff --git a/application/language/en-GB/sales_lang.php b/application/language/en-GB/sales_lang.php index d4e983cbb..7520d2d58 100644 --- a/application/language/en-GB/sales_lang.php +++ b/application/language/en-GB/sales_lang.php @@ -97,6 +97,7 @@ $lang["sales_no_filter"] = "All"; $lang["sales_no_items_in_cart"] = "There are no Items in the cart"; $lang["sales_no_sales_to_display"] = "No Sales to display"; $lang["sales_none_selected"] = "You have not selected any Sale(s) to delete"; +$lang["sales_nontaxed_ind"] = " "; $lang["sales_not_authorized"] = "This action is not authorised"; $lang["sales_one_or_multiple"] = "Sale(s)"; $lang["sales_payment"] = "Payment Type"; @@ -154,6 +155,7 @@ $lang["sales_suspended_sales"] = "Suspended"; $lang["sales_table"] = "Table"; $lang["sales_takings"] = "Transactions"; $lang["sales_tax"] = "Tax"; +$lang["sales_taxed_ind"] = "T"; $lang["sales_tax_id"] = "Tax Id"; $lang["sales_tax_invoice"] = "Tax Invoice"; $lang["sales_tax_percent"] = "Tax %"; diff --git a/application/language/en-US/config_lang.php b/application/language/en-US/config_lang.php index b680a17a3..8f89e8bdb 100644 --- a/application/language/en-US/config_lang.php +++ b/application/language/en-US/config_lang.php @@ -231,6 +231,7 @@ $lang["config_receipt_short"] = "Short"; $lang["config_receipt_show_company_name"] = "Show Company Name"; $lang["config_receipt_show_description"] = "Show Description"; $lang["config_receipt_show_serialnumber"] = "Show Serial Number"; +$lang["config_receipt_show_tax_ind"] = "Show Tax Indicator"; $lang["config_receipt_show_taxes"] = "Show Taxes"; $lang["config_receipt_show_total_discount"] = "Show Total Discount"; $lang["config_receipt_template"] = "Receipt Template"; diff --git a/application/language/en-US/sales_lang.php b/application/language/en-US/sales_lang.php index 932bcafdc..7e83e0ab5 100644 --- a/application/language/en-US/sales_lang.php +++ b/application/language/en-US/sales_lang.php @@ -97,6 +97,7 @@ $lang["sales_no_filter"] = "All"; $lang["sales_no_items_in_cart"] = "There are no Items in the cart."; $lang["sales_no_sales_to_display"] = "No Sales to display."; $lang["sales_none_selected"] = "You have not selected any Sale(s) to delete."; +$lang["sales_nontaxed_ind"] = " "; $lang["sales_not_authorized"] = "This action is not authorized."; $lang["sales_one_or_multiple"] = "Sale(s)"; $lang["sales_payment"] = "Payment Type"; @@ -130,6 +131,7 @@ $lang["sales_sale_by_invoice"] = "Sale by Invoice"; $lang["sales_sale_for_customer"] = "Customer:"; $lang["sales_sale_time"] = "Time"; $lang["sales_sales_tax"] = "Sales Tax"; +$lang["sales_taxed_ind"] = "T"; $lang["sales_select_customer"] = "Select Customer"; $lang["sales_send_invoice"] = "Send Invoice"; $lang["sales_send_quote"] = "Send Quote"; diff --git a/application/libraries/Tax_lib.php b/application/libraries/Tax_lib.php index 7c03c625c..a488f5deb 100644 --- a/application/libraries/Tax_lib.php +++ b/application/libraries/Tax_lib.php @@ -55,7 +55,7 @@ class Tax_lib /** * Compute taxes for all items in the cart */ - public function get_taxes($cart) + public function get_taxes(&$cart) { $register_mode = $this->CI->sale_lib->get_mode(); $tax_decimals = tax_decimals(); @@ -69,6 +69,8 @@ class Tax_lib { foreach($cart as $line => $item) { + $taxed = FALSE; + if(!($this->CI->config->item('use_destination_based_tax'))) { // Start of current Base System tax calculations @@ -100,6 +102,7 @@ class Tax_lib $tax_group_sequence++; $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; + $taxed = TRUE; } $items_taxes_detail = array(); $items_taxes_detail['item_id'] = $item['item_id']; @@ -125,12 +128,16 @@ class Tax_lib { $item['tax_category_id'] = $this->CI->config->config['default_tax_category']; } - $tax_category = ''; - $tax_rate = ''; - $rounding_code = Rounding_mode::HALF_UP; - $tax_group_sequence = 0; - $tax_code = ''; - $this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']); + + $taxed = $this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']); + } + if($taxed) + { + $cart[$line]['taxed_flag'] = $this->CI->lang->line('sales_taxed_ind'); + } + else + { + $cart[$line]['taxed_flag'] = $this->CI->lang->line('sales_nontaxed_ind'); } } $this->round_taxes($taxes); @@ -292,6 +299,8 @@ class Tax_lib */ public function apply_destination_tax(&$item, $city, $state, $sales_tax_code_id, $register_mode, $sale_id, &$taxes, &$item_taxes, $line) { + $taxed = FALSE; + $tax_code_id = $this->get_applicable_tax_code($register_mode, $city, $state, $sales_tax_code_id); // If tax code cannot be determined or the price is zero then skip this item @@ -337,7 +346,7 @@ class Tax_lib if($tax_amount != 0) { - + $taxed = TRUE; $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']); } @@ -357,11 +366,11 @@ class Tax_lib $item_taxes[] = $item_taxes_detail; } - return; + return $taxed; } else { - return; + return $taxed; } } diff --git a/application/migrations/20191008100000_receipttaxindicator.php b/application/migrations/20191008100000_receipttaxindicator.php new file mode 100644 index 000000000..b5fafeccf --- /dev/null +++ b/application/migrations/20191008100000_receipttaxindicator.php @@ -0,0 +1,21 @@ +db->query('INSERT INTO ' . $this->db->dbprefix('app_config') . ' (`key`, `value`) + VALUES (\'receipt_show_tax_ind\', \'0\')'); + } + + public function down() + { + $this->db->query('DELETE FROM ' . $this->db->dbprefix('app_config') . ' WHERE key = \'receipt_show_tax_ind\''); + } +} +?> diff --git a/application/views/configs/receipt_config.php b/application/views/configs/receipt_config.php index 8c7bad56c..f57e4bc3c 100644 --- a/application/views/configs/receipt_config.php +++ b/application/views/configs/receipt_config.php @@ -126,6 +126,17 @@ +