Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042544Retail ModulesWeb POSpublic2019-12-12 19:182019-12-25 21:18
marvintm 
ranjith_qualiantech_com 
normalmajorhave not tried
closedfixed 
5
 
RR19Q3.2RR19Q3.2 
guilleaer
Production - Confirmed Stable
2019-01-16
RR19Q2
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/4cd21ae4e9d2 [^]
No
0042544: Precision problem when calculating prices for services
There is currently a problem in the precision of calculation of the prices for services using Service Price Rules functionality. The calculation is not properly applying the currency precision, which leads to wrong calculation result.
- Define the POS precision of currency EURO to 0.
- In the back office, configure the service "Configuration" so that it implements a Service Price Rule of percentage 10 (and is marked as "Is Price Rule based").
- Define the price of GPS nano in the pricelist to 100, and the price of the Configuration service to 3.99.
- In the WebPOS, add a GPS Nano product.
- You will be shown the mandatory proposed services, and you will see that the "Configuration" service has price 4. This is wrong, it should have price 13.99 (3.99+10).
The problem is the implementation of the following function:

function calculatePercentageAmount(
    product,
    amount,
    percentage,
    partialPrice,
    callback
  ) {
    var newprice,
      oldprice = partialPrice ? 0 : product.get('listPrice');
    newprice = OB.DEC.add(
      oldprice,
      OB.DEC.mul(amount, OB.DEC.div(percentage, 100))
    );
    callback(newprice);
  }

The division of the percentage by 100 is rounded before the result is then multiplied by the amount. This is not correct, only the final result should be rounded.
No tags attached.
blocks defect 0042542 closed ranjith_qualiantech_com Precision problem when calculating prices for services 
Issue History
2019-12-12 19:21marvintmTypedefect => backport
2019-12-12 19:21marvintmTarget Version => RR19Q3.2
2019-12-16 14:03hgbotCheckin
2019-12-16 14:03hgbotNote Added: 0116347
2019-12-16 14:03hgbotStatusscheduled => resolved
2019-12-16 14:03hgbotResolutionopen => fixed
2019-12-16 14:03hgbotFixed in SCM revision => http://code.openbravo.com/retail/backports/3.0RR19Q3.2/org.openbravo.retail.posterminal/rev/abe46f59a942a9fc2de152a7df0322de2cf3edcb [^]
2019-12-25 21:18guilleaerReview Assigned To => guilleaer
2019-12-25 21:18guilleaerStatusresolved => closed
2019-12-25 21:18guilleaerFixed in Version => RR19Q3.2

Notes
(0116347)
hgbot   
2019-12-16 14:03   
Repository: retail/backports/3.0RR19Q3.2/org.openbravo.retail.posterminal
Changeset: abe46f59a942a9fc2de152a7df0322de2cf3edcb
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Dec 16 18:33:33 2019 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR19Q3.2/org.openbravo.retail.posterminal/rev/abe46f59a942a9fc2de152a7df0322de2cf3edcb [^]

Fixed issue 42544 : BigDecimal should be used to calculate percentage instead of DEC function

* If Precision is set as 0, DEC function will return invalid value for percentage calculation

---
M web/org.openbravo.retail.posterminal/js/utils/ob-utilitiesuipos.js
---