details: http://code.openbravo.com/erp/devel/pi/rev/1148e52fe95e changeset: 4619:1148e52fe95e user: Gorka Mauleon <gorka.mauleon <at> openbravo.com> date: Tue Aug 18 09:13:49 2009 +0200 summary: Fixes issue 0010310: Cancel Price Adjusment does not work after changing the quantity
diffstat: src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java | 30 ++++++++++---- 1 files changed, 21 insertions(+), 9 deletions(-) diffs (54 lines): diff -r 28920110c01a -r 1148e52fe95e src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java --- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Tue Aug 18 08:52:42 2009 +0200 +++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Tue Aug 18 09:13:49 2009 +0200 @@ -158,6 +158,7 @@ dataOrder[0].cBpartnerId, strProduct, (strPriceStd.equals("undefined") ? "0" : strPriceStd.replace("\"", "")), strQty, dataOrder[0].mPricelistId, dataOrder[0].id); + priceActual = new BigDecimal(strPriceActual); resultado.append("new Array(\"inppriceactual\", \"" + strPriceActual + "\"),"); } } @@ -192,14 +193,19 @@ log4j.debug("Discount rounded: " + discount.toString()); resultado.append("new Array(\"inpdiscount\", \"" + discount.toString() + "\"),"); } else if (strChanged.equals("inpqtyordered")) { // calculate Actual - priceActual = new BigDecimal(SLOrderProductData.getOffersPrice(this, - dataOrder[0].dateordered, dataOrder[0].cBpartnerId, strProduct, priceStd.toString(), - strQty, dataOrder[0].mPricelistId, dataOrder[0].id)); - if (priceActual.scale() > PricePrecision) - priceActual = priceActual.setScale(PricePrecision, BigDecimal.ROUND_HALF_UP); - resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); - } else if (strChanged.equals("inpdiscount")) { // calculate std and - // actual + if ("Y".equals(cancelPriceAd)) { + priceActual = priceStd; + resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); + } else { + priceActual = new BigDecimal(SLOrderProductData.getOffersPrice(this, + dataOrder[0].dateordered, dataOrder[0].cBpartnerId, strProduct, priceStd.toString(), + strQty, dataOrder[0].mPricelistId, dataOrder[0].id)); + if (priceActual.scale() > PricePrecision) + priceActual = priceActual.setScale(PricePrecision, BigDecimal.ROUND_HALF_UP); + resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); + } + + } else if (strChanged.equals("inpdiscount")) { // calculate std and actual BigDecimal discount1 = null; if (priceList.compareTo(BigDecimal.ZERO) != 0) discount1 = (((priceList.subtract(priceStd)).divide(priceList, 12, @@ -265,7 +271,13 @@ } // Multiply - BigDecimal lineNetAmt = qtyOrdered.multiply(priceActual); + BigDecimal lineNetAmt; + if ("Y".equals(cancelPriceAd)) { + lineNetAmt = qtyOrdered.multiply(priceStd); + } else { + lineNetAmt = qtyOrdered.multiply(priceActual); + } + if (lineNetAmt.scale() > StdPrecision) lineNetAmt = lineNetAmt.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP); resultado.append("new Array(\"inplinenetamt\", \"" + lineNetAmt.toString() + "\")"); ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits