Wrong VAT calculation

Before you ask about IDnR Addon see the VirtueMart - Invoice, Delivery Note and Receipt Addon
diod
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 07 Feb 2010, 19:09

Wrong VAT calculation

Post by diod »

I am not a coder, but i solved a critical bug in the code so i share.

In delivery.pdf.php, this line is not correct:

Code: Select all

$price_with_tax['sum'] = $db->f('product__price') * $db->f('product_quantity_delivered');
it's not possible tu deduce the VAT from a rounded included tax price because the result in the invoice is:
- wrong including price summary,
- wrong VAT per unit;
- wrong VAT total;
- wrong total amount of the invoice.

I modified the code this way:

Code: Select all

$price_with_tax['sum'] = $db->f('product_item_price') *[TAX RATE OF YOUR COUTRY]* $db->f('product_quantity_delivered');
Now my bills are correct, but hardcode is not clean: It would be better to request in the db the taxrates per product, especially if you have several tax rates in your shop...

Hope this helps :wink:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48536
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Wrong VAT calculation

Post by Jan »

Hi, thank you for this information.

Jan
If you find Phoca extensions useful, please support the project
Post Reply