3.9.0 VAT calculation error

There is a bug on VAT calculation. In my case, our vat percentage is 5% and it should be $696. But the system seems calculate VAT item by item then summarize VAT [86705%+52505%=697]. Not calculate VAT amount by summarize items first [(8670+5250)*5%=696]. That would be rounding on VAT amount. Please support to correct this problem. Thanks.

https://wiki.dolibarr.org/index.php/VAT_calculation_and_rounding_rules

Best regards

1 Like

Thanks for your prompt reply. But for our case, both method 1 or 2 can’t work.

Description	Quantity	Unit price   Vat rate	Total without tax	Exact tax amount	Tax amount rounded	Exact price	Price inc tax rounded

1 Product alpha 10 867 5% 8670 433.5 434 9104 9104
2 Product beta 10 525 5% 5250 262.5 263 5513 5513

If we choose to round (on 0 decimals) amount after summing all lines, we get:
Total without tax: 8670(E1) + 5250(E2) = 13920 (same than in method 1)
Total tax 5%: (8670(E1) + 5250(E2)) * 5% = 696 (we sum amount without tax for each lines, calculate vat rate on this and after we round value on 0 decimals)
Total inc tax (we sum total without tax + total tax): 13920 + 696 = 14616

Double check VAT rate settings in ‘Setup -> Dictionary setup -> VAT Rates or Sales Tax Rates’

If this is not the culprit, pls. post the error here:

Best regards

PS: Just entered your products as NOT predefined products (after “relocating” my company to Taiwan :-))

NO problem at all.

Best regards

You must not calculated tha vat value on a value that is rounded. You must first take the 5% and then rounded.
So
433.5 rounded to 0 decimal = 434
232.5 rounded to 0 decimal = 233
434 + 233 = 667
Calculation is correct