details: /erp/devel/pi/rev/145fea0f4502
changeset: 12517:145fea0f4502
user: Adrián Romero <adrianromero <at> openbravo.com>
date: Fri May 27 14:20:14 2011 +0200
summary: Fixes issue 0017207: It is not possible save a Project Line with
Planned Price = 0
It has been modified the related triggers in order to verify that if planned
price is zero, calculate properly related values
diffstat:
src-db/database/model/triggers/C_PROJECTLINE_TRG.xml | 3 +++
src-db/database/model/triggers/C_PROJECTLINE_TRG3.xml | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 35fdc9f29810 -r 145fea0f4502
src-db/database/model/triggers/C_PROJECTLINE_TRG.xml
--- a/src-db/database/model/triggers/C_PROJECTLINE_TRG.xml Fri May 27
12:17:50 2011 +0100
+++ b/src-db/database/model/triggers/C_PROJECTLINE_TRG.xml Fri May 27
14:20:14 2011 +0200
@@ -69,6 +69,9 @@
IF(v_PlannedMargin <> 0) THEN
:new.PlannedMarginAmt:=:new.PlannedAmt * v_PlannedMargin;
END IF;
+ ELSIF (:new.PlannedPrice = 0) THEN
+ :new.PlannedPOPrice := 0;
+ :new.PlannedMarginAmt := 0;
END IF;
END C_PROJECTLINE_TRG
]]></body>
diff -r 35fdc9f29810 -r 145fea0f4502
src-db/database/model/triggers/C_PROJECTLINE_TRG3.xml
--- a/src-db/database/model/triggers/C_PROJECTLINE_TRG3.xml Fri May 27
12:17:50 2011 +0100
+++ b/src-db/database/model/triggers/C_PROJECTLINE_TRG3.xml Fri May 27
14:20:14 2011 +0200
@@ -56,7 +56,11 @@
IF(UPDATING OR DELETING) THEN
v_oldLine_PlannedQty:= COALESCE(:old.PlannedQty,0);
v_oldLine_PlannedAmt:=COALESCE(:old.PlannedAmt,0);
-
v_oldLine_PlannedMarginAmt:=COALESCE((COALESCE(:old.PLANNEDPRICE,0)-COALESCE(:old.PLANNEDPOPRICE,0))*100/COALESCE(:old.PLANNEDPRICE,1),0);
+ IF (:old.PLANNEDPRICE = 0) THEN
+ v_oldLine_PlannedMarginAmt := 0;
+ ELSE
+
v_oldLine_PlannedMarginAmt:=COALESCE((COALESCE(:old.PLANNEDPRICE,0)-COALESCE(:old.PLANNEDPOPRICE,0))*100/COALESCE(:old.PLANNEDPRICE,1),0);
+ END IF;
v_oldLine_CommittedAmt :=COALESCE(:old.CommittedAmt,0);
v_oldLine_CommittedQty :=COALESCE(:old.CommittedQty,0);
v_oldLine_InvoicedAmt :=COALESCE(:old.InvoicedAmt,0);
@@ -66,7 +70,11 @@
IF (INSERTING OR UPDATING) THEN
v_newLine_PlannedQty := COALESCE(:new.PlannedQty,0);
v_newLine_PlannedAmt:=COALESCE(:new.PlannedAmt,0);
-
v_newLine_PlannedMarginAmt:=COALESCE((COALESCE(:new.PLANNEDPRICE,0)-COALESCE(:new.PLANNEDPOPRICE,0))*100/COALESCE(:new.PLANNEDPRICE,1),0);
+ IF (:new.PLANNEDPRICE = 0) THEN
+ v_newLine_PlannedMarginAmt := 0;
+ ELSE
+
v_newLine_PlannedMarginAmt:=COALESCE((COALESCE(:new.PLANNEDPRICE,0)-COALESCE(:new.PLANNEDPOPRICE,0))*100/COALESCE(:new.PLANNEDPRICE,1),0);
+ END IF;
v_newLine_CommittedAmt :=COALESCE(:new.CommittedAmt,0);
v_newLine_CommittedQty :=COALESCE(:new.CommittedQty,0);
v_newLine_InvoicedAmt :=COALESCE(:new.InvoicedAmt,0);
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits