details:   /erp/stable/2.50/rev/c1380d175fd9
changeset: 9372:c1380d175fd9
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Thu Apr 14 14:03:33 2011 +0200
summary:   Fixes issue 0015975: The callout calculates wrong the Net Unit Price 
when Discount % is 100
It has been modified the format of the price when invoking GetOffersPrice() to 
use an standard format and not a cientific format

diffstat:

 src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java |  23 ++++++++------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (58 lines):

diff -r 8b6b16a3f4d8 -r c1380d175fd9 
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Thu Apr 14 
13:04:01 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Thu Apr 14 
14:03:33 2011 +0200
@@ -156,14 +156,17 @@
             dataOrder[0].dateordered, dataOrder[0].cBpartnerId, strProduct, 
priceStd.toString(),
             strQty, dataOrder[0].mPricelistId, dataOrder[0].id));
         if (expectedPriceActual.scale() > PricePrecision)
-          expectedPriceActual = expectedPriceActual.setScale(PricePrecision, 
BigDecimal.ROUND_HALF_UP);
+          expectedPriceActual = expectedPriceActual.setScale(PricePrecision,
+              BigDecimal.ROUND_HALF_UP);
 
-        // To avoid rounding issues if the expected priceActual is equals to 
the current priceActual.
+        // To avoid rounding issues if the expected priceActual is equals to 
the current
+        // priceActual.
         // Do not do anything.
         if (!priceActual.equals(expectedPriceActual)) {
           priceStd = new BigDecimal(SLOrderProductData.getOffersStdPrice(this,
-              dataOrder[0].cBpartnerId, 
expectedPriceActual.toString().replace("\"", ""), strProduct,
-              dataOrder[0].dateordered, strQty, dataOrder[0].mPricelistId, 
dataOrder[0].id));
+              dataOrder[0].cBpartnerId, 
expectedPriceActual.toString().replace("\"", ""),
+              strProduct, dataOrder[0].dateordered, strQty, 
dataOrder[0].mPricelistId,
+              dataOrder[0].id));
         }
         // priceList
         resultado.append("new Array(\"inppricestd\", " + priceStd.toString() + 
"),");
@@ -242,8 +245,8 @@
         priceStd = priceList.subtract(priceList.multiply(discount).divide(new 
BigDecimal("100"),
             12, BigDecimal.ROUND_HALF_EVEN));
         priceActual = new BigDecimal(SLOrderProductData.getOffersPrice(this,
-            dataOrder[0].dateordered, dataOrder[0].cBpartnerId, strProduct, 
priceStd.toString(),
-            strQty, dataOrder[0].mPricelistId, dataOrder[0].id));
+            dataOrder[0].dateordered, dataOrder[0].cBpartnerId, strProduct,
+            priceStd.toPlainString(), strQty, dataOrder[0].mPricelistId, 
dataOrder[0].id));
         if (priceStd.scale() > PricePrecision)
           priceStd = priceStd.setScale(PricePrecision, 
BigDecimal.ROUND_HALF_UP);
         if (priceActual.scale() > PricePrecision)
@@ -262,8 +265,8 @@
             resultStock = stockNoAttribute.subtract(qtyOrdered);
             if (stockSecurity.compareTo(resultStock) > 0) {
               resultado.append("new Array('MESSAGE', \""
-                  + FormatUtilities.replaceJS(Utility.messageBD(this, 
"StockLimit", vars
-                      .getLanguage())) + "\"),");
+                  + FormatUtilities.replaceJS(Utility.messageBD(this, 
"StockLimit",
+                      vars.getLanguage())) + "\"),");
             }
           } else {
             if (!strAttribute.equals("") && strAttribute != null) {
@@ -273,8 +276,8 @@
               resultStock = stockAttribute.subtract(qtyOrdered);
               if (stockSecurity.compareTo(resultStock) > 0) {
                 resultado.append("new Array('MESSAGE', \""
-                    + FormatUtilities.replaceJS(Utility.messageBD(this, 
"StockLimit", vars
-                        .getLanguage())) + "\"),");
+                    + FormatUtilities.replaceJS(Utility.messageBD(this, 
"StockLimit",
+                        vars.getLanguage())) + "\"),");
               }
             }
           }

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to