Openbravo Issue Tracking System - Retail Modules
View Issue Details
0056612Retail ModulesWeb POSpublic2024-10-01 15:512024-10-28 09:32
sofidossant 
kousalya_r 
highmajoralways
closedinvalid 
5
pi 
 
aferraz
No
0056612: Error in tax calculation
I reproduced an order in livebuilds with 39 lines and an amount, when the 13% tax is applied, it is calculated wrong.
This is due to rounding.
Since if we take the 3 decimals the calculation is correct, but if we take 2, the calculation is wrong.
1 - Configuration of the tax rate - (attached the image)
2 - Make 39 lines of different products, and then add the quantities and amounts I attach.
IMPORTANT: if any discount is applied, deactivate them, or make the amount of the line with the discount equal to the one I attach in the excel.

Then you can see that the total of the order is 24474.24
The tax shown in the pos is 21658.56
but if I calculate the 13% of the total it is 21658.6194

There is a difference of 5

VIDEO https://drive.google.com/file/d/1ACtCLdGewuDWgBgI0ZLd2XLpZT08i7yx/view?usp=sharing [^]
The problem is in this line when we calculate the getTaxeLine

OB.DEC.toNumber(amount.multiply(amount).divide(amount.add(taxAmount), 20, BigDecimal.prototype.ROUND_HALF_UP));


No tags attached.
related to defect 0055876 closed kousalya_r Retail Modules Tax calculation in the WebPOS distrubute the adjustment amount on different lines 
related to defect 0056547 closed kousalya_r Retail Modules Tax name is incorrect when exempt tax validfrom is newer than normal tax 
related to defect 0056546 closed kousalya_r POS2 Tax Exempt is not applied when tax ValidFrom is older than normal tax 
png Captura de pantalla -2024-10-01 10-52-01.png (145,622) 2024-10-01 15:52
https://issues.openbravo.com/file_download.php?file_id=20205&type=bug
png

? example.ods (22,520) 2024-10-01 16:18
https://issues.openbravo.com/file_download.php?file_id=20206&type=bug
Issue History
2024-10-01 15:51sofidossantNew Issue
2024-10-01 15:51sofidossantAssigned To => Retail
2024-10-01 15:51sofidossantTriggers an Emergency Pack => No
2024-10-01 15:52sofidossantFile Added: Captura de pantalla -2024-10-01 10-52-01.png
2024-10-01 15:52sofidossantSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=28520#r28520
2024-10-01 15:53sofidossantSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=28521#r28521
2024-10-01 15:54PracticsIssue Monitored: Practics
2024-10-01 16:18sofidossantFile Added: example.ods
2024-10-02 07:14guillermogilAssigned ToRetail => Triage Omni OMS
2024-10-02 11:01frank_gonzalezNote Added: 0169894
2024-10-02 11:01frank_gonzalezAssigned ToTriage Omni OMS => kousalya_r
2024-10-02 13:47sofidossantNote Added: 0169900
2024-10-08 11:16aferrazNote Added: 0170090
2024-10-08 11:16aferrazReview Assigned To => aferraz
2024-10-08 11:16aferrazStatusnew => closed
2024-10-08 11:16aferrazResolutionopen => no change required
2024-10-25 18:48sofidossantStatusclosed => new
2024-10-25 18:52sofidossantNote Added: 0170974
2024-10-28 09:22aferrazRelationship addedrelated to 0055876
2024-10-28 09:22aferrazRelationship addedrelated to 0056547
2024-10-28 09:22aferrazRelationship addedrelated to 0056546
2024-10-28 09:32aferrazNote Added: 0171005
2024-10-28 09:32aferrazStatusnew => closed
2024-10-28 09:32aferrazResolutionno change required => invalid

Notes
(0169894)
frank_gonzalez   
2024-10-02 11:01   
Jira: https://openbravo.atlassian.net/browse/RM-17859 [^]
(0169900)
sofidossant   
2024-10-02 13:47   
Another issue

https://drive.google.com/file/d/16hS29erR7G0bhVZPishmDSV-WT6fTN8x/view?usp=sharing [^]

80 product with price 42.47
(0170090)
aferraz   
2024-10-08 11:16   
The current tax information is properly calculated based on your Tax Rate configuration.

See: https://wiki.openbravo.com/wiki/Tax_Rate#Tax [^]
"Document Tax Amount Calculation" which is the way how the tax amount is going to be calculated per each tax rate (or %). The options available are:
"Document based amount by rate", this option implies that the tax amount is going to be calculated as tax amount = (tax base amounts sum at the same rate * tax rate)
"Line base amount by rate", this option implies that the tax amount is going to be calculated by line as tax amount = (tax base amount line 1 * tax rate) + (tax base amount line 2 * tax rate) + ....+ (tax base amount line n + tax rate).

As the Tax Rate is configured with Document Tax Amount Calculation = Line base amount by rate, the tax is calculated per line, that is why it doesn't match with the tax calculated by document: https://docs.google.com/spreadsheets/d/1bV9AirYmu1i_5VfhhBLsy4AADDLjdJ6qN2_VVoWW0W8 [^]

In summary:
If you configure the Tax Rate as Document Tax Amount Calculation = Line base amount by rate you will get:
Total Gross Amount: 24474.24
Total Net Amount: 21658.56
Total Tax Amount: 2815.68

If you configure the Tax Rate as Document Tax Amount Calculation = Document base amount by rate you will get:
Total Gross Amount: 24474.24
Total Net Amount: 21658.62
Total Tax Amount: 2815.62
(0170974)
sofidossant   
2024-10-25 18:52   
I have a new case
80 lines with price 5

With tax Entregas IVA 13%

79 lines have the correct tax:
Taxable Amount * 4.42
Tax Amount * 0.58

And one have
Taxable Amount * 4.80
Tax Amount * 0.20

It is INCORRECT
Attached
https://drive.google.com/file/d/1PAukEmFXj_LVrlGUuh_Tn3XZj-nNi4Td/view?usp=sharing [^]
(0171005)
aferraz   
2024-10-28 09:32   
Rejected again because of the same reason explained here: https://issues.openbravo.com/view.php?id=56612#c170090 [^]

Besides, after 0055876, the needed adjustments are now distributed among all the lines.