From 3c17be2644de4fd33c7b6b336ce39f02cfc0cd5e Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Wed, 26 Nov 2008 15:34:01 +0000 Subject: [PATCH] [0000091] Tax for 2 decimal places doesn't compute properly --- CHANGELOG.txt | 4 ++++ taxes/tax_calc.inc | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 812c7baa..a2259263 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,10 @@ Legend: ! -> Note $ -> Affected files +26-Nov-2008 Joe Hunt +# [0000091] Tax for 2 decimal places doesn't compute properly +$ /taxes/tax_calc.inc + 25-Nov-2008 Janusz Dobrowolski # [0000084] Low inventory items are not marked properly. $ /sales/customer_delivery.php diff --git a/taxes/tax_calc.inc b/taxes/tax_calc.inc index 9d1ba576..acc8f0f0 100644 --- a/taxes/tax_calc.inc +++ b/taxes/tax_calc.inc @@ -175,12 +175,14 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc foreach ($item_taxes as $item_tax) { $index = $item_tax['tax_type_id']; - if($tax_included==1) - $ret_tax_array[$index]['Value'] += round($prices[$i] * $item_tax['rate'] - / ($item_tax['rate'] + 100), user_price_dec()); + if($tax_included==1) // 2008-11-26 Joe Hunt Taxes are stored without roundings + //$ret_tax_array[$index]['Value'] += round($prices[$i] * $item_tax['rate'] + // / ($item_tax['rate'] + 100), user_price_dec()); + $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / ($item_tax['rate'] + 100)); else - $ret_tax_array[$index]['Value'] += - round($prices[$i] * $item_tax['rate'] / 100, user_price_dec()); + //$ret_tax_array[$index]['Value'] += + // round($prices[$i] * $item_tax['rate'] / 100, user_price_dec()); + $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100); } } } @@ -195,12 +197,14 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc { $index = $item_tax['tax_type_id']; if(isset($ret_tax_array[$index])) { - if($tax_included==1) - $ret_tax_array[$index]['Value'] += round($shipping_cost * $item_tax['rate'] - / ($item_tax['rate'] + 100), user_price_dec()); + if($tax_included==1) // 2008-11-26 Joe Hunt Taxes are stored without roundings + //$ret_tax_array[$index]['Value'] += round($shipping_cost * $item_tax['rate'] + // / ($item_tax['rate'] + 100), user_price_dec()); + $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / ($item_tax['rate'] + 100)); else - $ret_tax_array[$index]['Value'] += - round($shipping_cost * $item_tax['rate'] / 100, user_price_dec()); + //$ret_tax_array[$index]['Value'] += + // round($shipping_cost * $item_tax['rate'] / 100, user_price_dec()); + $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100); } } } -- 2.30.2