Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0044217 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Discounts by Total | major | always | 2020-05-28 08:27 | 2020-06-11 18:55 | |||
Reporter | Leyre | View Status | public | |||||
Assigned To | ranjith_qualiantech_com | |||||||
Priority | high | Resolution | fixed | Fixed in Version | RR20Q3 | |||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | marvintm | |||||||
OBNetwork customer | Gold | |||||||
Support ticket | 16234 | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0044217: The "Variable Percentage Discount per Total Amount" discount is not calculated correctly. | |||||||
Description | The "Variable Percentage Discount per Total Amount" discount is not calculated correctly. | |||||||
Steps To Reproduce | Backend: 1) Configure a product: 1.1. Grouped product = N 2.2. Price = 149.9 2.3. UPC/EAN = 1 (simple number, to enter the product in the POS). 2) Configure a discount: 2.1. Type = Variable Percentage Discount per Total Amount 2.2. Percentage = 5% Web POS: 1) Add the previous product 123 times. 2) Add the previous discount. Expected result: Total of the receipt without the discount = 149.9 * 123 = 18437.7 Discount amount = 18437.7 * 0.05 = 921.89 Total of the receipt with the discount = 17515.81 Actual result: Total of the receipt without the discount = 18437.7 see attached image step1.png Discount amount = 922.5 see attached image step2.png Total of the receipt with the discount = 17515.20 | |||||||
Tags | No tags attached. | |||||||
Attached Files | ![]() ![]() ![]() | |||||||
![]() |
|
![]() |
|
(0120720) hgbot (developer) 2020-06-08 07:55 |
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal Changeset: 34b16b968acd64d4fbf7eade9959c2f8bbb876d3 Author: Ranjith S R <ranjith <at> qualiantech.com> Date: Mon Jun 08 11:25:07 2020 +0530 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/34b16b968acd64d4fbf7eade9959c2f8bbb876d3 [^] Related to issue-44217 : Updated DiscountsBytotal Percentage calculation * For bytotal percentage discounts, discount will be calculated on total receipt amount After applying discounts for each line, if sum of line discount is not same as total discount, then discount for last line should be adjusted. --- M web/org.openbravo.retail.discounts.bytotal/app/model/business-logic/discounts-engine/engine/rules/by-total-percentage-discount.js --- |
(0120741) hgbot (developer) 2020-06-08 13:53 |
Repository: tools/automation/pi-mobile Changeset: 5bcc0f0b2c82766b8439717a30d6b8f960c6dd60 Author: Ranjith S R <ranjith <at> qualiantech.com> Date: Mon Jun 08 17:23:41 2020 +0530 URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/5bcc0f0b2c82766b8439717a30d6b8f960c6dd60 [^] Verifies issue 44217 : Modified ByTotal Percentage Automated tests * Multidiscounts_ChangeLineQuantitiesWithByTotal * Multidiscounts_FixedPercentageByTotal * Multidiscounts_RemoveMultiDiscountsByTotal * Multidiscounts_VariablePercentageByTotal --- M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/multidiscounts/Multidiscounts_ChangeLineQuantitiesWithByTotals.java M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/multidiscounts/Multidiscounts_FixedPercentageByTotal.java M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/multidiscounts/Multidiscounts_RemoveMultiDiscountsByTotal.java M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/multidiscounts/Multidiscounts_VariablePercentageByTotal.java --- |
(0120802) Leyre (viewer) 2020-06-11 13:45 |
Testing in pi: https://livebuilds.openbravo.com/retail_modules_pgsql_pi/ [^] Web POS: 1) Add a product 149.9 € * 123 times. 2) Add a Variable Percentage Discount per Total Amount = 5% The discount is calculated correctly, but the lines are not calculated proportionally. Please see attached image "problem.png" |
(0120806) marvintm (viewer) 2020-06-11 18:55 |
As far as we can see, the result is correct. The discrepancy comes from the fact that, when we calculate the discounts that apply to multiple lines, we try as much as possible to calculate them proportionally to the total amount of the line. However, the discounts need to be rounded to two decimals, and this means that some precision may be lost. As we anyway need to apply a fixed discount, we always follow the convention of applying the rounding error to the last discounted line. In the specified case: Discount: 18437,7*0.05=921.89 Proportional discount for each line: 921,89*149/(149*123) = 7.495, which rounded is 7.5. Total discount would then be: 7.5*123 = 922,5 Difference with desired discount: 921.89-922,5 = -0.61 This difference is then applied to the last discounted line. |
![]() |
|||
Date Modified | Username | Field | Change |
2020-05-28 08:27 | Leyre | New Issue | |
2020-05-28 08:27 | Leyre | Assigned To | => Retail |
2020-05-28 08:27 | Leyre | OBNetwork customer | => Gold |
2020-05-28 08:27 | Leyre | Support ticket | => 16234 |
2020-05-28 08:27 | Leyre | Resolution time | => 1592431200 |
2020-05-28 08:27 | Leyre | Triggers an Emergency Pack | => No |
2020-05-28 08:27 | Leyre | File Added: step1.png | |
2020-05-28 08:28 | Leyre | File Added: step2.png | |
2020-06-05 10:37 | ranjith_qualiantech_com | Assigned To | Retail => ranjith_qualiantech_com |
2020-06-08 07:21 | ranjith_qualiantech_com | Status | new => scheduled |
2020-06-08 07:55 | hgbot | Checkin | |
2020-06-08 07:55 | hgbot | Note Added: 0120720 | |
2020-06-08 13:53 | hgbot | Checkin | |
2020-06-08 13:53 | hgbot | Note Added: 0120741 | |
2020-06-09 09:16 | ranjith_qualiantech_com | Status | scheduled => resolved |
2020-06-09 09:16 | ranjith_qualiantech_com | Resolution | open => fixed |
2020-06-09 19:06 | marvintm | Review Assigned To | => marvintm |
2020-06-09 19:06 | marvintm | Status | resolved => closed |
2020-06-09 19:06 | marvintm | Fixed in Version | => RR20Q3 |
2020-06-11 13:45 | Leyre | Note Added: 0120802 | |
2020-06-11 13:45 | Leyre | Status | closed => new |
2020-06-11 13:45 | Leyre | File Added: problem.png | |
2020-06-11 18:51 | marvintm | Status | new => scheduled |
2020-06-11 18:55 | marvintm | Note Added: 0120806 | |
2020-06-11 18:55 | marvintm | Status | scheduled => resolved |
2020-06-11 18:55 | marvintm | Status | resolved => closed |
Copyright © 2000 - 2009 MantisBT Group |