Fixed issue 0029339: Discounts are not properly calculated in Q1.1 of 2015 version
authorMiguel de Juana <miguel.dejuana@openbravo.com>
Thu, 19 Mar 2015 11:19:27 +0100
changeset 4105 df0ae84ed721
parent 4104 5a05c6f195bb
child 4106 a39263d0e4bf
Fixed issue 0029339: Discounts are not properly calculated in Q1.1 of 2015 version

Backout issue 28358
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesI.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesII.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentI.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentII.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/ReceiptDiscount.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesI.java	Thu Mar 19 11:49:01 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesI.java	Thu Mar 19 11:19:27 2015 +0100
@@ -42,14 +42,14 @@
   private static final double PRECISSION = 0.1;
   private static final String PRODUCT_NAME = "Baby carrier";
   private static final int QUANTITY = -1;
-  private static final double PRODUCT_NET = 86.75;
-  private static final double PRODUCT_GROSS_UNIT = 104.97;
+  private static final double PRODUCT_NET = 86.76;
+  private static final double PRODUCT_GROSS_UNIT = 104.98;
   private static final double PRODUCT_GROSS_LIST = 110.5;
   private static final double DISCOUNT_TOTAL = -5.52;
-  private static final double DISCOUNT_PERUNIT = 5.52;
+  private static final double DISCOUNT_PERUNIT = 5.51;
   private static final String DISCOUNT_DESCRIPTION = "disc_5_ var_perc";
-  private static final double TOTAL_GROSS = -104.97;
-  private static final double TOTAL_NET = -86.75;
+  private static final double TOTAL_GROSS = -104.98;
+  private static final double TOTAL_NET = -86.76;
 
   @Test
   public void test() {
@@ -104,16 +104,16 @@
     tap(TestId.BUTTON_RECEIPTDISCOUNTS_CHECKAPPLYALL);
     tap(TestId.BUTTON_RECEIPTDISCOUNTS_APPLY);
 
-    verify(TestId.LABEL_TOTALTOPAY, "-104.97");
+    verify(TestId.LABEL_TOTALTOPAY, "-104.98");
     verify(TestId.LABEL_RECEIPT_ROW1_TITLE, "Baby carrier");
     verify(TestId.LABEL_RECEIPT_ROW1_QTY, "-1");
     verify(TestId.LABEL_RECEIPT_ROW1_AMOUNT, "110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_TOTAL, "-110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "5.53");
-    verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "-104.97");
+    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "5.52");
+    verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "-104.98");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TITLE, "Entregas IVA 21%");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-86.75");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-86.76");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "-18.22");
 
     // finish the receipt
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesII.java	Thu Mar 19 11:49:01 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28100_DiscountsNotAppliedToReturnLinesII.java	Thu Mar 19 11:19:27 2015 +0100
@@ -103,13 +103,13 @@
     verify(TestId.LABEL_RECEIPT_ROW1_AMOUNT, "110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_TOTAL, "-110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "5.53");
+    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "5.52");
     verify(TestId.LABEL_RECEIPT_ROW2_TITLE, "Avalanche transceiver");
     verify(TestId.LABEL_RECEIPT_ROW2_QTY, "1");
     verify(TestId.LABEL_RECEIPT_ROW2_AMOUNT, "150.50");
     verify(TestId.LABEL_RECEIPT_ROW2_TOTAL, "150.50");
     verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "-7.53");
+    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "-7.52");
     verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "38.00");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TITLE, "Entregas IVA 21%");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "31.41");
@@ -243,14 +243,14 @@
         case 1:
           assertEquals(10, line);
           assertEquals(DISCOUNT_DESCRIPTION, promotionName);
-          assertEquals(5.53, discountPerUnit, PRECISSION);
-          assertEquals(-5.53, totalDiscount, PRECISSION);
+          assertEquals(5.52, discountPerUnit, PRECISSION);
+          assertEquals(-5.52, totalDiscount, PRECISSION);
           break;
         case 2:
           assertEquals(10, line);
           assertEquals(DISCOUNT_DESCRIPTION, promotionName);
-          assertEquals(7.53, discountPerUnit, PRECISSION);
-          assertEquals(7.53, totalDiscount, PRECISSION);
+          assertEquals(7.52, discountPerUnit, PRECISSION);
+          assertEquals(7.52, totalDiscount, PRECISSION);
           break;
         default:
           throw new RuntimeException("The results of the query are not being processed");
@@ -304,12 +304,12 @@
           assertEquals(-1, qty, 0);
           assertEquals(null, attributeSetValue);
           assertEquals("Unit", UOM);
-          assertEquals(86.75, productNet, PRECISSION);
-          assertEquals(104.97, productGrossUnit, PRECISSION);
+          assertEquals(86.76, productNet, PRECISSION);
+          assertEquals(104.98, productGrossUnit, PRECISSION);
           assertEquals(110.5, productGrossList, PRECISSION);
-          assertEquals(-86.75, lineNet, PRECISSION);
+          assertEquals(-86.76, lineNet, PRECISSION);
           assertEquals(0, discount, PRECISSION);
-          assertEquals(-104.97, lineGross, PRECISSION);
+          assertEquals(-104.98, lineGross, PRECISSION);
           assertEquals("Entregas IVA 21%", taxName);
           break;
         case 2:
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentI.java	Thu Mar 19 11:49:01 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentI.java	Thu Mar 19 11:19:27 2015 +0100
@@ -42,7 +42,7 @@
   private static final double PRECISSION = 0.1;
   private static final String PRODUCT_NAME_GPSHANDHELD = "GPS handheld";
 
-  private static final double TOTAL_NET = -22.84;
+  private static final double TOTAL_NET = -22.85;
   private static final double TOTAL_GROSS = -27.63;
   private static final String DISCOUNT_GPS10 = "GPS_10_per";
   private static final String DISCOUNT_DISC5 = "disc_5_ var_perc";
@@ -115,17 +115,17 @@
     verify(TestId.LABEL_RECEIPT_ROW1_AMOUNT, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW1_TOTAL, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "-14.55");
+    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "-14.54");
     verify(TestId.LABEL_RECEIPT_ROW2_TITLE, PRODUCT_NAME_GPSHANDHELD);
     verify(TestId.LABEL_RECEIPT_ROW2_QTY, "-1");
     verify(TestId.LABEL_RECEIPT_ROW2_AMOUNT, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW2_TOTAL, "-290.90");
     verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "14.55");
+    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "14.54");
     verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "-27.64");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TITLE, "Entregas IVA 21%");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-22.84");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "-4.80");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-22.85");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "-4.79");
 
     // finish the receipt
     final String receiptNo = BackboneHelper.getDocumentNo();
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentII.java	Thu Mar 19 11:49:01 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28164_DiscountsRemovedWhenReturnPresentII.java	Thu Mar 19 11:19:27 2015 +0100
@@ -42,7 +42,7 @@
   private static final double PRECISSION = 0.1;
   private static final String PRODUCT_NAME_GPSHANDHELD = "GPS handheld";
 
-  private static final double TOTAL_NET = -22.84;
+  private static final double TOTAL_NET = -22.85;
   private static final double TOTAL_GROSS = -27.63;
   private static final String DISCOUNT_GPS10 = "GPS_10_per";
   private static final String DISCOUNT_DISC5 = "disc_5_ var_perc";
@@ -115,17 +115,17 @@
     verify(TestId.LABEL_RECEIPT_ROW2_AMOUNT, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW2_TOTAL, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "-14.55");
+    verify(TestId.LABEL_RECEIPT_ROW2_DISCOUNTAMOUNT, "-14.54");
     verify(TestId.LABEL_RECEIPT_ROW1_TITLE, PRODUCT_NAME_GPSHANDHELD);
     verify(TestId.LABEL_RECEIPT_ROW1_QTY, "-1");
     verify(TestId.LABEL_RECEIPT_ROW1_AMOUNT, "290.90");
     verify(TestId.LABEL_RECEIPT_ROW1_TOTAL, "-290.90");
     verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "14.55");
