Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034360Retail ModulesWeb POSpublic2016-11-01 14:092016-11-30 17:54
marvintm 
marvintm 
normalmajoralways
closedfixed 
5
 
RR17Q1 
Orekaria
No
0034360: Web POS is not calculating taxes at header level correctly if there are cascade taxes, with price including taxes
Currently, the Web POS is not computing taxes correctly if:
- Taxes are defined at document level
- There are taxes defined to be calculated in cascade

There are two main problems right now:
- The taxes at line level are not properly calculated when defined in cascade, as they are calculated from a total which is computed from a rounded price, which is then multiplied by the quantity. This creates a precision problem.
- The taxes at header level are also not computed properly, as currently the taxes are just summed from the taxes at line level, and then are adjusted so they respect the rate defined for the tax. This adjustment just doesn't work when taxes are defined in cascade.
The following ticket right now is not being computed correctly:
Product Qty Price Total
P1 1200 55.8 66960
P2 600 55.8 33480
P3 840 55.8 46872
P4 37 294.99 10914.63
P5 12 254.95 3059.4
P6 36 299.36 10776.96
                            172062.99

Taxes for P1, P2 and P3 are: IEPS 26.5% + 16% VAT (depending on IEPS)
Taxes for P4, P5 and P6 are: IEPS 53% + 16% VAT (depending on IEPS)
The problem with the taxes at line level in cascade simply needs to be fixed by computing the tax from the total net amount of the line directly, instead of recalculating the net from the net price.

The problem with the taxes at header level needs to be fixed by calculating the taxes at header level properly, directly from the totals computed by summing the lines, instead of calculating them from the taxes at line level.
No tags attached.
related to defect 0035138RR17Q2 closed marvintm Retail Modules Taxes at header level are not computed correctly when using price including taxes, and taxes are defined at line level 
related to design defect 0032265 closed aferraz Openbravo ERP [SER QA 1434] Taxes at document level are not properly calculated in some cases 
Issue History
2016-11-01 14:09marvintmNew Issue
2016-11-01 14:09marvintmAssigned To => marvintm
2016-11-01 14:09marvintmTriggers an Emergency Pack => No
2016-11-01 14:10marvintmSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13533#r13533
2016-11-01 14:13marvintmStatusnew => scheduled
2016-11-01 19:22hgbotCheckin
2016-11-01 19:22hgbotNote Added: 0091039
2016-11-01 19:22hgbotStatusscheduled => resolved
2016-11-01 19:22hgbotResolutionopen => fixed
2016-11-01 19:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/19f3df300f234399cf2a42837690936fc8eb8542 [^]
2016-11-01 19:23hgbotCheckin
2016-11-01 19:23hgbotNote Added: 0091040
2016-11-30 17:54OrekariaReview Assigned To => Orekaria
2016-11-30 17:54OrekariaStatusresolved => closed
2016-11-30 17:54OrekariaFixed in Version => RR17Q1
2017-02-02 19:22marvintmRelationship addedrelated to 0035138
2017-03-06 14:23aferrazRelationship addedrelated to 0032265

Notes
(0091039)
hgbot   
2016-11-01 19:22   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 19f3df300f234399cf2a42837690936fc8eb8542
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Nov 01 17:22:34 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/19f3df300f234399cf2a42837690936fc8eb8542 [^]

Fixed issue 34360. Taxes calculation has been improved. Three main changes have been made:
- Some variable names have been changed for greater clarity.
- When calculating taxes in the case a tax depends on another, the net which will be used will be the total net of the line, instead of calculating the net by multiplying a rounded net price by the quantity, which causes loss of precision.
- The taxes at header level now are computed by grouping the lines which have the same taxes, summing their total gross amounts, and then using the effective rate computed when calculating taxes at line level to generate the initial base, and then computing taxes in a forward manner, instead of trying to sum the taxes at line and then adjusting them.

---
M web/org.openbravo.retail.posterminal/js/data/dataordertaxes.js
---
(0091040)
hgbot   
2016-11-01 19:23   
Repository: tools/automation/pi-mobile
Changeset: 861b64ac7e6b89136cc20b896df6142523cffdc3
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Nov 01 19:23:26 2016 +0100
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/861b64ac7e6b89136cc20b896df6142523cffdc3 [^]

Related to issue 34360. Changed the values of some tests as they have changed due to changes in the tax calculation algorithm.

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/CashUpSplitLinesMultitax.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/multipricelists/MPLDiscountsWithPriceIncludeTaxes.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/sharedpaymentmethods/SPMDiscountsWithPriceIncludeTaxes.java
---