details:   /erp/devel/pi/rev/1250e8f1c3d9
changeset: 8545:1250e8f1c3d9
user:      Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
date:      Fri Oct 15 14:00:55 2010 +0530
summary:   Fixes issue 13697: Discount is still applied to sales invoice even 
it it was made as inactive

In C_INVOICE_TRG2 Trigger, one more AND clause has been added that will check 
whether discount is active or not before inserting it into C_INVOICE_DISCOUNT 
table.

diffstat:

 src-db/database/model/triggers/C_INVOICE_TRG2.xml |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (32 lines):

diff -r 16290ade5194 -r 1250e8f1c3d9 
src-db/database/model/triggers/C_INVOICE_TRG2.xml
--- a/src-db/database/model/triggers/C_INVOICE_TRG2.xml Fri Oct 15 11:59:42 
2010 +0530
+++ b/src-db/database/model/triggers/C_INVOICE_TRG2.xml Fri Oct 15 14:00:55 
2010 +0530
@@ -34,16 +34,18 @@
 
   FOR Cur_Discounts IN
     (
-    SELECT C_DISCOUNT_ID,
-      LINE,
-      CASCADE
-    FROM C_BPARTNER_DISCOUNT
-    WHERE C_BPARTNER_ID=:NEW.C_BPARTNER_ID
-      AND ISACTIVE='Y'
-      AND(ISCUSTOMER=:NEW.ISSOTRX
-      OR ISVENDOR <> :NEW.ISSOTRX)
-      AND APPLYINORDER='N'
-    ORDER BY LINE
+    SELECT BPD.C_DISCOUNT_ID,
+      BPD.LINE,
+      BPD.CASCADE
+    FROM C_BPARTNER_DISCOUNT BPD, C_DISCOUNT D
+    WHERE BPD.C_BPARTNER_ID=:NEW.C_BPARTNER_ID
+      AND D.C_DISCOUNT_ID = BPD.C_DISCOUNT_ID
+      AND BPD.ISACTIVE='Y'
+      AND D.ISACTIVE='Y'
+      AND(BPD.ISCUSTOMER=:NEW.ISSOTRX
+      OR BPD.ISVENDOR <> :NEW.ISSOTRX)
+      AND BPD.APPLYINORDER='N'
+    ORDER BY BPD.LINE
     )
   LOOP
     Ad_Sequence_Next('C_Invoice_Discount', :NEW.AD_Client_ID, v_Key) ;

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to