- $index = $item_tax['tax_type_id'];
- if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings
- $nprice = get_tax_free_price_for_item($items[$i], $prices[$i], $tax_group, $tax_included);
- $ret_tax_array[$index]['Value'] += ($nprice * $item_tax['rate'] / 100);
- $ret_tax_array[$index]['Net'] += $nprice;
- } else {
- $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100);
- $ret_tax_array[$index]['Net'] += $prices[$i];
+ if ($item_tax['rate'] !== null) {
+ $index = $item_tax['tax_type_id'];
+ if ($tax_included == 1) {
+ $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec);
+ $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec);
+ } else {
+ $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec);
+ $ret_tax_array[$index]['Net'] += $prices[$i];
+ }