Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033986
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Retail Modules] Web POSmajoralways2016-09-08 23:222016-09-26 23:09
ReporterguilleaerView Statuspublic 
Assigned ToRetail 
PriorityhighResolutionfixedFixed in VersionRR16Q2.3
StatusclosedFix in branchFixed in SCM revisionb1a09f76ee46
ProjectionnoneETAnoneTarget VersionRR16Q2.3
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toguilleaer
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033986: Docuemnt level taxes calculation fails when tax rate has decimals

DescriptionDocument level tax calculations done by web POS are wrong when the tax rate has decimals.

It happens because the algorithm is rounding earlier than expected.
Steps To ReproduceCreate a tax with a rate of 21.5 (you can modify ENTREGAS IVA 21% rate's)
Open web POS in a terminal using price not including taxes
Add a product
 - Avalanche Transceiver (150.50)
Realize that taxes calculations are wrong
 - Tax amount is 27.14 but it should be 26.63
 - Net should be 123.87 but it is 123.36

This happens because when executing the algorithm, we are rounding.
In this case, the algorithm first calculates the total gross 150.5
Then the net is recalculated with the following expression:

newNet = round(totalGross / (1+rate))

The problem is that wrongly we are doing the following

newNet = round(totalGross / round(1+rate))

So in this particular case, newNet calculation is wrong:

wrong -> newNet = round(150.5 / round(1+0.215))
wrong -> newNet = round(150.5 / 1+1.22)
wrong -> newNet = round(123.3606557) -> 123.36
correct -> newNet = round(150.5 / 1+1.215)
correct -> newNet = round(123.8683128) -> 123.87

Because tax amount is based on net, it is also wrong
taxamount = total - newNet

Wrong -> 150.5 - 123.36 = 27.14
Correct -> 150.5 - 123.87 = 26.63
Proposed Solutionround in the correct place when net is being calculated

do
newNet = round(totalGross / (1+rate))
instead of
newNet = round(totalGross / round(1+rate))
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0033933RR16Q4 closedguilleaer Docuemnt level taxes calculation fails when tax rate has decimals 

-  Notes
(0090165)
hgbot (developer)
2016-09-22 12:52

Repository: retail/backports/3.0RR16Q2.3/org.openbravo.retail.posterminal
Changeset: b1a09f76ee46c18e1ee718868599baf5c4dc1b72
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Thu Sep 22 12:52:12 2016 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR16Q2.3/org.openbravo.retail.posterminal/rev/b1a09f76ee46c18e1ee718868599baf5c4dc1b72 [^]

Fixed issue 33986: Round in proper place when document taxes are calculated

---
M web/org.openbravo.retail.posterminal/js/data/dataordertaxes.js
---

- Issue History
Date Modified Username Field Change
2016-09-14 10:17 marvintm Type defect => backport
2016-09-14 10:17 marvintm Target Version RR16Q4 => RR16Q2.3
2016-09-22 12:52 hgbot Checkin
2016-09-22 12:52 hgbot Note Added: 0090165
2016-09-22 12:52 hgbot Status scheduled => resolved
2016-09-22 12:52 hgbot Resolution open => fixed
2016-09-22 12:52 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/847e6420c8a6551d9cc71dd951b8129e5539d68d [^] => http://code.openbravo.com/retail/backports/3.0RR16Q2.3/org.openbravo.retail.posterminal/rev/b1a09f76ee46c18e1ee718868599baf5c4dc1b72 [^]
2016-09-26 23:09 guilleaer Review Assigned To => guilleaer
2016-09-26 23:09 guilleaer Status resolved => closed
2016-09-26 23:09 guilleaer Fixed in Version => RR16Q2.3


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker