Hi Andrew
First of all thank you very much for this very useful mod.
I have quite an issue with it, though: ZC computes VAT on the subtotal WITHOUT the discount!
Say I have a 10% tax rate in my country.
The customer places an order for 1000 € + 100 VAT = 1100.
Now he redeems 50€ worth of points.
The order appears as follows: 1000€ - 50 +100 VAT = 1050.
Unfortunately that's wrong.
His order should be :
(1000-50) + 95 VAT = 1045
because his pre-vat total is not 1000 but 950.
Despite the difference is very small as amounts are concerned, it poses a great problem in an accounting and fiscal perspective: the final bill does not have the right amount of tax displayed!
The solution is to reduce the '$value' returned by ot_tax.
Instead of returning $value, it should return:
$value - $points_worth * ($value / $order->info['subtotal']);
in my example : instead of 100 it returns : 100 - 50*(100/1000)=95
$value/$order->info['subtotal'] is used as a way to compute average tax rate on the order (you can have a mix of products with different tax rates)
I did change the ot_tax module (in a very dirty way, you might want to clean it a bit) to reflect these changes, feel free to contact me if I can help to update the module.
Warm regards,
Thomas
PS: since I do B2B, my redeem is applied before tax. If a shop sells to individuals, the issue would be the same, but the calculation would be different. In other words, you need to ask the administrator if the value of the points redeemed is pre- or post- VAT.