details:   https://code.openbravo.com/erp/devel/pi/rev/65fa9fad25cc
changeset: 16582:65fa9fad25cc
user:      Naiara Martinez <naiara.martinez <at> openbravo.com>
date:      Fri May 18 13:59:45 2012 +0200
summary:   fixed bug 13039 get standard and price precision from data in lines. 
If data
is null it gets from header.

details:   https://code.openbravo.com/erp/devel/pi/rev/f531a3011f71
changeset: 16583:f531a3011f71
user:      Mikel Irurita <mikel.irurita <at> openbravo.com>
date:      Fri May 18 19:43:48 2012 +0200
summary:   Related to issue 13039: remove not needed if condition.
getStringParameter(String parameter) calls to getStringParameter(parameter, "", 
null)
where default value in case of null is an empty string "" (second parameter).

diffstat:

 src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java      |  20 
+++++++---
 src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt_data.xsql |  12 
+++++-
 2 files changed, 25 insertions(+), 7 deletions(-)

diffs (86 lines):

diff -r 6070d169b34a -r f531a3011f71 
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java       
Fri May 18 17:58:18 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java       
Fri May 18 19:43:48 2012 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -52,8 +52,10 @@
       String strPriceActual = vars.getNumericParameter("inppriceactual");
       String strPriceList = vars.getNumericParameter("inppricelist");
       String strDiscount = vars.getNumericParameter("inpdiscount");
+      String strMPricelistId = vars.getStringParameter("inpmPricelistId");
       try {
-        printPage(response, vars, strQty, strPriceActual, strDiscount, 
strPriceList, strChanged);
+        printPage(response, vars, strQty, strPriceActual, strDiscount, 
strPriceList, strChanged,
+            strMPricelistId);
       } catch (ServletException ex) {
         pageErrorCallOut(response);
       }
@@ -63,8 +65,8 @@
   }
 
   private void printPage(HttpServletResponse response, VariablesSecureApp 
vars, String strQty,
-      String strPriceActual, String strDiscount, String strPriceList, String 
strChanged)
-      throws IOException, ServletException {
+      String strPriceActual, String strDiscount, String strPriceList, String 
strChanged,
+      String strMPricelistId) throws IOException, ServletException {
 
     if (log4j.isDebugEnabled())
       log4j.debug("Output: dataSheet");
@@ -81,8 +83,12 @@
       BigDecimal qty, LineNetAmt, priceActual, discount, priceList;
 
       String strRequisition = vars.getStringParameter("inpmRequisitionId");
-      SLRequisitionLineAmtData[] data = SLRequisitionLineAmtData.select(this, 
strRequisition);
-
+      SLRequisitionLineAmtData[] data = null;
+      if ("".equals(strMPricelistId)) {
+        data = SLRequisitionLineAmtData.select(this, strRequisition);
+      } else {
+        data = SLRequisitionLineAmtData.selectPriceListLine(this, 
strMPricelistId);
+      }
       Integer stdPrecision = null;
       Integer pricePrecision = null;
 
@@ -118,6 +124,8 @@
         if (!strDiscount.equals(discount.toString())) {
           resultado.append("new Array(\"inpdiscount\", " + discount.toString() 
+ "),");
         }
+        resultado.append("new Array(\"inppriceactual\", " + 
priceActual.toString() + "),");
+
       } else if (strChanged.equals("inpdiscount")) { // calculate std and
         // actual
         BigDecimal discount1 = null;
diff -r 6070d169b34a -r f531a3011f71 
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt_data.xsql
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt_data.xsql  
Fri May 18 17:58:18 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt_data.xsql  
Fri May 18 19:43:48 2012 +0200
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -33,4 +33,14 @@
     </Sql>
     <Parameter name="mRequisitionId"/>
   </SqlMethod>
+  <SqlMethod name="selectPriceListLine" type="preparedStatement" 
return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      SELECT C_Currency.StdPrecision, C_Currency.PricePrecision
+      FROM M_PriceList, C_Currency 
+      WHERE M_PriceList.C_Currency_ID = C_Currency.C_Currency_ID
+      AND M_PriceList.M_Pricelist_ID = ?
+    </Sql>
+    <Parameter name="mPriceListId"/>
+  </SqlMethod>
 </SqlClass>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to