Forums / Bug Reports / Serious problem with VAT

Serious problem with VAT

Locked

Started by refreshmentshop on 23 Dec 2009, 3:59 PM · Views: 3,057

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
23 Dec 2009, 3:59 PM
#1
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Serious problem with VAT

This is a little hard to explain, but I will try my best.

On an invoice, Zen Cart (1.3.8a) displays the 'Total (inc)' price next to each product sold.

Here the VAT appears to be calculated on an individual item, rounded, then multiplied by the quantity. As far as I know this is the 'correct' way to do this.

But then underneath where the VAT total is shown, it is calculated based only on the subtotal (so not taking rounding into account!)

This means the VAT shown next to the products will not always add up to the VAT total on an invoice, when large product quantities are involved, it can become a big difference. :shocking:

This appears to be a serious problem with Zen Cart's invoicing system.

I apologize if this is a known issue, but are there any plans for a fix?

23 Dec 2009, 4:28 PM
#2
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Re: Serious problem with VAT

Sorry for the double post but I just thought I would give you an example:

The individual VAT(15%) on a £0.95 product would be £0.1425 rounded to £0.14

So ten of these would be £9.50(ex) + £1.40(VAT) = £10.90 (inc)

But the VAT total shows as £1.43

I guess it is working it out something like this:
9.50 x 0.15 = 1.425 ...then rounded to £1.43

Any ideas?

28 Dec 2009, 11:13 AM
#3
silslendir avatar

silslendir

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Serious problem with VAT

I'm a UK zenner so would appear to be in the same tax system as you.

My understanding is UK VAT is on sales. If you Google for a "VAT calculator UK" it will agree with Zen Cart.

So if your sales are £0.95 then the VAT is £0.14, but if your sales are £9.50 then your VAT is £1.43.

I'm sure this has been explained better in a previous thread (sorry haven't searched), but I would agree it can lead to confusion to both shop owner and customer. I recall customising the messages so I felt it was explained better.

28 Dec 2009, 11:48 AM
#4
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Serious problem with VAT

refreshmentshop:

The individual VAT(15%) on a £0.95 product would be £0.1425 rounded to £0.14

So ten of these would be £9.50(ex) + £1.40(VAT) = £10.90 (inc)

But the VAT total shows as £1.43

I guess it is working it out something like this:
9.50 x 0.15 = 1.425 ...then rounded to £1.43

Any ideas?

Hey I am an aussie but even I can see the flaw in your logic
Our GST and your VAT are calculated on the TOTAL (FINAL) sale price, not on individual sub totals.
so your example becomes

So ten of these would be £9.50(ex) + £1.43(VAT) = £10.93 (inc)

as per Zen

4 Jan 2010, 9:48 AM
#5
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Re: Serious problem with VAT

That's the problem it is NOT 'as per zen'.

I don't think I made my example clear enough, on a Zencart invoice it shows the following INCORRECT total by the products:

£9.50 Total (ex)
£10.90 Total (inc) WRONG!!! It should be £10.93

The final total on an invoice is correct but the per-product totals are calculated incorrectly.

To clarify... The problem is Zencart is using two different ways of calculating VAT on the same invoice that don't add up.

I was wrong about which was the correct way, but the problem remains. I hope you can see what I mean now, this needs to be fixed. :(

5 Jan 2010, 11:58 AM
#6
silslendir avatar

silslendir

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Serious problem with VAT

Is it possible to paste in a full example of what the invoice looks like as I am still unsure I have understood you?

5 Jan 2010, 12:37 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Serious problem with VAT

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

6 Jan 2010, 6:45 PM
#8
silslendir avatar

silslendir

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Serious problem with VAT

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?

6 Jan 2010, 6:59 PM
#9
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Serious problem with VAT

silslendir:

PS: Sorry was does "the OP" mean?

OP = Original Poster (Person who made the initial request / post)

20 years a Zencart User

7 Jan 2010, 10:01 AM
#10
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Re: Serious problem with VAT

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:

<?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";

?>

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.

Once I've woken up a bit, I might try to post a fix.:blink:

7 Jan 2010, 10:39 AM
#11
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Re: Serious problem with VAT

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:

                      $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']) .

All we need to do is expand the zen_add_tax() function to also enclose the multiplication by quantity...

Like this:

                      $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']) .

Simple huh. :D

7 Jan 2010, 11:49 PM
#12
silslendir avatar

silslendir

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Serious problem with VAT

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.