FWIW, I believe that the second example's output is corrected by making the following modification to the zc155/zc156 versions' /includes/modules/order_total/ot_coupon.php:
Code:
switch ($this->calculate_tax)
{
case 'None':
break;
case 'Standard':
if ($od_amount['total'] >= $orderTotalDetails['orderTotal']) $ratio = 1;
foreach ($orderTotalDetails['orderTaxGroups'] as $key=>$value)
{
//-bof-20190217-lat9-Don't pre-round tax to be subtracted, can result in penny-off calculations
// $od_amount['tax_groups'][$key] = zen_round($orderTotalDetails['orderTaxGroups'][$key] * $ratio, $currencyDecimalPlaces);
$od_amount['tax_groups'][$key] = $orderTotalDetails['orderTaxGroups'][$key] * $ratio;
//-eof-20190217-lat9
$od_amount['tax'] += $od_amount['tax_groups'][$key];
if ($od_amount['tax_groups'][$key] == 0) unset($od_amount['tax_groups'][$key]);
}
if (DISPLAY_PRICE_WITH_TAX == 'true' && $coupon->fields['coupon_type'] == 'F') $od_amount['total'] = $od_amount['total'] + $od_amount['tax'];
break;
case 'Credit Note':
$tax_rate = zen_get_tax_rate($this->tax_class);
$od_amount['tax'] = zen_calculate_tax($od_amount['total'], $tax_rate);
$tax_description = zen_get_tax_description($this->tax_class);
$od_amount['tax_groups'][$tax_description] = $od_amount['tax'];
}
Note that the "real" tax-rounding is happening in the order-total's process method.
Bookmarks