ALTER TABLE TBPEDIDO
    ADD PEDIDO_INTEGRACAO_ID VARCHAR(50);

SET TERM ^ ;

CREATE trigger ttbestabelecimento_b987iud for tbestabelecimento
active before insert or update or delete position 987
AS
begin
    if(inserting)then execute procedure spi_integracao_mobile('TBESTABELECIMENTO',new.codigo,'I');
    if(updating )then execute procedure spi_integracao_mobile('TBESTABELECIMENTO',new.codigo,'A');
    if(deleting )then execute procedure spi_integracao_mobile('TBESTABELECIMENTO',old.codigo,'D');
end
^

SET TERM ; ^

update TBESTABELECIMENTO f set f.CIDADE = f.CIDADE;

SET TERM ^ ;

CREATE trigger ttbpagamento_forma_b987iud for tbpagamento_forma
active before insert or update or delete position 987
AS
begin
    if(inserting)then execute procedure spi_integracao_mobile('TBPAGAMENTO_FORMA',new.codigo,'I');
    if(updating )then execute procedure spi_integracao_mobile('TBPAGAMENTO_FORMA',new.codigo,'A');
    if(deleting )then execute procedure spi_integracao_mobile('TBPAGAMENTO_FORMA',old.codigo,'D');
end
^

SET TERM ; ^

update TBPAGAMENTO_FORMA f set f.status = f.status;

SET TERM ^ ;

CREATE trigger ttbpagamento_condicao_b987iud for tbpagamento_condicao
active before insert or update or delete position 987
AS
begin
    if(inserting)then execute procedure spi_integracao_mobile('TBPAGAMENTO_CONDICAO',new.codigo,'I');
    if(updating )then execute procedure spi_integracao_mobile('TBPAGAMENTO_CONDICAO',new.codigo,'A');
    if(deleting )then execute procedure spi_integracao_mobile('TBPAGAMENTO_CONDICAO',old.codigo,'D');
end
^

SET TERM ; ^

update TBPAGAMENTO_CONDICAO f set f.status = f.status;

SET TERM ^ ;

CREATE trigger ttblocalizacao_b987iud for tblocalizacao
active before insert or update or delete position 987
AS
begin
    if(inserting)then execute procedure spi_integracao_mobile('TBLOCALIZACAO',new.codigo,'I');
    if(updating )then execute procedure spi_integracao_mobile('TBLOCALIZACAO',new.codigo,'A');
    if(deleting )then execute procedure spi_integracao_mobile('TBLOCALIZACAO',old.codigo,'D');
end
^

SET TERM ; ^

update TBLOCALIZACAO f set f.status = f.status;

SET TERM ^ ;

CREATE trigger ttbcor_b987iud for tbcor
active before insert or update or delete position 987
AS
begin
    if(inserting)then execute procedure spi_integracao_mobile('TBCOR',new.codigo,'I');
    if(updating )then execute procedure spi_integracao_mobile('TBCOR',new.codigo,'A');
    if(deleting )then execute procedure spi_integracao_mobile('TBCOR',old.codigo,'D');
end
^

SET TERM ; ^

update TBCOR f set f.status = f.status;

