src-db/database/model/triggers/C_ORDERLINE_TRG.xml
changeset 1605 8a0fe0193bef
parent 1240 d7790e722976
child 2078 cf88ca44cdd2
--- a/src-db/database/model/triggers/C_ORDERLINE_TRG.xml	Wed Sep 03 17:10:52 2008 +0000
+++ b/src-db/database/model/triggers/C_ORDERLINE_TRG.xml	Wed Sep 03 17:55:37 2008 +0000
@@ -32,19 +32,19 @@
   v_taxAmt NUMBER:= 0;
   v_HasTaxLine  BOOLEAN := FALSE;
   v_Prec   NUMBER;
-  v_ID   NUMBER;
+  v_ID   VARCHAR2(32);
   v_Processed  CHAR(1);
-  v_UOM_ID    NUMBER(10);
+  v_UOM_ID    VARCHAR2(32);
   v_IsSOTrx CHAR(1);
   v_Count NUMBER;
 BEGIN
 IF (UPDATING) THEN
-  IF NOT(COALESCE(:old.M_Product_ID,0) <> COALESCE(:NEW.M_Product_ID,0)
+  IF NOT(COALESCE(:old.M_Product_ID,'0') <> COALESCE(:NEW.M_Product_ID,'0')
   OR COALESCE(:old.LineNetAmt,0) <> COALESCE(:NEW.LineNetAmt,0)
   OR COALESCE(:old.FreightAmt,0) <> COALESCE(:NEW.FreightAmt,0)
   OR COALESCE(:old.ChargeAmt,0) <> COALESCE(:NEW.ChargeAmt,0)
-  OR COALESCE(:old.C_Tax_ID,0) <> COALESCE(:NEW.C_Tax_ID,0)
-  OR COALESCE(:old.C_Uom_ID,0) <> COALESCE(:NEW.C_Uom_ID,0))
+  OR COALESCE(:old.C_Tax_ID,'0') <> COALESCE(:NEW.C_Tax_ID,'0')
+  OR COALESCE(:old.C_Uom_ID,'0') <> COALESCE(:NEW.C_Uom_ID,'0'))
  THEN
   RETURN;
   END IF;
@@ -86,7 +86,7 @@
  IF (UPDATING OR INSERTING) THEN
      IF (:NEW.M_PRODUCT_ID IS NOT NULL) THEN
        SELECT C_UOM_ID INTO v_UOM_ID FROM M_PRODUCT WHERE M_PRODUCT_ID=:NEW.M_PRODUCT_ID;
-       IF (COALESCE(v_UOM_ID,0) <> COALESCE(:NEW.C_UOM_ID,0)) THEN
+       IF (COALESCE(v_UOM_ID,'0') <> COALESCE(:NEW.C_UOM_ID,'0')) THEN
          RAISE_APPLICATION_ERROR(-20111, 'Unit of Measure mismatch (product/transaction)');
        END IF;
      END IF;
@@ -141,7 +141,7 @@
      SET TaxAmt = (SELECT ROUND(C_OrderTax.TaxBaseAmt * t.Rate / 100, v_Prec)
        FROM C_Tax t WHERE C_OrderTax.C_Tax_ID=t.C_Tax_ID),
      Updated = now(),
-     UpdatedBy = 0
+     UpdatedBy = '0'
    WHERE C_Order_ID=:old.C_Order_ID
      AND C_Tax_ID=:old.C_Tax_ID;
   END IF;
@@ -160,10 +160,10 @@
    IF (v_newTaxBaseAmt IS NULL) THEN
    -- DBMS_OUTPUT.PUT_LINE('Insert NewLineAmt = ' || v_newLine);
     INSERT INTO C_OrderTax
-     (AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
+     (c_OrderTax_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
      C_Order_ID, C_Tax_ID, TaxBaseAmt, taxAmt)
     VALUES
-     (:new.AD_Client_ID, :new.AD_Org_ID, 'Y', now(), :new.UpdatedBy, now(), :new.UpdatedBy,
+     (get_uuid(), :new.AD_Client_ID, :new.AD_Org_ID, 'Y', now(), :new.UpdatedBy, now(), :new.UpdatedBy,
      :new.C_Order_ID, :new.C_Tax_ID, v_newLine, 0);
    ELSE
    -- DBMS_OUTPUT.PUT_LINE('Update NewLineAmt += ' || v_newLine);