PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
8.23k stars 4.81k forks source link

Wrong Tax calculation on invoice 8.0.4 / 8.1 #33912

Closed GTriber closed 1 year ago

GTriber commented 1 year ago

Prerequisites

Describe the bug and add attachments

I have this issue, firsts on 8.0.4 and now 8.1. Cant solve it. Product are set with 23% tax, international tax settings same. Only on 23%.

Any order is the same.

When it comes to invoice tax calculation, are wrong. With or without any vouchers. ( i have tried with % voucher and simple price discount ) Don't have any custom checkouts, so it could make such an issue.

Przechwytywanie zawartości sieci Web_11-9-2023_214327_

Expected behavior

No response

Steps to reproduce

  1. Make any order with or without voucher
  2. Complete the order
  3. Check the invoice

PrestaShop version(s) where the bug happened

8.1 / 8.0.4

PHP version(s) where the bug happened

7.4 / 8

If your bug is related to a module, specify its name and its version

No response

Your company or customer's name goes here (if applicable).

No response

sallemiines commented 1 year ago

Hello @GTriber

So your problem is that your tax is 23%? well, if so, you can change it in the product page, see the attached screenshot below:

image

If I misunderstand your issue please provide a screen record to help me understand better the problem. Waiting for your feedback.

Thanks!

MatShir commented 1 year ago

23% of 1164 is 267,92. So the tax calculation on the product seems okay. What is missing maybe for you is the tax configuration on the shipping method. Go on the shipping configuration, to see how the method is set.

GTriber commented 1 year ago

sallemiines

The issue is, that 23% is set right way. But Presta miscalculate tax and total price on invoice. We have got issues with tax office because of that.

MatShir Tax on shipping is also set on 20%

We have tested using tax calculators i.e https://kalkulatory.gofin.pl/kalkulatory/kalkulator-vat-brutto-netto and others. Showing correct prices.

But the invoice showing wrong one.

Invoice is fine if order doesn't have any discounts ( discount are also set with tax 23% ) While discount using price ie. 5$ you can set tax. On Discount using 5% you cant set any tax.

MatShir commented 1 year ago

To dig the issue, @GTriber maybe you could share the invoice you wish to have. Otherwise, I can't see where the calculation goes wrong

RosaBenouamer commented 1 year ago

Hello, thank you for your issue. In addition, of what @MatShir ask could you please precise the kind of discount. Amount ? Percent ? Tax include or exclude ? @GTriber Thank you

openpresta commented 1 year ago

Same problem found, calcule tax product one by one , not the same with the total of global tax.

PS 8.1.1 example :
Products tax 9.000 % total HT =€1,036.00. Tax value = €93.28 it must be 93,24

when additional tax price each products the total is good 93,24

Any solution ?

RosaBenouamer commented 1 year ago

Hello, @openpresta what is your round type ? image Could you detail the price tax excluded of the product and the number of products please ?

openpresta commented 1 year ago

we have try the 3 type of round type , now it is a each line

some detail with our search :

PS is calculating vat on each unit @ 1.4013 & then rounding this down Then repeating this x the quantity so 4 x This rounding down or up per unit is causing the difference on the total. PS should be calculating the tax on the net amount: so 15.59 x 4 = 62.36 tax = 5.6124 - rounded down to 5.61 4 x 1.4013 = 5.60 - so 0.01 difference

RosaBenouamer commented 1 year ago

@openpresta : What's wrong for this example I have tried like this 👍 image

and get the same result for rounding item, line and total because no rounding for this case with one unit image The invoice is the same for the three rounding mode

and get the same result for rounding item, line and total because no rounding for this case with 3 units image The invoice is the same for the three rounding mode 👍 image

Could you please tell me for which scenario you get Tax value = €93.28 ?

Thank you

RosaBenouamer commented 1 year ago

@openpresta

For this example 👍 we have try the 3 type of round type , now it is a each line

some detail with our search :

PS is calculating vat on each unit @ 1.4013 & then rounding this down Then repeating this x the quantity so 4 x This rounding down or up per unit is causing the difference on the total. PS should be calculating the tax on the net amount: so 15.59 x 4 = 62.36 tax = 5.6124 - rounded down to 5.61 4 x 1.4013 = 5.60 - so 0.01 difference

Could you fill please the following template ? And precise the round mode. Thank you

In Prestashop : 0 chiffre après la virgule | 2 |   |   |   |   |   |   -- | -- | -- | -- | -- | -- | -- | -- Price with VAT |% VAT | Unit Price | Count | Total | Total incl VAT display | Total excl VAT display | included VAT Y | ?? | ?? | 4 | ?? | ??| ?? | N | ??| 15.59| 4| 62.36 | ?? | 26650 | 5.60 Expected : 0 chiffre après la virgule | 2 |   |   |   |   |   |   -- | -- | -- | -- | -- | -- | -- | -- Price with VAT |% VAT | Unit Price | Count | Total | Total incl VAT display | Total excl VAT display | included VAT Y | ?? | ?? | 4 | ?? | ??| ?? | N | ??| 15.59| 4| 62.36 | ?? | 26650 | 5.61

Enjoy your week end :-)

openpresta commented 1 year ago

ok for condition :

1 . We have a group customer named 'Green'

  1. we add specific price to all product
  2. add order from backoffice to check

Capture d’écran 2023-10-06 à 4 10 00 PM

See the invoice

Capture d’écran 2023-10-06 à 4 00 59 PM

Total Tax not same when we addition tax value (product+shipping) and the result in database

RosaBenouamer commented 1 year ago

@openpresta : I understand your case.

It seems that VAT 5.61 is rounding so 5.61 7 = 39.27 So in Total VAT you are expexted 39.27 + 10.50 = 49.77 but you get a different result because today Total VAT seems to be calculated like rounding of total So (62.360.009*7) = 39.29 So 39,29 + 10.50 = 49.79 So sum of rounding for VAT is different of rounding of sum.

We can imagine something coherent between Total tax but just to deep What kind of rounding did you use for this example ? I will in my side take a look with rounding total.

RosaBenouamer commented 1 year ago

@openpresta with round mode it's ok image

RosaBenouamer commented 1 year ago

@openpresta your cas seems to be in mode line image

I dont't know in the law if the TVA has to be calculated exactly not from rounding so we have to changeTotal Tax 39.27 by 39.29 to be coherent or if as we are in round line we have to use 39.27 + 10.50 and so have Total Tax 49.77. Are you aware about this point ?

@MatShir @fabienvallon : the case I was talking about last time. Do you have an opinion ?

openpresta commented 1 year ago

yes the mode round use is the line.

the problem when we use a third party like stipe , we have a error in payment like this. not the same amount

RosaBenouamer commented 1 year ago

Hello @openpresta I understand but I dont't know in the law if the TVA has to be calculated exactly not from rounding so we have to changeTotal Tax 39.27 by 39.29 to be coherent or if as we are in round line we have to use 39.27 + 10.50 and so have Total Tax 49.77. Are you aware about this point ?

RosaBenouamer commented 1 year ago

@openpresta : in the meantime does it make sens for you to use round total to not have difference in taxes ?

RosaBenouamer commented 1 year ago

I have opened a discussion on this subject : https://github.com/PrestaShop/PrestaShop/discussions/34327

cruftex commented 1 year ago

There are many problems which lead to wrong invoices and also more than dozens of issues like this in the past. Main problems:

I summarised this all here: https://github.com/PrestaShop/PrestaShop/discussions/32969

paulnoelcholot commented 1 year ago

Hello @GTriber,

Since we had no news from you for more than 20 days, I'll close this ticket to avoid cluttering up the backlog. Please note that you can always create a new one if further information pops up.

Thank you

gebiss commented 2 months ago

Hello,

I am also struggling with Tax calculation on PS 8.1.7 which I believe to be a bug. I have tested all rounding modes and rounding types. The problem for me appears with the Round on each item type, Round up away from zero, when it is half way there (recommended) mode for products that have Specific prices set by percentage. Here is my scenario:

Currency decimal: 2 Round on each item Round up away from zero, when it is half way there (recommended) Specific prices set by percentage Product base price: £0.30 Discount at 1000pcs: -31% Tax: UK VAT @ 20%

PrestaShop Order calculations: Screenshot 2024-09-11 at 10 46 51

The calculated VAT (20%) from £210 should be £42 but PrestaShop calculated it as £40. I can't figure it out why and how to change it.

The other 2 rounding types (Round on each line, Round on the total) have the tax calculations correct but the Item price with the discount applied is displayed wrong. It is displayed as £0.21 x 1000 = £207. For that reason I don't use these 2 rounding types. Screenshot 2024-09-11 at 10 58 20

Any idea how to resolve the wrong tax calculations on Round on each item option or change the display of item price for Round on each line, Round on the total options?

Regards, Jacek

gebiss commented 2 months ago

It appears that the PS calculations may be correct based on the following:

Rounding mode: Round on each item

Product base price: £0.30

Discount applied at 1000pc: -31%

Price after discount excl. VAT: £0.207, rounded to £0.21

20% VAT applied to each item: £0.21 * 0.20 = 0.042, rounded to £0.04

Item price, incl. VAT: £0.21 + £0.04 = £0.25

Total for 1000pcs: £0.25 * 1000 = £250

In this example VAT is added to each item and then multiplied by quantities? Is there a way of changing this that first is a total calculated excl. VAT and then VAT is added? This would make the calculations more clear and avoiding rounding differences.