src-db/database/model/functions/M_INTERNAL_CONSUMPTION_POST1.xml
changeset 24913 e10ca5e6571f
parent 20976 3f5e8c7117d6
child 29706 a8a6d8bd52e5
--- a/src-db/database/model/functions/M_INTERNAL_CONSUMPTION_POST1.xml	Fri Sep 19 09:21:59 2014 +0200
+++ b/src-db/database/model/functions/M_INTERNAL_CONSUMPTION_POST1.xml	Fri Sep 19 11:53:32 2014 +0200
@@ -230,6 +230,13 @@
           updatedby = v_user
       WHERE m_internal_consumption_id = v_voidintconsumption_id;
 
+      -- transactions related with original inout and with voided inout will be mark as is cost permanent
+      UPDATE M_TRANSACTION TRX
+      SET ISCOSTPERMANENT='Y'
+      WHERE TRX.M_INTERNAL_CONSUMPTIONLINE_ID IN (SELECT M_INTERNAL_CONSUMPTIONLINE_ID 
+                                   FROM M_INTERNAL_CONSUMPTIONLINE
+                                   WHERE (M_INTERNAL_CONSUMPTION_ID = record_id
+                                          OR M_INTERNAL_CONSUMPTION_ID =  v_voidintconsumption_id));
     END;
   END IF;
    v_ResultStr := 'UnLockingMovement';