SET TERM ^ ;

CREATE OR ALTER trigger ttbpdv_conferencia_item_b0u4 for tbpdv_conferencia_item
active before update position 0
AS
BEGIN
    IF(OLD.SITUACAO <> NEW.SITUACAO) THEN
    BEGIN
        IF(NEW.SITUACAO = 4) THEN
        BEGIN
            UPDATE TBPDV_CONFERENCIA_ITEM_SALDO
            SET PDV_CONFERENCIA_ITEM_ID = NEW.ID,
                QUANTIDADE = 0
            WHERE (PDV_CONFERENCIA_ITEM_ID = NEW.ID);    
        END
    END
END
^

SET TERM ; ^

