Is it possible to paste in a full example of what the invoice looks like as I am still unsure I have understood you?
Is it possible to paste in a full example of what the invoice looks like as I am still unsure I have understood you?
I noticed this years ago and the OP is correct...
ZC calculates the vat on individual items and rounds it, then adds the rounded amounts. When the cart has ONE item (or perhaps just a couple), this is not serious as the vat total will usually be correct.
But when a cart has many items, the vat total can be out by several pennies!
I believe this may have something to do with the policy of sales tax calculation being different in the USA, where tax can be added to individual items and rounded, before it is finally totalled up...
... but in the UK, vat policy is to apply the vat to the transaction TOTAL.
This may be complex to resolve, as it may require a completely separate taxation module for markets where tax is applied to the transaction TOTAL, rather than to individual items.
20 years a Zencart User
When I did my testing some time ago I don't recall having any issues. Mind you I had applied several fixes maybe I patched before I tested.
PS: Sorry was does "the OP" mean?
This is interesting and stems from the same mistake in zen:
learnwebdesignonline.com/tutorials/zencart/sales-tax-error
...But I think the problem I'm encountering is more to do with invoice.php in the admin directory, around line 200, I've cut the echo down a bit for clarity:
That scary use of Zencart functions is a little hard to decipher, but as far as I can tell, it is adding the VAT then totalling, which is wrong, not just for the UK but generally.Code:<?php echo '<td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</b></td>' . "\n"; ?>
Once I've woken up a bit, I might try to post a fix.![]()
OK this is how you fix it...
Open invoice.php in the admin directory and scroll down to line 199, it should look like this:
All we need to do is expand the zen_add_tax() function to also enclose the multiplication by quantity...Code:$currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
Like this:
Simple huh.Code:$currencies->format(zen_add_tax($order->products[$i]['final_price'] * $order->products[$i]['qty'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) .![]()
Well that link you posted refreshmentshop seems a good place to go, although I still seem to have fixed it in another way. Sorry can't reverse engineer what I did to quote it. Maybe if I get more time.