CREATE OR REPLACE TRIGGER USR_ALTERACAO_NF_ENTRADA
AFTER UPDATE OR INSERT ON ITEMPRODUTO FOR EACH ROW
BEGIN
   IF UPDATING THEN
      IF (:NEW.QTITEMPROD <> :OLD.QTITEMPROD) OR
         (:NEW.VRUNITITEM <> :OLD.VRUNITITEM) OR
         (:NEW.VRTOTAITEM <> :OLD.VRTOTAITEM) OR
         (:NEW.VRDESCITEM <> :OLD.VRDESCITEM) THEN
         UPDATE NOTAFISCAL
            SET USR_DTEXPORTACAO = NULL
          WHERE CDFILIAL = :NEW.CDFILIAL
            AND NRLANCTONF = :NEW.NRLANCTONF;
      END IF;
   ELSE
      UPDATE NOTAFISCAL
         SET USR_DTEXPORTACAO = NULL
       WHERE CDFILIAL = :NEW.CDFILIAL
         AND NRLANCTONF = :NEW.NRLANCTONF;
   END IF;
END;
/

-- VERSAO --
BEGIN ATUVEROBJ('USR_ALTERACAO_NF_ENTRADA','5.70.XXX'); END;
/
