details:   /erp/devel/pi/rev/825d188f527d
changeset: 6516:825d188f527d
user:      Harikrishnan Raja <harikrishnan.raja <at> openbravo.com>
date:      Fri Feb 26 18:03:54 2010 +0530
summary:   Fixes Issue 12386: Price Precision error.

diffstat:

 src-db/database/model/functions/C_GET_CURRENCY_PRECISION.xml |  52 ++++++++++++
 src-db/database/model/functions/M_BOM_PRICELIMIT.xml         |   2 +-
 src-db/database/model/functions/M_BOM_PRICELIST.xml          |   2 +-
 src-db/database/model/functions/M_BOM_PRICESTD.xml           |   2 +-
 4 files changed, 55 insertions(+), 3 deletions(-)

diffs (92 lines):

diff -r 8ee96fa90576 -r 825d188f527d 
src-db/database/model/functions/C_GET_CURRENCY_PRECISION.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/C_GET_CURRENCY_PRECISION.xml      Fri Feb 
26 18:03:54 2010 +0530
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION C_GET_CURRENCY_PRECISION">
+    <function name="C_GET_CURRENCY_PRECISION" type="NUMERIC">
+      <parameter name="p_curto_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_prec_type" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      
<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 SL
+ * All portions are Copyright (C) 2010 Openbravo SL
+ * All Rights Reserved.
+*************************************************************************
+****
+* Title: Returns the currency Precision values
+* Description:
+*  "A" for Amount(StdPrecision),"P" for PricePrecision and "C" for 
CostingPrecision
+*  Returns precision values.
+************************************************************************/
+  v_StdPrecision  NUMBER;
+  v_PricePrecision NUMBER;
+  v_CostPrecision NUMBER;
+BEGIN
+  SELECT MAX(StdPrecision),
+    MAX(CostingPrecision),
+    MAX(PricePrecision)
+  INTO v_StdPrecision,
+    v_CostPrecision,v_PricePrecision
+  FROM C_Currency
+  WHERE C_Currency_ID = p_CurTo_ID;
+   IF(p_prec_type = 'P') THEN
+    RETURN v_PricePrecision;
+   ELSEIF(p_prec_type = 'C') THEN
+    RETURN v_CostPrecision;
+   ELSEIF(p_prec_type = 'A') THEN
+    RETURN v_StdPrecision;
+  END IF;
+END C_GET_CURRENCY_PRECISION
+]]></body>
+    </function>
+  </database>
diff -r 8ee96fa90576 -r 825d188f527d 
src-db/database/model/functions/M_BOM_PRICELIMIT.xml
--- a/src-db/database/model/functions/M_BOM_PRICELIMIT.xml      Fri Feb 26 
13:04:35 2010 +0100
+++ b/src-db/database/model/functions/M_BOM_PRICELIMIT.xml      Fri Feb 26 
18:03:54 2010 +0530
@@ -59,7 +59,7 @@
       END LOOP;
     END IF;
     --
-    RETURN c_currency_round(v_price, v_currency,null);
+    RETURN ROUND(v_price,C_GET_CURRENCY_PRECISION(v_currency,'P'));
 END M_BOM_PRICELIMIT
 ]]></body>
     </function>
diff -r 8ee96fa90576 -r 825d188f527d 
src-db/database/model/functions/M_BOM_PRICELIST.xml
--- a/src-db/database/model/functions/M_BOM_PRICELIST.xml       Fri Feb 26 
13:04:35 2010 +0100
+++ b/src-db/database/model/functions/M_BOM_PRICELIST.xml       Fri Feb 26 
18:03:54 2010 +0530
@@ -60,7 +60,7 @@
       END LOOP; -- BOM
     END IF;
     --
-    RETURN c_currency_round(v_price, v_currency,null);
+    RETURN ROUND(v_price,C_GET_CURRENCY_PRECISION(v_currency,'P'));
 END M_BOM_PRICELIST
 ]]></body>
     </function>
diff -r 8ee96fa90576 -r 825d188f527d 
src-db/database/model/functions/M_BOM_PRICESTD.xml
--- a/src-db/database/model/functions/M_BOM_PRICESTD.xml        Fri Feb 26 
13:04:35 2010 +0100
+++ b/src-db/database/model/functions/M_BOM_PRICESTD.xml        Fri Feb 26 
18:03:54 2010 +0530
@@ -60,7 +60,7 @@
       END LOOP; -- BOM
     END IF;
     --
-    RETURN c_currency_round(v_price, v_currency,null);
+    RETURN ROUND(v_price,C_GET_CURRENCY_PRECISION(v_currency,'P'));
 END M_BOM_PRICESTD
 ]]></body>
     </function>

------------------------------------------------------------------------------
Download Intel&#174; 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

Reply via email to