Page 1 of 1

Wrong VAT calculation

Posted: 10 Feb 2010, 20:39
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:

Re: Wrong VAT calculation

Posted: 13 Feb 2010, 00:23
by Jan
Hi, thank you for this information.

Jan