CREATE trigger ttbpagamento_forma_biud_01 for tbpagamento_forma
active before insert or update or delete position 0
AS
begin
    IF(INSERTING)THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_FORMA',NEW.CODIGO,'I');
    IF(UPDATING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_FORMA',NEW.CODIGO,'A');
    IF(DELETING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_FORMA',OLD.CODIGO,'D');
end;

update TBPAGAMENTO_FORMA f set f.salesforce = f.salesforce;

CREATE trigger ttbpagamento_condicao_biud_01 for tbpagamento_condicao
active before insert or update or delete position 0
AS
begin
    IF(INSERTING)THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_CONDICAO',NEW.CODIGO,'I');
    IF(UPDATING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_CONDICAO',NEW.CODIGO,'A');
    IF(DELETING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBPAGAMENTO_CONDICAO',OLD.CODIGO,'D');
end;

update tbpagamento_condicao f set f.salesforce = f.salesforce;

ALTER TABLE TBPAGAMENTO_CONDICAO
    ADD HABILITA_API INTEGER DEFAULT 0,
    ADD QTD_PARCELAS INTEGER DEFAULT 0;

CREATE trigger ttbtransportadora_biud_01 for tbtransportadora
active before insert or update or delete position 0
AS
begin
    IF(INSERTING)THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBTRANSPORTADORA',NEW.CODIGO,'I');
    IF(UPDATING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBTRANSPORTADORA',NEW.CODIGO,'A');
    IF(DELETING )THEN EXECUTE PROCEDURE SPI_INTEGRACAO_API('TBTRANSPORTADORA',OLD.CODIGO,'D');
end;

ALTER TABLE TBPAGAMENTO_FORMA
    ADD HABILITA_API INTEGER DEFAULT 0;

