Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042543Retail ModulesWeb POSpublic2019-12-12 19:182019-12-30 13:40
marvintm 
ranjith_qualiantech_com 
normalmajorhave not tried
closedfixed 
5
 
RR19Q4.1RR19Q4.1 
guilleaer
Production - Confirmed Stable
2019-01-16
RR19Q2
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/4cd21ae4e9d2 [^]
No
0042543: 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 => RR19Q4.1
2019-12-16 14:03hgbotCheckin
2019-12-16 14:03hgbotNote Added: 0116346
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.0RR19Q4.1/org.openbravo.retail.posterminal/rev/c3492346409c119658f339955863709fc8d79b1e [^]
2019-12-30 13:40guilleaerReview Assigned To => guilleaer
2019-12-30 13:40guilleaerStatusresolved => closed
2019-12-30 13:40guilleaerFixed in Version => RR19Q4.1

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

Fixed issue 42543 : 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
---