mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 08:20:54 -04:00
Visualise the taxes according to the selected number of decimals (#1133)
This commit is contained in:
@@ -55,7 +55,7 @@ class Reports extends Secure_Controller
|
||||
'sale_date' => $row['sale_date'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -91,7 +91,7 @@ class Reports extends Secure_Controller
|
||||
'category' => $row['category'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -127,7 +127,7 @@ class Reports extends Secure_Controller
|
||||
'customer_name' => $row['customer'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -163,7 +163,7 @@ class Reports extends Secure_Controller
|
||||
'supplier_name' => $row['supplier'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -199,7 +199,7 @@ class Reports extends Secure_Controller
|
||||
'item_name' => $row['name'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -235,7 +235,7 @@ class Reports extends Secure_Controller
|
||||
'employee_name' => $row['employee'],
|
||||
'quantity' => to_quantity_decimals($row['quantity_purchased']),
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit'])
|
||||
@@ -271,7 +271,7 @@ class Reports extends Secure_Controller
|
||||
'tax_percent' => $row['percent'],
|
||||
'report_count' => $row['count'],
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total'])
|
||||
));
|
||||
}
|
||||
@@ -739,7 +739,7 @@ class Reports extends Secure_Controller
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'employee_name' => $row['employee_name'],
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit']),
|
||||
@@ -748,7 +748,18 @@ class Reports extends Secure_Controller
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array(
|
||||
$drow['name'],
|
||||
$drow['category'],
|
||||
$drow['serialnumber'],
|
||||
$drow['description'],
|
||||
to_quantity_decimals($drow['quantity_purchased']),
|
||||
to_currency($drow['subtotal']),
|
||||
to_currency_tax($drow['tax']),
|
||||
to_currency($drow['total']),
|
||||
to_currency($drow['cost']),
|
||||
to_currency($drow['profit']),
|
||||
$drow['discount_percent'].'%'));
|
||||
}
|
||||
|
||||
if(isset($report_data['rewards'][$key]))
|
||||
@@ -813,7 +824,7 @@ class Reports extends Secure_Controller
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'customer_name' => $row['customer_name'],
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit']),
|
||||
@@ -822,7 +833,18 @@ class Reports extends Secure_Controller
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array(
|
||||
$drow['name'],
|
||||
$drow['category'],
|
||||
$drow['serialnumber'],
|
||||
$drow['description'],
|
||||
to_quantity_decimals($drow['quantity_purchased']),
|
||||
to_currency($drow['subtotal']),
|
||||
to_currency_tax($drow['tax']),
|
||||
to_currency($drow['total']),
|
||||
to_currency($drow['cost']),
|
||||
to_currency($drow['profit']),
|
||||
$drow['discount_percent'].'%'));
|
||||
}
|
||||
|
||||
if(isset($report_data['rewards'][$key]))
|
||||
@@ -889,7 +911,7 @@ class Reports extends Secure_Controller
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'customer_name' => $row['customer_name'],
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'profit' => to_currency($row['profit']),
|
||||
'payment_type' => $row['payment_type'],
|
||||
@@ -898,7 +920,17 @@ class Reports extends Secure_Controller
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array(
|
||||
$drow['name'],
|
||||
$drow['category'],
|
||||
$drow['serialnumber'],
|
||||
$drow['description'],
|
||||
to_quantity_decimals($drow['quantity_purchased']),
|
||||
to_currency($drow['subtotal']),
|
||||
to_currency_tax($drow['tax']),
|
||||
to_currency($drow['total']),
|
||||
to_currency($drow['profit']),
|
||||
$drow['discount_percent'].'%'));
|
||||
}
|
||||
|
||||
if(isset($report_data['rewards'][$key]))
|
||||
@@ -941,7 +973,7 @@ class Reports extends Secure_Controller
|
||||
'employee_name' => $report_data['employee_name'],
|
||||
'customer_name' => $report_data['customer_name'],
|
||||
'subtotal' => to_currency($report_data['subtotal']),
|
||||
'tax' => to_currency($report_data['tax']),
|
||||
'tax' => to_currency_tax($report_data['tax']),
|
||||
'total' => to_currency($report_data['total']),
|
||||
'cost' => to_currency($report_data['cost']),
|
||||
'profit' => to_currency($report_data['profit']),
|
||||
@@ -983,7 +1015,7 @@ class Reports extends Secure_Controller
|
||||
'employee_name' => $row['employee_name'],
|
||||
'customer_name' => $row['customer_name'],
|
||||
'subtotal' => to_currency($row['subtotal']),
|
||||
'tax' => to_currency($row['tax']),
|
||||
'tax' => to_currency_tax($row['tax']),
|
||||
'total' => to_currency($row['total']),
|
||||
'cost' => to_currency($row['cost']),
|
||||
'profit' => to_currency($row['profit']),
|
||||
@@ -1001,7 +1033,18 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']';
|
||||
}
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $quantity_purchased, to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
|
||||
$details_data[$row['sale_id']][] = $this->xss_clean(array(
|
||||
$drow['name'],
|
||||
$drow['category'],
|
||||
$drow['serialnumber'],
|
||||
$drow['description'],
|
||||
$quantity_purchased,
|
||||
to_currency($drow['subtotal']),
|
||||
to_currency_tax($drow['tax']),
|
||||
to_currency($drow['total']),
|
||||
to_currency($drow['cost']),
|
||||
to_currency($drow['profit']),
|
||||
$drow['discount_percent'].'%'));
|
||||
}
|
||||
|
||||
if(isset($report_data['rewards'][$key]))
|
||||
@@ -1195,6 +1238,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
}
|
||||
|
||||
// Returns subtitle for the reports
|
||||
private function _get_subtitle_report($inputs)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,13 @@ function totals_decimals()
|
||||
return $config->item('currency_decimals') ? $config->item('currency_decimals') : 0;
|
||||
}
|
||||
|
||||
function cash_decimals()
|
||||
{
|
||||
$config = get_instance()->config;
|
||||
|
||||
return $config->item('cash_decimals') ? $config->item('cash_decimals') : 0;
|
||||
}
|
||||
|
||||
function tax_decimals()
|
||||
{
|
||||
$config = get_instance()->config;
|
||||
@@ -55,6 +62,11 @@ function to_currency_no_money($number)
|
||||
return to_decimals($number, 'currency_decimals');
|
||||
}
|
||||
|
||||
function to_currency_tax($number)
|
||||
{
|
||||
return to_decimals($number, 'tax_decimals', \NumberFormatter::CURRENCY);
|
||||
}
|
||||
|
||||
function to_tax_decimals($number)
|
||||
{
|
||||
// taxes that are NULL, '' or 0 don't need to be displayed
|
||||
|
||||
@@ -103,7 +103,7 @@ function get_sales_manage_payments_summary($payments, $sales, $controller)
|
||||
$amount -= $sale['change_due'];
|
||||
}
|
||||
}
|
||||
$table .= '<div class="summary_row">' . $payment['payment_type'] . ': ' . to_currency( $amount ) . '</div>';
|
||||
$table .= '<div class="summary_row">' . $payment['payment_type'] . ': ' . to_currency($amount) . '</div>';
|
||||
}
|
||||
$table .= '</div>';
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ function load_config()
|
||||
date_default_timezone_set('America/New_York');
|
||||
}
|
||||
|
||||
bcscale(max(2, $CI->config->item('currency_decimals') + $CI->config->item('tax_decimals')));
|
||||
bcscale(max(2, totals_decimals() + tax_decimals()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,4 +55,4 @@ function load_language_files($path, $language)
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -411,7 +411,7 @@ class Sale_lib
|
||||
}
|
||||
|
||||
// 0 decimal -> 1 / 2 = 0.5, 1 decimals -> 0.1 / 2 = 0.05, 2 decimals -> 0.01 / 2 = 0.005
|
||||
$threshold = bcpow(10, -$this->CI->config->item('currency_decimals')) / 2;
|
||||
$threshold = bcpow(10, -totals_decimals()) / 2;
|
||||
|
||||
if($this->get_mode() == 'return')
|
||||
{
|
||||
@@ -433,7 +433,7 @@ class Sale_lib
|
||||
$payment_total = $this->get_payments_total();
|
||||
$sales_total = $this->get_total();
|
||||
$amount_due = bcsub($sales_total, $payment_total);
|
||||
$precision = $this->CI->config->item('currency_decimals');
|
||||
$precision = totals_decimals();
|
||||
$rounded_due = bccomp(round($amount_due, $precision, PHP_ROUND_HALF_EVEN), 0, $precision);
|
||||
// take care of rounding error introduced by round tripping payment amount to the browser
|
||||
return $rounded_due == 0 ? 0 : $amount_due;
|
||||
@@ -976,7 +976,7 @@ class Sale_lib
|
||||
}
|
||||
$this->CI->session->set_userdata('cash_mode', $cash_mode);
|
||||
|
||||
if($this->CI->config->item('cash_decimals') < $this->CI->config->item('currency_decimals'))
|
||||
if(cash_decimals() < totals_decimals())
|
||||
{
|
||||
$cash_rounding = 1;
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ class Sale_lib
|
||||
public function get_taxes()
|
||||
{
|
||||
$register_mode = $this->CI->config->item('default_register_mode');
|
||||
$tax_decimals = $this->CI->config->item('tax_decimals');
|
||||
$tax_decimals = tax_decimals();
|
||||
$customer_id = $this->get_customer();
|
||||
$customer = $this->CI->Customer->get_info($customer_id);
|
||||
$sales_taxes = array();
|
||||
@@ -1053,7 +1053,6 @@ class Sale_lib
|
||||
}
|
||||
|
||||
$this->CI->tax_lib->round_sales_taxes($sales_taxes);
|
||||
|
||||
}
|
||||
|
||||
return $sales_taxes;
|
||||
@@ -1144,6 +1143,7 @@ class Sale_lib
|
||||
public function get_extended_amount($quantity, $price, $discount_amount = 0)
|
||||
{
|
||||
$extended_amount = bcmul($quantity, $price);
|
||||
|
||||
return bcsub($extended_amount, $discount_amount);
|
||||
}
|
||||
|
||||
@@ -1202,9 +1202,9 @@ class Sale_lib
|
||||
|
||||
if($cash_rounding)
|
||||
{
|
||||
$rounded_total = $this->check_for_cash_rounding($total);
|
||||
return $rounded_total;
|
||||
$total = $this->check_for_cash_rounding($total);
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
@@ -1215,7 +1215,7 @@ class Sale_lib
|
||||
|
||||
public function check_for_cash_rounding($total)
|
||||
{
|
||||
$cash_decimals = $this->CI->config->item('cash_decimals');
|
||||
$cash_decimals = cash_decimals();
|
||||
$cash_rounding_code = $this->CI->config->item('cash_rounding_code');
|
||||
$rounded_total = $total;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Tax library
|
||||
@@ -38,12 +38,12 @@ class Tax_lib
|
||||
*/
|
||||
public function get_item_sales_tax($quantity, $price, $discount_percentage, $tax_percentage, $rounding_code)
|
||||
{
|
||||
$tax_decimals = $this->CI->config->config['tax_decimals'];
|
||||
$decimals = tax_decimals();
|
||||
|
||||
// The tax basis should be returned at the currency scale
|
||||
$tax_basis = $this->CI->sale_lib->get_item_total($quantity, $price, $discount_percentage, TRUE);
|
||||
|
||||
return $this->get_sales_tax_for_amount($tax_basis, $tax_percentage, $rounding_code, $tax_decimals);
|
||||
return $this->get_sales_tax_for_amount($tax_basis, $tax_percentage, $rounding_code, $decimals);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -51,7 +51,6 @@ class Tax_lib
|
||||
*/
|
||||
public function get_sales_tax_for_amount($tax_basis, $tax_percentage, $rounding_code, $decimals)
|
||||
{
|
||||
|
||||
$tax_fraction = bcdiv($tax_percentage, 100);
|
||||
|
||||
$tax_amount = bcmul($tax_basis, $tax_fraction);
|
||||
@@ -59,19 +58,19 @@ class Tax_lib
|
||||
|
||||
if($rounding_code == Rounding_code::HALF_UP)
|
||||
{
|
||||
$rounded_tax_amount = round ( $tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
$rounded_tax_amount = round($tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_DOWN)
|
||||
{
|
||||
$rounded_tax_amount = round ( $tax_amount, $decimals, PHP_ROUND_HALF_DOWN);
|
||||
$rounded_tax_amount = round($tax_amount, $decimals, PHP_ROUND_HALF_DOWN);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_EVEN)
|
||||
{
|
||||
$rounded_tax_amount = round ( $tax_amount, $decimals, PHP_ROUND_HALF_EVEN);
|
||||
$rounded_tax_amount = round($tax_amount, $decimals, PHP_ROUND_HALF_EVEN);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_ODD)
|
||||
{
|
||||
$rounded_tax_amount = round ( $tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
$rounded_tax_amount = round($tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::ROUND_UP) // ROUND_UP
|
||||
{
|
||||
@@ -96,7 +95,6 @@ class Tax_lib
|
||||
*/
|
||||
public function update_sales_taxes(&$sales_taxes, $tax_type, $tax_group, $tax_rate, $tax_basis, $item_tax_amount, $tax_group_sequence, $rounding_code, $sale_id, $name='', $tax_code='')
|
||||
{
|
||||
|
||||
$tax_group_index = $this->clean('X'.$tax_group);
|
||||
|
||||
if(!array_key_exists($tax_group_index, $sales_taxes))
|
||||
@@ -143,11 +141,11 @@ class Tax_lib
|
||||
array_multisort($sort['print_sequence'], SORT_ASC, $sales_taxes);
|
||||
}
|
||||
|
||||
$currency_decimals = $this->CI->config->config['currency_decimals'];
|
||||
$decimals = totals_decimals();
|
||||
|
||||
foreach($sales_taxes as $row_number => $sales_tax)
|
||||
{
|
||||
$sales_taxes[$row_number]['sale_tax_amount'] = $this->get_sales_tax_for_amount($sales_tax['sale_tax_basis'], $sales_tax['tax_rate'], $sales_tax['rounding_code'], $currency_decimals);
|
||||
$sales_taxes[$row_number]['sale_tax_amount'] = $this->get_sales_tax_for_amount($sales_tax['sale_tax_basis'], $sales_tax['tax_rate'], $sales_tax['rounding_code'], $decimals);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +164,7 @@ class Tax_lib
|
||||
array_multisort($sort['print_sequence'], SORT_ASC, $sales_taxes);
|
||||
}
|
||||
|
||||
$currency_decimals = $this->CI->config->config['currency_decimals'];
|
||||
$decimals = totals_decimals();
|
||||
|
||||
foreach($sales_taxes as $row_number => $sales_tax)
|
||||
{
|
||||
@@ -174,30 +172,30 @@ class Tax_lib
|
||||
$rounding_code = $sales_tax['rounding_code'];
|
||||
$rounded_sale_tax_amount = $sale_tax_amount;
|
||||
|
||||
if ($rounding_code == Rounding_code::HALF_UP)
|
||||
if($rounding_code == Rounding_code::HALF_UP)
|
||||
{
|
||||
$rounded_sale_tax_amount = round ( $sale_tax_amount, $currency_decimals, PHP_ROUND_HALF_UP);
|
||||
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_DOWN)
|
||||
{
|
||||
$rounded_sale_tax_amount = round ( $sale_tax_amount, $currency_decimals, PHP_ROUND_HALF_DOWN);
|
||||
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, PHP_ROUND_HALF_DOWN);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_EVEN)
|
||||
{
|
||||
$rounded_sale_tax_amount = round ( $sale_tax_amount, $currency_decimals, PHP_ROUND_HALF_EVEN);
|
||||
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, PHP_ROUND_HALF_EVEN);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_ODD)
|
||||
{
|
||||
$rounded_sale_tax_amount = round ( $sale_tax_amount, $currency_decimals, PHP_ROUND_HALF_UP);
|
||||
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::ROUND_UP)
|
||||
{
|
||||
$fig = (int) str_pad('1', $currency_decimals, '0');
|
||||
$fig = (int) str_pad('1', $decimals, '0');
|
||||
$rounded_sale_tax_amount = (ceil($sale_tax_amount * $fig) / $fig);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::ROUND_DOWN)
|
||||
{
|
||||
$fig = (int) str_pad('1', $currency_decimals, '0');
|
||||
$fig = (int) str_pad('1', $decimals, '0');
|
||||
$rounded_sale_tax_amount = (floor($sale_tax_amount * $fig) / $fig);
|
||||
}
|
||||
elseif($rounding_code == Rounding_code::HALF_FIVE)
|
||||
@@ -230,7 +228,7 @@ class Tax_lib
|
||||
if($tax_category_id != 0)
|
||||
{
|
||||
$tax_rate_info = $this->CI->Tax->get_rate_info($tax_code, $tax_category_id);
|
||||
if ($tax_rate_info)
|
||||
if($tax_rate_info)
|
||||
{
|
||||
$tax_rate = $tax_rate_info->tax_rate;
|
||||
$rounding_code = $tax_rate_info->rounding_code;
|
||||
@@ -258,11 +256,11 @@ class Tax_lib
|
||||
$tax_category = $tax_code_obj->tax_category;
|
||||
}
|
||||
|
||||
$tax_decimals = $this->CI->config->config['tax_decimals'];
|
||||
$decimals = tax_decimals();
|
||||
|
||||
// The tax basis should be returned at the currency scale
|
||||
$tax_basis = $this->CI->sale_lib->get_item_total($item['quantity'], $item['price'], $item['discount'], TRUE);
|
||||
$tax_amount = $this->get_sales_tax_for_amount($tax_basis, $tax_rate, $rounding_code, $tax_decimals);
|
||||
$tax_amount = $this->get_sales_tax_for_amount($tax_basis, $tax_rate, $rounding_code, $decimals);
|
||||
|
||||
$tax_group = (float)$tax_rate . '% ' . $tax_category;
|
||||
$tax_type = Tax_lib::TAX_TYPE_SALES;
|
||||
@@ -300,13 +298,13 @@ class Tax_lib
|
||||
|
||||
public function get_applicable_tax_mode($register_mode, $city, $state, $sales_tax_code)
|
||||
{
|
||||
if ($register_mode == "SALE")
|
||||
if($register_mode == "SALE")
|
||||
{
|
||||
$tax_code = $this->CI->config->config['default_origin_tax_code']; // overrides customer assigned code
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sales_tax_code == '')
|
||||
if($sales_tax_code == '')
|
||||
{
|
||||
$tax_code = $this->CI->Tax->get_sales_tax_code($city, $state);
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ class Sale extends CI_Model
|
||||
*/
|
||||
public function save(&$sale_status, &$items, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table, &$sales_taxes, $sale_id = FALSE)
|
||||
{
|
||||
$tax_decimals = $this->config->item('tax_decimals');
|
||||
$tax_decimals = tax_decimals();
|
||||
|
||||
if(count($items) == 0)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
'name' => 'default_tax_1_rate',
|
||||
'id' => 'default_tax_1_rate',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=>to_tax_decimals($this->config->item('default_tax_1_rate')))); ?>
|
||||
'value'=> to_tax_decimals($this->config->item('default_tax_1_rate')))); ?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
'name' => 'default_tax_2_rate',
|
||||
'id' => 'default_tax_2_rate',
|
||||
'class' => 'form-control input-sm',
|
||||
'value'=>to_tax_decimals($this->config->item('default_tax_2_rate')))); ?>
|
||||
'value'=> to_tax_decimals($this->config->item('default_tax_2_rate')))); ?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -140,7 +140,7 @@ $(document).ready(function()
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $sales_tax['tax_group']; ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="taxes"><?php echo to_currency($sales_tax['sale_tax_amount']); ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="taxes"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if (isset($error_message))
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><?php echo $name; ?></td>
|
||||
<td id="taxes" class="total-value"><?php echo to_currency($value); ?></td>
|
||||
<td id="taxes" class="total-value"><?php echo to_currency_tax($value); ?></td>
|
||||
</tr>
|
||||
<?php }; ?>
|
||||
<tr>
|
||||
|
||||
@@ -140,7 +140,7 @@ if (isset($error_message))
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $sales_tax['tax_group']; ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="taxes"><?php echo to_currency($sales_tax['sale_tax_amount']); ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="taxes"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if (isset($error_message))
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><?php echo $name; ?></td>
|
||||
<td id="taxes" class="total-value"><?php echo to_currency($value); ?></td>
|
||||
<td id="taxes" class="total-value"><?php echo to_currency_tax($value); ?></td>
|
||||
</tr>
|
||||
<?php }; ?>
|
||||
<tr>
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" class="total-value"><?php echo $sales_tax['tax_group']; ?>:</td>
|
||||
<td class="total-value"><?php echo to_currency($sales_tax['sale_tax_amount']); ?></td>
|
||||
<td class="total-value"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;"><?php echo $name; ?>:</td>
|
||||
<td style="text-align:right;"><?php echo to_currency($value); ?></td>
|
||||
<td style="text-align:right;"><?php echo to_currency_tax($value); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" class="total-value"><?php echo $sales_tax['tax_group']; ?>:</td>
|
||||
<td class="total-value"><?php echo to_currency($sales_tax['sale_tax_amount']); ?></td>
|
||||
<td class="total-value"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ if(isset($success))
|
||||
?>
|
||||
<tr>
|
||||
<th style='width: 55%;'><?php echo $sales_tax['tax_group']; ?></th>
|
||||
<th style="width: 45%; text-align: right;"><?php echo to_currency($sales_tax['sale_tax_amount']); ?></th>
|
||||
<th style="width: 45%; text-align: right;"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user