details: /erp/devel/main/rev/5448a6a56c01 changeset: 6749:5448a6a56c01 user: Adrián Romero <adrianromero <at> openbravo.com> date: Tue Mar 30 11:01:49 2010 +0200 summary: Reverting changes in issue 0012788: Precision error in simple sales order sales invoice
details: /erp/devel/main/rev/f66cde17a9f0 changeset: 6750:f66cde17a9f0 user: Harikrishnan Raja <harikrishnan.raja <at> openbravo.com> date: Tue Mar 30 18:18:10 2010 +0530 summary: Fixes Issue 12845: User Not able to create purchase order using Copy lines option. diffstat: src-db/database/model/triggers/C_ORDERLINE_TRG.xml | 3 + src-db/database/model/triggers/C_ORDERLINE_TRG3.xml | 38 ----------- src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java | 18 ++-- src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java | 16 ++-- 4 files changed, 20 insertions(+), 55 deletions(-) diffs (153 lines): diff -r ee181c6ac1ba -r f66cde17a9f0 src-db/database/model/triggers/C_ORDERLINE_TRG.xml --- a/src-db/database/model/triggers/C_ORDERLINE_TRG.xml Fri Mar 26 19:52:05 2010 +0100 +++ b/src-db/database/model/triggers/C_ORDERLINE_TRG.xml Tue Mar 30 18:18:10 2010 +0530 @@ -122,6 +122,9 @@ :new.LineNetAmt := ROUND(:new.QtyOrdered*:new.PriceActual, v_Prec);-- Modified by I.Ciordia :new.FreightAmt := ROUND(:new.FreightAmt, v_Prec); :new.ChargeAmt := ROUND(:new.ChargeAmt, v_Prec); + IF (round(to_number(:NEW.QTYORDERED) * to_number(:NEW.PRICEACTUAL),v_Prec) != to_number(:NEW.LINENETAMT)) THEN + RAISE_APPLICATION_ERROR(-20000, '@LineAmountNotCorrect@') ; + END IF; END IF; diff -r ee181c6ac1ba -r f66cde17a9f0 src-db/database/model/triggers/C_ORDERLINE_TRG3.xml --- a/src-db/database/model/triggers/C_ORDERLINE_TRG3.xml Fri Mar 26 19:52:05 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -<?xml version="1.0"?> - <database name="TRIGGER C_ORDERLINE_TRG3"> - <trigger name="C_ORDERLINE_TRG3" table="C_ORDERLINE" fires="before" insert="true" update="true" delete="false" foreach="row"> - <body><![CDATA[ - -/************************************************************************* -* The contents of this file are subject to the Openbravo Public License -* Version 1.0 (the "License"), being the Mozilla Public License -* Version 1.1 with a permitted attribution clause; you may not use this -* file except in compliance with the License. You may obtain a copy of -* the License at http://www.openbravo.com/legal/license.html -* Software distributed under the License is distributed on an "AS IS" -* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -* License for the specific language governing rights and limitations -* under the License. -* The Original Code is Openbravo ERP. -* The Initial Developer of the Original Code is Openbravo SLU -* All portions are Copyright (C) 2010 Openbravo SLU -* All Rights Reserved. -* Contributor(s): ______________________________________. -************************************************************************/ - V_PRECISION NUMBER; -BEGIN - IF AD_isTriggerEnabled()='N' THEN RETURN; - END IF; - - IF(INSERTING OR UPDATING) THEN - SELECT C.STDPRECISION INTO V_PRECISION FROM C_CURRENCY C - WHERE C.C_CURRENCY_ID=:NEW.C_CURRENCY_ID; - - IF (round(to_number(:NEW.QTYORDERED) * to_number(:NEW.PRICEACTUAL),V_PRECISION) != to_number(:NEW.LINENETAMT)) THEN - RAISE_APPLICATION_ERROR(-20000, '@LineAmountNotCorrect@') ; - END IF; - END IF; - END C_ORDERLINE_TRG3 -]]></body> - </trigger> - </database> diff -r ee181c6ac1ba -r f66cde17a9f0 src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java --- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Fri Mar 26 19:52:05 2010 +0100 +++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Tue Mar 30 18:18:10 2010 +0530 @@ -147,27 +147,27 @@ log4j.debug("priceActual:" + Double.toString(priceActual.doubleValue())); if ("Y".equals(cancelPriceAd)) { priceStd = priceActual; - resultado.append("new Array(\"inppricestd\", \"" + priceStd.toString() + "\"),"); + resultado.append("new Array(\"inppricestd\", " + priceStd.toString() + "),"); } else { priceStd = new BigDecimal(SLOrderProductData.getOffersStdPrice(this, dataOrder[0].cBpartnerId, priceActual.toString().replace("\"", ""), strProduct, dataOrder[0].dateordered, strQty, dataOrder[0].mPricelistId, dataOrder[0].id)); // priceList - resultado.append("new Array(\"inppricestd\", \"" + priceStd.toString() + "\"),"); + resultado.append("new Array(\"inppricestd\", " + priceStd.toString() + "),"); } } if (strChanged.equals("inpcancelpricead")) { if ("Y".equals(cancelPriceAd)) { - resultado.append("new Array(\"inppriceactual\", \"" + strPriceStd + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + strPriceStd + "),"); } else { strPriceActual = SLOrderProductData.getOffersPrice(this, dataOrder[0].dateordered, 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 + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + strPriceActual + "),"); } } @@ -204,14 +204,14 @@ } else if (strChanged.equals("inpqtyordered")) { // calculate Actual if ("Y".equals(cancelPriceAd)) { priceActual = priceStd; - resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); + 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() + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + priceActual.toString() + "),"); } } else if (strChanged.equals("inpdiscount")) { // calculate std and actual @@ -235,8 +235,8 @@ priceStd = priceStd.setScale(PricePrecision, BigDecimal.ROUND_HALF_UP); if (priceActual.scale() > PricePrecision) priceActual = priceActual.setScale(PricePrecision, BigDecimal.ROUND_HALF_UP); - resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); - resultado.append("new Array(\"inppricestd\", \"" + priceStd.toString() + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + priceActual.toString() + "),"); + resultado.append("new Array(\"inppricestd\", " + priceStd.toString() + "),"); } } @@ -291,7 +291,7 @@ } } if (strChanged.equals("inplinenetamt")) - resultado.append("new Array(\"inppriceactual\", \"" + priceActual.toString() + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + priceActual.toString() + "),"); if (!strChanged.equals("inplinenetamt") || priceActual.compareTo(BigDecimal.ZERO) == 0) resultado.append("new Array(\"inplinenetamt\", " + LineNetAmt.toString() + "),"); resultado.append("new Array(\"inptaxbaseamt\", " + LineNetAmt.toString() + ")"); diff -r ee181c6ac1ba -r f66cde17a9f0 src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java --- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java Fri Mar 26 19:52:05 2010 +0100 +++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java Tue Mar 30 18:18:10 2010 +0530 @@ -137,14 +137,14 @@ resultado.append("var calloutName='SL_Order_Product';\n\n"); resultado.append("var respuesta = new Array("); resultado.append("new Array(\"inpcUomId\", \"" + strUOM + "\"),"); - resultado.append("new Array(\"inppricelist\", \"" - + (strPriceList.equals("") ? "0" : strPriceList) + "\"),"); - resultado.append("new Array(\"inppricelimit\", \"" - + (strPriceLimit.equals("") ? "0" : strPriceLimit) + "\"),"); - resultado.append("new Array(\"inppricestd\", \"" - + (strPriceStd.equals("") ? "0" : strPriceStd) + "\"),"); - resultado.append("new Array(\"inppriceactual\", \"" - + (strPriceActual.equals("") ? "0" : strPriceActual) + "\"),"); + resultado.append("new Array(\"inppricelist\", " + + (strPriceList.equals("") ? "0" : strPriceList) + "),"); + resultado.append("new Array(\"inppricelimit\", " + + (strPriceLimit.equals("") ? "0" : strPriceLimit) + "),"); + resultado.append("new Array(\"inppricestd\", " + + (strPriceStd.equals("") ? "0" : strPriceStd) + "),"); + resultado.append("new Array(\"inppriceactual\", " + + (strPriceActual.equals("") ? "0" : strPriceActual) + "),"); resultado.append("new Array(\"inpcCurrencyId\", " + (strCurrency.equals("") ? "\"\"" : strCurrency) + "),"); resultado.append("new Array(\"inpdiscount\", " + discount.toString() + "),"); ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
