[0000091] Tax for 2 decimal places doesn't compute properly
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 26 Nov 2008 15:34:01 +0000 (15:34 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 26 Nov 2008 15:34:01 +0000 (15:34 +0000)
CHANGELOG.txt
taxes/tax_calc.inc

index 812c7baa86e1617278a95a3c86a9939c582c46f2..a2259263f8de2ece680b8a202bc60808e62f2fb7 100644 (file)
@@ -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
index 9d1ba576097fba04bc6ccac1e86fdf24a4c4b6e1..acc8f0f0633d468aadd47b528f3ad2262b717bd9 100644 (file)
@@ -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);
                                }
                        }
                }