src-db/database/model/triggers/C_INVOICELINE_TRG4.xml
changeset 6475 35dc05a84c8b
parent 6474 4e03817a571b
child 6701 690d2af86089
--- a/src-db/database/model/triggers/C_INVOICELINE_TRG4.xml	Tue Feb 23 15:21:06 2010 +0100
+++ b/src-db/database/model/triggers/C_INVOICELINE_TRG4.xml	Tue Feb 23 17:50:44 2010 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
   <database name="TRIGGER C_INVOICELINE_TRG4">
-    <trigger name="C_INVOICELINE_TRG4" table="C_INVOICELINE" fires="before" insert="true" update="true" delete="true" foreach="row">
+    <trigger name="C_INVOICELINE_TRG4" table="C_INVOICELINE" fires="before" insert="true" update="true" delete="false" foreach="row">
       <body><![CDATA[
   /*************************************************************************
   * The contents of this file are subject to the Openbravo  Public  License
@@ -18,25 +18,22 @@
   * All Rights Reserved.
   * Contributor(s):  ______________________________________.
   ************************************************************************/
-  V_RATE NUMBER;
   V_PRECISION NUMBER;
 BEGIN
 
   IF AD_isTriggerEnabled()='N' THEN RETURN;
   END IF;
 
-  SELECT T.RATE INTO V_RATE FROM C_TAX T 
-  WHERE T.C_TAX_ID=:NEW.C_TAX_ID;
-
-  SELECT C.STDPRECISION INTO V_PRECISION FROM C_INVOICE I, C_CURRENCY C 
-  WHERE I.C_CURRENCY_ID=C.C_CURRENCY_ID 
-  AND I.C_INVOICE_ID=:NEW.C_INVOICE_ID;
-
   IF(INSERTING OR UPDATING) THEN
+    SELECT C.STDPRECISION INTO V_PRECISION FROM C_INVOICE I, C_CURRENCY C 
+    WHERE I.C_CURRENCY_ID=C.C_CURRENCY_ID 
+    AND I.C_INVOICE_ID=:NEW.C_INVOICE_ID;
+ 
     IF (ROUND(TO_NUMBER(:NEW.QTYINVOICED) * TO_NUMBER(:NEW.PRICEACTUAL),V_PRECISION)!=TO_NUMBER(:NEW.LINENETAMT)) THEN
       RAISE_APPLICATION_ERROR(-20501,'Line Amount Is Not Correct');
     END IF;
   END IF;
-  END C_INVOICELINE_TRG4]]></body>
+  END C_INVOICELINE_TRG4
+]]></body>
     </trigger>
   </database>