+    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "14.54");
     verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "-27.64");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TITLE, "Entregas IVA 21%");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-22.84");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "-4.80");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "-22.85");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "-4.79");
 
     // finish the receipt
     final String receiptNo = BackboneHelper.getDocumentNo();
@@ -261,14 +261,14 @@
         case 2:
           assertEquals(10, line);
           assertEquals(DISCOUNT_DISC5, promotionName);
-          assertEquals(14.55, discountPerUnit, PRECISSION);
-          assertEquals(14.55, totalDiscount, PRECISSION);
+          assertEquals(14.54, discountPerUnit, PRECISSION);
+          assertEquals(14.54, totalDiscount, PRECISSION);
           break;
         case 3:
           assertEquals(10, line);
           assertEquals(DISCOUNT_DISC5, promotionName);
-          assertEquals(14.55, discountPerUnit, PRECISSION);
-          assertEquals(-14.55, totalDiscount, PRECISSION);
+          assertEquals(14.54, discountPerUnit, PRECISSION);
+          assertEquals(-14.54, totalDiscount, PRECISSION);
           break;
         default:
           throw new RuntimeException("The results of the query are not being processed");
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/ReceiptDiscount.java	Thu Mar 19 11:49:01 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/ReceiptDiscount.java	Thu Mar 19 11:19:27 2015 +0100
@@ -46,13 +46,13 @@
   private static final String PRODUCT_NAME = "Baby carrier";
   private static final double QUANTITY = 1;
   private static final double PRODUCT_GROSS_LIST = 110.5;
-  private static final double PRODUCT_GROSS_UNIT = 104.97;
-  private static final double PRODUCT_NET = 86.75;
-  private static final double DISCOUNT_TOTAL = 5.53;
-  private static final double DISCOUNT_PERUNIT = 5.53;
+  private static final double PRODUCT_GROSS_UNIT = 104.98;
+  private static final double PRODUCT_NET = 86.76;
+  private static final double DISCOUNT_TOTAL = 5.52;
+  private static final double DISCOUNT_PERUNIT = 5.51;
   private static final String DISCOUNT_DESCRIPTION = "disc_5_ var_perc";
-  private static final double TOTAL_GROSS = 104.97;
-  private static final double TOTAL_NET = 86.75;
+  private static final double TOTAL_GROSS = 104.98;
+  private static final double TOTAL_NET = 86.76;
 
   @Test
   public void test() {
@@ -79,16 +79,16 @@
     tap(TestId.BUTTON_RECEIPTDISCOUNTS_CHECKAPPLYALL);
     tap(TestId.BUTTON_RECEIPTDISCOUNTS_APPLY);
 
-    verify(TestId.LABEL_TOTALTOPAY, "104.97");
+    verify(TestId.LABEL_TOTALTOPAY, "104.98");
     verify(TestId.LABEL_RECEIPT_ROW1_TITLE, "Baby carrier");
     verify(TestId.LABEL_RECEIPT_ROW1_QTY, "1");
     verify(TestId.LABEL_RECEIPT_ROW1_AMOUNT, "110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_TOTAL, "110.50");
     verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTNAME, "-- disc_5_ var_perc");
-    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "-5.53");
-    verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "104.97");
+    verify(TestId.LABEL_RECEIPT_ROW1_DISCOUNTAMOUNT, "-5.52");
+    verify(TestId.LABEL_RECEIPT_TOTAL_GROSS, "104.98");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TITLE, "Entregas IVA 21%");
-    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "86.75");
+    verify(TestId.LABEL_RECEIPT_TAX_ROW1_NET, "86.76");
     verify(TestId.LABEL_RECEIPT_TAX_ROW1_TOTALTAX, "18.22");
 
     // finish the receipt