details:   https://code.openbravo.com/erp/devel/pi/rev/e97cfb32893f
changeset: 18508:e97cfb32893f
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Nov 08 17:24:00 2012 +0100
summary:   fixed bug 22239: PIT: Changing discount updated gross prices but not 
net ones

diffstat:

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

diffs (30 lines):

diff -r b7a3476440f0 -r e97cfb32893f 
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Mon Oct 22 
17:07:51 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Thu Nov 08 
17:24:00 2012 +0100
@@ -240,13 +240,22 @@
           isGrossUnitPriceChanged = true;
           resultado.append("new Array(\"inpgrosspricestd\", " + 
grossUnitPrice.toString() + "),");
           resultado.append("new Array(\"inpgrossUnitPrice\", " + 
grossUnitPrice.toString() + "),");
+
+          // set also net prices
+          BigDecimal grossAmount = 
grossUnitPrice.multiply(qtyOrdered).setScale(stdPrecision,
+              RoundingMode.HALF_UP);
+
+          final BigDecimal netUnitPrice = 
FinancialUtils.calculateNetFromGross(strTaxId,
+              grossAmount, pricePrecision, taxBaseAmt, qtyOrdered);
+
+          priceActual = netUnitPrice;
+          priceStd = netUnitPrice;
         } else {
-          // checks if rounded discount has changed
           priceStd = baseUnitPrice;
-
-          resultado.append("new Array(\"inppriceactual\", " + 
priceStd.toString() + "),");
-          resultado.append("new Array(\"inppricestd\", " + priceStd.toString() 
+ "),");
+          priceActual = baseUnitPrice;
         }
+        resultado.append("new Array(\"inppriceactual\", " + 
priceStd.toString() + "),");
+        resultado.append("new Array(\"inppricestd\", " + priceStd.toString() + 
"),");
       }
     }
 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to