<?xml version="1.0" standalone="yes"?>
  <DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="TRI_KEY" fieldtype="string" WIDTH="128">
<PARAM Name="ORIGIN" Value="TRI_KEY" Roundtrip="True"/>
</FIELD>
<FIELD attrname="TAB" fieldtype="string" WIDTH="128">
<PARAM Name="ORIGIN" Value="TAB" Roundtrip="True"/>
</FIELD>
<FIELD attrname="TIP" fieldtype="string" WIDTH="263">
<PARAM Name="ORIGIN" Value="TIP" Roundtrip="True"/>
</FIELD>
<FIELD attrname="FONTE_OR" fieldtype="bin.hex" SUBTYPE="Text">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True"/>
<PARAM Name="ORIGIN" Value="FONTE_OR" Roundtrip="True"/>
</FIELD>
</FIELDS>
<PARAMS DEFAULT_ORDER="1"/>
</METADATA>
<ROWDATA>
<ROW TRI_KEY="CALCULOPROFBI" TAB="CALCULOPROF" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.SEQ is null) then &#010;    select GEN_SEQCALCULOPROF.NEXTVAL into :NEW.SEQ from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_SEQCALCULOPROF.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_SEQCALCULOPROF&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.SEQ &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_SEQCALCULOPROF.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="CAMPOVALORESISS_BI" TAB="CAMPOVALORESISS" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOVALOR is null) then &#010;    select GEN_CAMPOVALORESISS.NEXTVAL into :NEW.CODIGOVALOR from dual; /**/ &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CAMPOVALORESISS.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CAMPOVALORESISS&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOVALOR &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CAMPOVALORESISS.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="CESTBI" TAB="CEST" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i integer; &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOCEST is null) then &#010;    select GEN_CODIGOCEST.NEXTVAL into :NEW.CODIGOCEST from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOCEST.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOCEST&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOCEST &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOCEST.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="CLCREQUESTBI" TAB="CLCREQUEST" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/ &#010;begin &#010;  if (:NEW.ID is null) then &#010;    select GENCLCREQUEST.NEXTVAL into :NEW.ID from dual;/**/ &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GENCLCREQUEST.CURRVAL FROM dual&apos; INTO i;/**/ &#010;    EXCEPTION &#010;      WHEN OTHERS THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT GENCLCREQUEST.NEXTVAL FROM dual&apos; INTO i;/**/ &#010;    end;/**/ &#010;    while (:NEW.ID &gt; i) &#010;    loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GENCLCREQUEST.NEXTVAL FROM dual&apos; INTO i;/**/ &#010;    end loop;/**/ &#010;  end if;/**/ &#010;end;&#010;"/>
<ROW TRI_KEY="DEBITOFOLHABI" TAB="DEBITOFOLHA" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(18, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CHAVEDEBITOFOLHA is null) then &#010;    select GEN_CHAVEDEBITOFOLHA.NEXTVAL &#010;      into :NEW.CHAVEDEBITOFOLHA &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CHAVEDEBITOFOLHA.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CHAVEDEBITOFOLHA&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CHAVEDEBITOFOLHA &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CHAVEDEBITOFOLHA.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="DUPLICATASAIPGTOBD" TAB="DUPLICATASAIPGTO" TIP="BEFORE EACH ROW DELETE" FONTE_OR="begin&#010;  delete from LCTOFISSAIRETIDOPAGAMENTO&#010;  where CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;  and CODIGOESTAB = :old.CODIGOESTAB&#010;  and CHAVEDUPLICATASAI = :old.CHAVEDUPLICATASAI&#010;  and NUMEROPARCELA = :old.NUMEROPARCELA&#010;  and SEQDUPLICATA = :old.SEQ;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFCONTAPARTEBAI" TAB="ECFCONTAPARTEB" TIP="AFTER EACH ROW INSERT" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;  if (:new.INDVALORCONTA = &apos;C&apos;/*Credito=C;Debito=D*/) then&#010;&#010;    varValorCred := :new.VALORCONTA;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :new.VALORCONTA;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEA = VLRCREDPARTEA + varValorCred,&#010;&#010;         VLRDEBPARTEA  = VLRDEBPARTEA  + varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;&#010;&#010;  if  (sql%rowcount = 0) then&#010;&#010;    insert into ECFMOVCONTAPARTEB (CODIGOEMPRESA,&#010;&#010;                                   TIPOIMPOSTO,&#010;&#010;                                   CODIGOCONTAB,&#010;&#010;                                   DATASALDO,&#010;&#010;                                   VLRCREDPARTEA,&#010;&#010;                                   VLRDEBPARTEA,&#010;&#010;                                   VLRCREDPARTEB,&#010;&#010;                                   VLRDEBPARTEB)&#010;&#010;                           values (:new.CODIGOEMPRESA,&#010;&#010;                                   :new.TIPOIMPOSTO,&#010;&#010;                                   :new.CODIGOCONTAB,&#010;&#010;                                   :new.DATALCTOFIS,&#010;&#010;                                   varValorCred,&#010;&#010;                                   varValorDeb,&#010;&#010;                                   0,&#010;&#010;                                   0);&#010;&#010;  end if;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFCONTAPARTEBAU" TAB="ECFCONTAPARTEB" TIP="AFTER EACH ROW UPDATE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;  if (:new.INDVALORCONTA = &apos;C&apos;/*Credito=C;Debito=D*/) then&#010;&#010;    varValorCred := :new.VALORCONTA;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :new.VALORCONTA;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEA = VLRCREDPARTEA + varValorCred,&#010;&#010;         VLRDEBPARTEA  = VLRDEBPARTEA  + varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFCONTAPARTEBBD" TAB="ECFCONTAPARTEB" TIP="BEFORE EACH ROW DELETE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;        varValorMovimento Numeric(14,2);&#010;&#010;begin&#010;&#010;  if (:old.INDVALORCONTA = &apos;C&apos;/*Credito=C;Debito=D*/) then&#010;&#010;    varValorCred := :old.VALORCONTA;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :old.VALORCONTA;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEA = VLRCREDPARTEA - varValorCred,&#010;&#010;         VLRDEBPARTEA  = VLRDEBPARTEA  - varValorDeb&#010;&#010;   where CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :old.DATALCTOFIS;&#010;&#010;&#010;&#010;  select M.VLRCREDPARTEA +&#010;&#010;         M.VLRDEBPARTEA  +&#010;&#010;         M.VLRCREDPARTEB +&#010;&#010;         M.VLRDEBPARTEB&#010;&#010;    into varValorMovimento&#010;&#010;    from ECFMOVCONTAPARTEB M&#010;&#010;   where M.CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and M.TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and M.CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and M.DATASALDO     = :old.DATALCTOFIS;&#010;&#010;&#010;&#010;  if (varValorMovimento = 0) then&#010;&#010;   delete from ECFMOVCONTAPARTEB D&#010;&#010;   where D.CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and D.TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and D.CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and D.DATASALDO     = :old.DATALCTOFIS;&#010;&#010;  end if;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFCONTAPARTEBBU" TAB="ECFCONTAPARTEB" TIP="BEFORE EACH ROW UPDATE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;  if (:old.INDVALORCONTA = &apos;C&apos;/*Credito=C;Debito=D*/) then&#010;&#010;    varValorCred := :old.VALORCONTA;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :old.VALORCONTA;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEA = VLRCREDPARTEA - varValorCred,&#010;&#010;         VLRDEBPARTEA  = VLRDEBPARTEA  - varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFLCTOPARTEBSEMREFLEXOAI" TAB="ECFLCTOPARTEBSEMREFLEXO" TIP="AFTER EACH ROW INSERT" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;/*Credito=CR&#010;&#010;  Debito=DB&#010;&#010;  Prejuizo do exercicio=PF&#010;&#010;  Base de calculo negativa da CSLL=BC*/&#010;&#010;  if (:new.INDVALORLCTO = &apos;CR&apos;/*Credito*/) then&#010;&#010;    varValorCred := :new.VALORLCTO;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :new.VALORLCTO;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEB = VLRCREDPARTEB + varValorCred,&#010;&#010;         VLRDEBPARTEB  = VLRDEBPARTEB  + varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;&#010;&#010;  if (sql%rowcount = 0) then&#010;&#010;    insert into ECFMOVCONTAPARTEB (CODIGOEMPRESA,&#010;&#010;                                   TIPOIMPOSTO,&#010;&#010;                                   CODIGOCONTAB,&#010;&#010;                                   DATASALDO,&#010;&#010;                                   VLRCREDPARTEA,&#010;&#010;                                   VLRDEBPARTEA,&#010;&#010;                                   VLRCREDPARTEB,&#010;&#010;                                   VLRDEBPARTEB)&#010;&#010;                           values (:new.CODIGOEMPRESA,&#010;&#010;                                   :new.TIPOIMPOSTO,&#010;&#010;                                   :new.CODIGOCONTAB,&#010;&#010;                                   :new.DATALCTOFIS,&#010;&#010;                                   0,&#010;&#010;                                   0,&#010;&#010;                                   varValorCred,&#010;&#010;                                   varValorDeb);&#010;&#010;  end if;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFLCTOPARTEBSEMREFLEXOAU" TAB="ECFLCTOPARTEBSEMREFLEXO" TIP="AFTER EACH ROW UPDATE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;/*Credito=CR&#010;&#010;  Debito=DB&#010;&#010;  Prejuizo do exercicio=PF&#010;&#010;  Base de calculo negativa da CSLL=BC*/&#010;&#010;  if (:new.INDVALORLCTO = &apos;CR&apos;/*Credito*/) then&#010;&#010;    varValorCred := :new.VALORLCTO;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :new.VALORLCTO;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEB = VLRCREDPARTEB + varValorCred,&#010;&#010;         VLRDEBPARTEB  = VLRDEBPARTEB  + varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFLCTOPARTEBSEMREFLEXOBD" TAB="ECFLCTOPARTEBSEMREFLEXO" TIP="BEFORE EACH ROW DELETE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;        varValorMovimento Numeric(14,2);&#010;&#010;begin&#010;&#010;/*Credito=CR&#010;&#010;  Debito=DB&#010;&#010;  Prejuizo do exercicio=PF&#010;&#010;  Base de calculo negativa da CSLL=BC*/&#010;&#010;  if (:old.INDVALORLCTO = &apos;CR&apos;/*Credito*/) then&#010;&#010;    varValorCred := :old.VALORLCTO;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :old.VALORLCTO;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEB = VLRCREDPARTEB - varValorCred,&#010;&#010;         VLRDEBPARTEB  = VLRDEBPARTEB  - varValorDeb&#010;&#010;   where CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :old.DATALCTOFIS;&#010;&#010;&#010;&#010;  select M.VLRCREDPARTEA +&#010;&#010;         M.VLRDEBPARTEA  +&#010;&#010;         M.VLRCREDPARTEB +&#010;&#010;         M.VLRDEBPARTEB&#010;&#010;    into varValorMovimento&#010;&#010;    from ECFMOVCONTAPARTEB M&#010;&#010;   where M.CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and M.TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and M.CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and M.DATASALDO     = :old.DATALCTOFIS;&#010;&#010;&#010;&#010;  if (varValorMovimento = 0) then&#010;&#010;   delete from ECFMOVCONTAPARTEB D&#010;&#010;   where D.CODIGOEMPRESA = :old.CODIGOEMPRESA&#010;&#010;     and D.TIPOIMPOSTO   = :old.TIPOIMPOSTO&#010;&#010;     and D.CODIGOCONTAB  = :old.CODIGOCONTAB&#010;&#010;     and D.DATASALDO     = :old.DATALCTOFIS;&#010;&#010;  end if;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ECFLCTOPARTEBSEMREFLEXOBU" TAB="ECFLCTOPARTEBSEMREFLEXO" TIP="BEFORE EACH ROW UPDATE" FONTE_OR="declare varValorDeb Numeric(14,2);&#010;&#010;        varValorCred Numeric(14,2);&#010;&#010;begin&#010;&#010;/*Credito=CR&#010;&#010;  Debito=DB&#010;&#010;  Prejuizo do exercicio=PF&#010;&#010;  Base de calculo negativa da CSLL=BC*/&#010;&#010;  if (:old.INDVALORLCTO = &apos;CR&apos;/*Credito*/) then&#010;&#010;    varValorCred := :old.VALORLCTO;&#010;&#010;    varValorDeb  := 0;&#010;&#010;  else&#010;&#010;    varValorCred := 0;&#010;&#010;    varValorDeb  := :old.VALORLCTO;&#010;&#010;  end if;&#010;&#010;&#010;&#010;  update ECFMOVCONTAPARTEB&#010;&#010;     set VLRCREDPARTEB = VLRCREDPARTEB - varValorCred,&#010;&#010;         VLRDEBPARTEB  = VLRDEBPARTEB  - varValorDeb&#010;&#010;   where CODIGOEMPRESA = :new.CODIGOEMPRESA&#010;&#010;     and TIPOIMPOSTO   = :new.TIPOIMPOSTO&#010;&#010;     and CODIGOCONTAB  = :new.CODIGOCONTAB&#010;&#010;     and DATASALDO     = :new.DATALCTOFIS;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ESOCIALTRANSACAOBD" TAB="ESOCIALTRANSACAO" TIP="BEFORE EACH ROW DELETE" FONTE_OR="DECLARE &#010;  EX_CUSTOM EXCEPTION; &#010;BEGIN &#010;  RAISE EX_CUSTOM; &#010;END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ESOCIALTRANSACAOBI" TAB="ESOCIALTRANSACAO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE&#010;PRAGMA AUTONOMOUS_TRANSACTION;&#010;IDEVENTOINSERIDO VARCHAR2(50);&#010;INICIOID VARCHAR2(50);&#010;FINALID INTEGER;&#010;VALORGENERATOR INTEGER;&#010;BEGIN&#010;  IDEVENTOINSERIDO := :NEW.IDEVENTO;&#010;  IF ((:NEW.ORIGEMDADO &lt;&gt; 3) AND (:NEW.STATUS &lt;&gt; 0)) THEN&#010;    SELECT GENIDEVENTO.NEXTVAL INTO VALORGENERATOR FROM dual;&#010;&#010;    IF VALORGENERATOR &gt;= 1000 THEN&#010;      EXECUTE IMMEDIATE &apos;ALTER SEQUENCE GENIDEVENTO RESTART START WITH 1&apos;;&#010;      SELECT GENIDEVENTO.NEXTVAL INTO VALORGENERATOR FROM dual;&#010;    END IF;&#010;&#010;    INICIOID := SUBSTR(IDEVENTOINSERIDO, 1, 32);&#010;    FINALID := VALORGENERATOR;&#010;&#010;    IDEVENTOINSERIDO := INICIOID || LPAD(FINALID, 4, &apos;0&apos;);&#010;  END IF;&#010;  :NEW.IDEVENTO := IDEVENTOINSERIDO;&#010;END;"/>
<ROW TRI_KEY="FAILDEL" TAB="SITUACAOMODULO" TIP="BEFORE EACH ROW DELETE" FONTE_OR="declare ex_custom exception; &#010;BEGIN &#010; raise ex_custom;&#010;END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FAILINS" TAB="SITUACAOMODULO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare ex_custom exception; &#010;BEGIN &#010; raise ex_custom;&#010;END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FAILUP" TAB="SITUACAOMODULO" TIP="BEFORE EACH ROW UPDATE" FONTE_OR="declare ex_custom exception; &#010;BEGIN &#010; raise ex_custom;&#010;END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FAILUREVI" TAB="LOGPARAMVALORINCLUSION" TIP="BEFORE EACH ROW DELETE" FONTE_OR="declare ex_custom exception;&#010;&#010; BEGIN&#010;&#010;   raise ex_custom;&#010;&#010; END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FPRCONTAPAGARAD" TAB="FPRCONTAPAGAR" TIP="AFTER EACH ROW DELETE" FONTE_OR="declare SomaValorBaixa Numeric(15,2); &#010;  ValorPagCab Numeric(15,2);&#010;begin&#010;  SomaValorBaixa := &apos;select coalesce(sum(FB.VALORBAIXA),0) from FPRCONTAPAGARBAIXA FB WHERE FB.codigoescrit = &apos;+ :OLD.CODIGOESCRIT +&apos; and FB.CODIGOPAGARCAB = &apos;+ :OLD.CODIGOPAGARCAB;&#010;  &#010;  ValorPagCab := &apos;select coalesce(FC.VALORPAGCAB,0) from FPRCONTAPAGARCAB FC WHERE FC.codigoescrit = &apos;+:OLD.CODIGOESCRIT+&apos; and FC.CODIGOPAGARCAB = &apos;+:OLD.CODIGOPAGARCAB;&#010;&#010;  if (SomaValorBaixa &gt;= ValorPagCab) then&#010;&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 3&#010;&#010;    WHERE FC.CODIGOESCRIT = :OLD.CODIGOESCRIT&#010;&#010;      AND FC.CODIGOPAGARCAB = :OLD.CODIGOPAGARCAB;&#010;  end if;&#010;&#010;  if ((SomaValorBaixa &gt; 0) and (SomaValorBaixa &lt; ValorPagCab)) then&#010;&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 2&#010;&#010;    WHERE FC.CODIGOESCRIT = :OLD.CODIGOESCRIT&#010;&#010;      AND FC.CODIGOPAGARCAB = :OLD.CODIGOPAGARCAB;&#010;  end if;&#010;&#010;  if (SomaValorBaixa = 0) then&#010;&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 1&#010;&#010;    WHERE FC.CODIGOESCRIT = :OLD.CODIGOESCRIT&#010;&#010;      AND FC.CODIGOPAGARCAB = :OLD.CODIGOPAGARCAB;&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FPRCONTAPAGARAU" TAB="FPRCONTAPAGAR" TIP="AFTER EACH ROW UPDATE" FONTE_OR="declare SomaValorBaixa Numeric(15,2);&#010;  ValorPagCab Numeric(15,2);&#010;begin&#010;&#010;  EXECUTE IMMEDIATE &apos;select coalesce(sum(FB.VALORBAIXA),0) from FPRCONTAPAGARBAIXA FB WHERE FB.codigoescrit = :NEW.CODIGOESCRIT  and FB.CODIGOPAGARCAB = :NEW.CODIGOPAGARCAB &apos; into SomaValorBaixa;&#010;&#010;  ValorPagCab := &apos;select coalesce(FC.VALORPAGCAB,0) from FPRCONTAPAGARCAB FC WHERE FC.codigoescrit =&apos;+ :NEW.CODIGOESCRIT +&apos;and FC.CODIGOPAGARCAB = &apos;+ :NEW.CODIGOPAGARCAB;&#010;&#010;  if (SomaValorBaixa &gt;= ValorPagCab) then&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 3&#010;    WHERE FC.CODIGOESCRIT = :NEW.CODIGOESCRIT&#010;      AND FC.CODIGOPAGARCAB = :NEW.CODIGOPAGARCAB;&#010;  end if;&#010;&#010;  if ((SomaValorBaixa &gt; 0) and (SomaValorBaixa &lt; ValorPagCab)) then&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 2&#010;    WHERE FC.CODIGOESCRIT = :NEW.CODIGOESCRIT&#010;      AND FC.CODIGOPAGARCAB = :NEW.CODIGOPAGARCAB;&#010;  end if;&#010;&#010;  if (SomaValorBaixa = 0) then&#010;    update FPRCONTAPAGARCAB FC SET SITUACAOPAG = 1&#010;    WHERE FC.CODIGOESCRIT = :NEW.CODIGOESCRIT&#010;      AND FC.CODIGOPAGARCAB = :NEW.CODIGOPAGARCAB;&#010;  end if;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FPRCONTAPAGARCABAI" TAB="FPRCONTAPAGARCAB" TIP="AFTER EACH ROW INSERT" FONTE_OR="begin&#010;&#010;  UPDATE FPRCONTAPAGARCAB FC SET SITUACAOPAG = 1&#010;&#010;    WHERE FC.CODIGOESCRIT = :NEW.CODIGOESCRIT&#010;&#010;    AND FC.CODIGOPAGARCAB = :NEW.CODIGOPAGARCAB;&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="FUNCPERCALCULOBD" TAB="FUNCPERCALCULO" TIP="BEFORE EACH ROW DELETE" FONTE_OR="DECLARE &#010;  DATAATUAL DATE; &#010;BEGIN &#010;  SELECT SYSDATE INTO DATAATUAL FROM DUAL;&#010;END;&#010;"/>
<ROW TRI_KEY="HISTORICOALTERACAOESOCIALBI" TAB="HISTORICOALTERACAOESOCIAL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE &#010;  i NUMBER(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.SEQ is null) then &#010;    select GEN_HISTORICOALTERACAOESOCIAL.NEXTVAL into :NEW.SEQ from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_HISTORICOALTERACAOESOCIAL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_HISTORICOALTERACAOESOCIAL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.SEQ &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_HISTORICOALTERACAOESOCIAL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="ICMSESESTOQCOMBUSTBI" TAB="ICMSESESTOQCOMBUST" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.IDESTOQCOMBUST is null) then &#010;    select GEN_IDESTOQCOMBUST.NEXTVAL into :NEW.IDESTOQCOMBUST from dual; /**/ &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDESTOQCOMBUST.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_IDESTOQCOMBUST&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.IDESTOQCOMBUST &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDESTOQCOMBUST.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="ICMSESTOTALCOMBUSTBI" TAB="ICMSESTOTALCOMBUST" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.IDTOTALCOMBUST is null) then &#010;    select GEN_IDTOTALCOMBUST.NEXTVAL into :NEW.IDTOTALCOMBUST from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDTOTALCOMBUST.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_IDTOTALCOMBUST&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.IDTOTALCOMBUST &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDTOTALCOMBUST.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="IMPLSALDOCTBAIAU" TAB="IMPLSALDOCTB" TIP="AFTER EACH ROW INSERT OR UPDATE" FONTE_OR="declare aContaCtbDeb numeric(10,0);&#010;          aContaCtbCred numeric(10,0);&#010;begin&#010;  if (:NEW.NaturezaSaldo in (1, -1)) then&#010;    aContaCtbDeb  := null;&#010;    aContaCtbCred := null;&#010;&#010;    if (:NEW.NaturezaSaldo = 1) then&#010;      aContaCtbDeb  := :NEW.ContaCtb;&#010;    else&#010;      aContaCtbCred := :NEW.ContaCtb;&#010;    end if;&#010;&#010;    if (:NEW.CodigoMoeda = 0/*Real*/) then&#010;      TOTALIZARSALDOCTB(:NEW.CodigoEmpresa,&#010;                        :NEW.CodigoEstab,&#010;                        aContaCtbDeb,&#010;                        aContaCtbCred,&#010;                        :NEW.DataSaldo,&#010;                        :NEW.TipoLancamento,&#010;                        :NEW.ValorSaldo);&#010;    else&#010;      TOTALIZARSALDOCTBMOEDA(:NEW.CodigoEmpresa,&#010;                             :NEW.CodigoEstab,&#010;                             aContaCtbDeb,&#010;                             aContaCtbCred,&#010;                             :NEW.DataSaldo,&#010;                             :NEW.TipoLancamento,&#010;                             :NEW.ValorSaldo,&#010;                             :NEW.CodigoMoeda);&#010;    end if;&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="IMPLSALDOCTBBI" TAB="IMPLSALDOCTB" TIP="BEFORE EACH ROW INSERT" FONTE_OR="begin&#010;&#010;  if (:NEW.TipoLancamento is null) then&#010;&#010;    :NEW.TipoLancamento := &apos;LN&apos;;/**/&#010;&#010;  end if;/**/&#010;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="IMPLSALDOCTBBUBD" TAB="IMPLSALDOCTB" TIP="BEFORE EACH ROW UPDATE OR DELETE" FONTE_OR="declare aContaCtbDeb numeric(10,0);&#010;          aContaCtbCred numeric(10,0);&#010;begin&#010;  if (:OLD.NaturezaSaldo in (1, -1)) then&#010;    aContaCtbDeb  := null;&#010;    aContaCtbCred := null;&#010;&#010;    if (:OLD.NaturezaSaldo = 1) then&#010;      aContaCtbDeb  := :OLD.ContaCtb;&#010;    else&#010;      aContaCtbCred := :OLD.ContaCtb;&#010;    end if;&#010;&#010;    if (:OLD.CodigoMoeda = 0/*Real*/) then&#010;      SUBTRAIRSALDOCTB(:OLD.CodigoEmpresa,&#010;                       :OLD.CodigoEstab,&#010;                       aContaCtbDeb,&#010;                       aContaCtbCred,&#010;                       :OLD.DataSaldo,&#010;                       :OLD.TipoLancamento,&#010;                       :OLD.ValorSaldo);&#010;    else&#010;      SUBTRAIRSALDOCTBMOEDA(:OLD.CodigoEmpresa,&#010;                            :OLD.CodigoEstab,&#010;                            aContaCtbDeb,&#010;                            aContaCtbCred,&#010;                            :OLD.DataSaldo,&#010;                            :OLD.TipoLancamento,&#010;                            :OLD.ValorSaldo,&#010;                            :OLD.CodigoMoeda);&#010;    end if;&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="JOBAGENDABI" TAB="JOBAGENDA" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE TMP NUMBER(18,0);/**/&#010;BEGIN&#010;  IF (:NEW.CODIGOJOBAGENDA IS NULL) THEN&#010;    SELECT GENJOBAGENDA.NEXTVAL INTO :NEW.CODIGOJOBAGENDA FROM DUAL;/**/&#010;  ELSE&#010;    BEGIN&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBAGENDA.CURRVAL FROM DUAL&apos; INTO TMP;/**/&#010;    EXCEPTION&#010;      WHEN OTHERS THEN&#010;        EXECUTE IMMEDIATE &apos;SELECT GENJOBAGENDA.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END;/**/&#010;    WHILE (:NEW.CODIGOJOBAGENDA &gt; TMP)&#010;    LOOP&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBAGENDA.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END LOOP;/**/&#010;  END IF;/**/&#010;END;&#010;"/>
<ROW TRI_KEY="JOBBUILDBI" TAB="JOBBUILD" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/&#010;begin&#010;  if (:NEW.CODIGOBUILD is null) then&#010;    select GEN_JOBBUILD.NEXTVAL into :NEW.CODIGOBUILD from dual;/**/&#010;  else&#010;    begin&#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_JOBBUILD.CURRVAL FROM dual&apos; INTO i;/**/&#010;    EXCEPTION&#010;      WHEN OTHERS THEN&#010;        EXECUTE IMMEDIATE &apos;SELECT GEN_JOBBUILD.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end;/**/&#010;    while (:NEW.CODIGOBUILD &gt; i)&#010;    loop&#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_JOBBUILD.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end loop;/**/&#010;  end if;/**/&#010;end;&#010;"/>
<ROW TRI_KEY="JOBCONFIGURACAOBI" TAB="JOBCONFIGURACAO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE TMP NUMBER(18,0);/**/&#010;BEGIN&#010;  IF (:NEW.CODIGOJOBCFG IS NULL) THEN&#010;    SELECT GENJOBCONFIGURACAO.NEXTVAL INTO :NEW.CODIGOJOBCFG FROM DUAL;/**/&#010;  ELSE&#010;    BEGIN&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBCONFIGURACAO.CURRVAL FROM DUAL&apos; INTO TMP;/**/&#010;    EXCEPTION&#010;      WHEN OTHERS THEN&#010;        EXECUTE IMMEDIATE &apos;SELECT GENJOBCONFIGURACAO.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END;/**/&#010;    WHILE (:NEW.CODIGOJOBCFG &gt; TMP)&#010;    LOOP&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBCONFIGURACAO.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END LOOP;/**/&#010;  END IF;/**/&#010;END;&#010;"/>
<ROW TRI_KEY="JOBPARAMETROBI" TAB="JOBPARAMETRO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE TMP NUMBER(18,0);/**/&#010;BEGIN&#010;  IF (:NEW.CODIGOJOBPARAMETRO IS NULL) THEN&#010;    SELECT GENJOBPARAMETRO.NEXTVAL INTO :NEW.CODIGOJOBPARAMETRO FROM DUAL;/**/&#010;  ELSE&#010;    BEGIN&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBPARAMETRO.CURRVAL FROM DUAL&apos; INTO TMP;/**/&#010;    EXCEPTION&#010;      WHEN OTHERS THEN&#010;        EXECUTE IMMEDIATE &apos;SELECT GENJOBPARAMETRO.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END;/**/&#010;    WHILE (:NEW.CODIGOJOBPARAMETRO &gt; TMP)&#010;    LOOP&#010;      EXECUTE IMMEDIATE &apos;SELECT GENJOBPARAMETRO.NEXTVAL FROM DUAL&apos; INTO TMP;/**/&#010;    END LOOP;/**/&#010;  END IF;/**/&#010;END;&#010;"/>
<ROW TRI_KEY="LCTOATIVDIFERENCEXCLBI" TAB="LCTOATIVDIFERENCEXCL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.IDLCTOATIVEXCL is null) then &#010;    select GEN_IDLCTOATIVDIFEXCL.NEXTVAL &#010;      into :NEW.IDLCTOATIVEXCL &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOATIVDIFEXCL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_IDLCTOATIVDIFEXCL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.IDLCTOATIVEXCL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOATIVDIFEXCL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="LCTOCTBAI" TAB="LCTOCTB" TIP="AFTER EACH ROW INSERT" FONTE_OR="begin&#010;  TOTALIZARSALDOCTB(:NEW.CodigoEmpresa,&#010;                    :NEW.CodigoEstab,&#010;                    :NEW.ContaCtbDeb,&#010;                    :NEW.ContaCtbCred,&#010;                    :NEW.DataLctoCtb,&#010;                    :NEW.TipoLancamento,&#010;                    :NEW.ValorLctoCtb);&#010;&#010;  TOTALIZARSALDOCTBHIST(:NEW.CodigoEmpresa,&#010;                        :NEW.CodigoEstab,&#010;                        :NEW.ContaCtbDeb,&#010;                        :NEW.ContaCtbCred,&#010;                        :NEW.DataLctoCtb,&#010;                        :NEW.TipoLancamento,&#010;                        :NEW.CodigoHistCtb,&#010;                        :NEW.ValorLctoCtb);&#010;&#010;  TOTALIZARSALDOCTBMOEDA(:NEW.CodigoEmpresa,&#010;                         :NEW.CodigoEstab,&#010;                         :NEW.ContaCtbDeb,&#010;                         :NEW.ContaCtbCred,&#010;                         :NEW.DataLctoCtb,&#010;                         :NEW.TipoLancamento,&#010;                         :NEW.ValorLctoMoeda,&#010;                         null);&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="LCTOCTBAU" TAB="LCTOCTB" TIP="AFTER EACH ROW UPDATE" FONTE_OR="declare aAtualizaSaldo smallint;&#010;begin&#010;  aAtualizaSaldo := 0;&#010;  if ((:NEW.CodigoEmpresa             &lt;&gt; :OLD.CodigoEmpresa)            or&#010;      (:NEW.CodigoEstab               &lt;&gt; :OLD.CodigoEstab)              or&#010;      (:NEW.DataLctoCtb               &lt;&gt; :OLD.DataLctoCtb)              or&#010;      (:NEW.TipoLancamento            &lt;&gt; :OLD.TipoLancamento)           or&#010;      (coalesce(:NEW.ContaCtbDeb, 0)  &lt;&gt; coalesce(:OLD.ContaCtbDeb, 0)) or&#010;      (coalesce(:NEW.ContaCtbCred, 0) &lt;&gt; coalesce(:OLD.ContaCtbCred, 0))) then&#010;    aAtualizaSaldo := 1;&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or (:NEW.ValorLctoCtb &lt;&gt; :OLD.ValorLctoCtb)) then&#010;    TOTALIZARSALDOCTB(:NEW.CodigoEmpresa,&#010;                      :NEW.CodigoEstab,&#010;                      :NEW.ContaCtbDeb,&#010;                      :NEW.ContaCtbCred,&#010;                      :NEW.DataLctoCtb,&#010;                      :NEW.TipoLancamento,&#010;                      :NEW.ValorLctoCtb);&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or&#010;      (:NEW.ValorLctoCtb &lt;&gt; :OLD.ValorLctoCtb) or&#010;      (coalesce(:NEW.CodigoHistCtb, 0) &lt;&gt; coalesce(:OLD.CodigoHistCtb, 0))) then&#010;    TOTALIZARSALDOCTBHIST(:NEW.CodigoEmpresa,&#010;                          :NEW.CodigoEstab,&#010;                          :NEW.ContaCtbDeb,&#010;                          :NEW.ContaCtbCred,&#010;                          :NEW.DataLctoCtb,&#010;                          :NEW.TipoLancamento,&#010;                          :NEW.CodigoHistCtb,&#010;                          :NEW.ValorLctoCtb);&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or (coalesce(:NEW.ValorLctoMoeda, 0) &lt;&gt; coalesce(:OLD.ValorLctoMoeda, 0))) then&#010;      TOTALIZARSALDOCTBMOEDA(:NEW.CodigoEmpresa,&#010;                             :NEW.CodigoEstab,&#010;                             :NEW.ContaCtbDeb,&#010;                             :NEW.ContaCtbCred,&#010;                             :NEW.DataLctoCtb,&#010;                             :NEW.TipoLancamento,&#010;                             :NEW.ValorLctoMoeda,&#010;                             null);&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="LCTOCTBBD" TAB="LCTOCTB" TIP="BEFORE EACH ROW DELETE" FONTE_OR="begin&#010;  SUBTRAIRSALDOCTB(:OLD.CodigoEmpresa,&#010;                   :OLD.CodigoEstab,&#010;                   :OLD.ContaCtbDeb,&#010;                   :OLD.ContaCtbCred,&#010;                   :OLD.DataLctoCtb,&#010;                   :OLD.TipoLancamento,&#010;                   :OLD.ValorLctoCtb);&#010;&#010;  SUBTRAIRSALDOCTBHIST(:OLD.CodigoEmpresa,&#010;                       :OLD.CodigoEstab,&#010;                       :OLD.ContaCtbDeb,&#010;                       :OLD.ContaCtbCred,&#010;                       :OLD.DataLctoCtb,&#010;                       :OLD.TipoLancamento,&#010;                       :OLD.CodigoHistCtb,&#010;                       :OLD.ValorLctoCtb);&#010;&#010;  SUBTRAIRSALDOCTBMOEDA(:OLD.CodigoEmpresa,&#010;                        :OLD.CodigoEstab,&#010;                        :OLD.ContaCtbDeb,&#010;                        :OLD.ContaCtbCred,&#010;                        :OLD.DataLctoCtb,&#010;                        :OLD.TipoLancamento,&#010;                        :OLD.ValorLctoMoeda,&#010;                        null);&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="LCTOCTBBI" TAB="LCTOCTB" TIP="BEFORE EACH ROW INSERT" FONTE_OR="begin&#010;  if ((:NEW.TipoLancamento is null) or (not(:NEW.TipoLancamento in (&apos;LN&apos;, &apos;LS&apos;, &apos;LF&apos;)))) then&#010;    :NEW.TipoLancamento := &apos;LN&apos;;/**/&#010;  end if;/**/&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="LCTOCTBBICHAVE" TAB="LCTOCTB" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  tmp number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CHAVELCTOCTB is null) then &#010;    EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOCTB_&apos; || :NEW.CODIGOEMPRESA || &#010;                      &apos;.NEXTVAL FROM dual&apos; &#010;      INTO :NEW.CHAVELCTOCTB; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOCTB_&apos; || :NEW.CODIGOEMPRESA || &#010;                        &apos;.CURRVAL FROM dual&apos; &#010;        INTO tmp; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME= &apos;&apos;&apos; || &apos;DYN_GENCHAVELCTOCTB_&apos; || :NEW.CODIGOEMPRESA || &apos;&apos;&apos;&apos; INTO tmp; &#010;    end; &#010;    while (:NEW.CHAVELCTOCTB &gt; tmp) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT  DYN_GENCHAVELCTOCTB_&apos; || &#010;                        :NEW.CODIGOEMPRESA || &apos;.NEXTVAL FROM dual&apos; &#010;        INTO tmp; &#010;    end loop; &#010;  end if; &#010;END;&#010;"/>
<ROW TRI_KEY="LCTOCTBBU" TAB="LCTOCTB" TIP="BEFORE EACH ROW UPDATE" FONTE_OR="declare aAtualizaSaldo smallint;&#010;begin&#010;  aAtualizaSaldo := 0;&#010;  if ((:NEW.CodigoEmpresa             &lt;&gt; :OLD.CodigoEmpresa)            or&#010;      (:NEW.CodigoEstab               &lt;&gt; :OLD.CodigoEstab)              or&#010;      (:NEW.DataLctoCtb               &lt;&gt; :OLD.DataLctoCtb)              or&#010;      (:NEW.TipoLancamento            &lt;&gt; :OLD.TipoLancamento)           or&#010;      (coalesce(:NEW.ContaCtbDeb, 0)  &lt;&gt; coalesce(:OLD.ContaCtbDeb, 0)) or&#010;      (coalesce(:NEW.ContaCtbCred, 0) &lt;&gt; coalesce(:OLD.ContaCtbCred, 0))) then&#010;    aAtualizaSaldo := 1;&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or (:NEW.ValorLctoCtb &lt;&gt; :OLD.ValorLctoCtb)) then&#010;    SUBTRAIRSALDOCTB(:OLD.CodigoEmpresa,&#010;                     :OLD.CodigoEstab,&#010;                     :OLD.ContaCtbDeb,&#010;                     :OLD.ContaCtbCred,&#010;                     :OLD.DataLctoCtb,&#010;                     :OLD.TipoLancamento,&#010;                     :OLD.ValorLctoCtb);&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or&#010;      (:NEW.ValorLctoCtb &lt;&gt; :OLD.ValorLctoCtb) or&#010;      (coalesce(:NEW.CodigoHistCtb, 0) &lt;&gt; coalesce(:OLD.CodigoHistCtb, 0)))  then&#010;    SUBTRAIRSALDOCTBHIST(:OLD.CodigoEmpresa,&#010;                         :OLD.CodigoEstab,&#010;                         :OLD.ContaCtbDeb,&#010;                         :OLD.ContaCtbCred,&#010;                         :OLD.DataLctoCtb,&#010;                         :OLD.TipoLancamento,&#010;                         :OLD.CodigoHistCtb,&#010;                         :OLD.ValorLctoCtb);&#010;  end if;&#010;&#010;  if ((aAtualizaSaldo = 1) or (coalesce(:NEW.ValorLctoMoeda, 0) &lt;&gt; coalesce(:OLD.ValorLctoMoeda, 0))) then&#010;    SUBTRAIRSALDOCTBMOEDA(:OLD.CodigoEmpresa,&#010;                          :OLD.CodigoEstab,&#010;                          :OLD.ContaCtbDeb,&#010;                          :OLD.ContaCtbCred,&#010;                          :OLD.DataLctoCtb,&#010;                          :OLD.TipoLancamento,&#010;                          :OLD.ValorLctoMoeda,&#010;                          null);&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="LCTOCTBEXCLUIDOBI" TAB="LCTOCTBEXCLUIDO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.IDLCTOCTBEXCL is null) then &#010;    select GEN_IDLCTOCTBEXCL.NEXTVAL into :NEW.IDLCTOCTBEXCL from dual; /**/ &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOCTBEXCL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_IDLCTOCTBEXCL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.IDLCTOCTBEXCL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOCTBEXCL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="LCTODOCUMENTOFISCALBI" TAB="LCTODOCUMENTOFISCAL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGODOCUMENTOFISCAL is null) then &#010;    select GEN_CODIGODOCUMENTOFISCAL.NEXTVAL &#010;      into :NEW.CODIGODOCUMENTOFISCAL &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGODOCUMENTOFISCAL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGODOCUMENTOFISCAL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGODOCUMENTOFISCAL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGODOCUMENTOFISCAL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="LCTOFISENTBI" TAB="LCTOFISENT" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/&#010;not_currval EXCEPTION;/**/&#010;PRAGMA EXCEPTION_INIT(not_currval, -8002);/**/&#010;begin&#010;  if (:NEW.CHAVELCTOFISENT is null) then&#010;    EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISENT_&apos;||:NEW.CODIGOEMPRESA||&apos;.NEXTVAL FROM dual&apos; INTO :NEW.CHAVELCTOFISENT;/**/&#010;  else&#010;    begin&#010;      EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISENT_&apos;||:NEW.CODIGOEMPRESA||&apos;.CURRVAL FROM dual&apos; INTO i;/**/&#010;    EXCEPTION&#010;      WHEN not_currval THEN &#010;      EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME= &apos;&apos;&apos; || &apos;DYN_GENCHAVELCTOFISENT_&apos; || :NEW.CODIGOEMPRESA || &apos;&apos;&apos;&apos; INTO i;&#010;    end; &#010;    while (:NEW.CHAVELCTOFISENT &gt; i)&#010;    loop&#010;      EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISENT_&apos;||:NEW.CODIGOEMPRESA||&apos;.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end loop;/**/&#010;  end if;/**/&#010;end;/**/"/>
<ROW TRI_KEY="LCTOFISSAIBI" TAB="LCTOFISSAI" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/&#010;not_currval EXCEPTION;/**/&#010;PRAGMA EXCEPTION_INIT(not_currval, -8002);/**/&#010;begin&#010;  if (:NEW.CHAVELCTOFISSAI is null) then&#010;    EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISSAI_&apos;||:NEW.CODIGOEMPRESA||&apos;.NEXTVAL FROM dual&apos; INTO :NEW.CHAVELCTOFISSAI;/**/&#010;  else&#010;    begin&#010;      EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISSAI_&apos;||:NEW.CODIGOEMPRESA||&apos;.CURRVAL FROM dual&apos; INTO i;/**/&#010;    EXCEPTION&#010;      WHEN not_currval THEN &#010;      EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME= &apos;&apos;&apos; || &apos;DYN_GENCHAVELCTOFISSAI_&apos; || :NEW.CODIGOEMPRESA || &apos;&apos;&apos;&apos; INTO i;&#010;    end; &#010;    while (:NEW.CHAVELCTOFISSAI &gt; i)&#010;    loop&#010;      EXECUTE IMMEDIATE &apos;SELECT DYN_GENCHAVELCTOFISSAI_&apos;||:NEW.CODIGOEMPRESA||&apos;.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end loop;/**/&#010;  end if;/**/&#010;end;/**/"/>
<ROW TRI_KEY="LCTOGEREXCLUIDOBI" TAB="LCTOGEREXCLUIDO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.IDLCTOGEREXCL is null) then &#010;    select GEN_IDLCTOGEREXCL.NEXTVAL into :NEW.IDLCTOGEREXCL from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOGEREXCL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_IDLCTOGEREXCL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.IDLCTOGEREXCL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_IDLCTOGEREXCL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="LOGGERALBI" TAB="LOGGERAL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="DECLARE i number(14,0);&#010;begin&#010;  if (:NEW.IDLOG is null) then&#010;    :NEW.IDLOG := GENLOG.nextval;&#010;  else&#010;    while (:NEW.IDLOG &gt; GENLOG.currval)&#010;    loop&#010;      i := GENLOG.nextval;&#010;    end loop;&#010;  end if;&#010;  if (:NEW.DATAHORAINICIO is null) then&#010;&#010;    :NEW.DATAHORAINICIO := current_timestamp;&#010;  end if;&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="PATBEMBI" TAB="PATBEM" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOBEM is null) then &#010;    select GEN_CODIGOBEM.NEXTVAL into :NEW.CODIGOBEM from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOBEM.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOBEM&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOBEM &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOBEM.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATBEMCONTACONTABILBI" TAB="PATBEMCONTACONTABIL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOBEMCONTACONTABIL is null) then &#010;    select GEN_CODIGOBEMCONTACONTABIL.NEXTVAL &#010;      into :NEW.CODIGOBEMCONTACONTABIL &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOBEMCONTACONTABIL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOBEMCONTACONTABIL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOBEMCONTACONTABIL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOBEMCONTACONTABIL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATCFGBEMBI" TAB="PATCFGBEM" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOCFGBEM is null) then &#010;    select GEN_CODIGOCFGBEM.NEXTVAL into :NEW.CODIGOCFGBEM from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOCFGBEM.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOCFGBEM&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOCFGBEM &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOCFGBEM.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATENCCONTACONTABILBI" TAB="PATENCCONTACONTABIL" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOENCCONTACONTABIL is null) then &#010;    select GEN_CODIGOENCCONTACONTABIL.NEXTVAL &#010;      into :NEW.CODIGOENCCONTACONTABIL &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOENCCONTACONTABIL.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOENCCONTACONTABIL&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOENCCONTACONTABIL &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOENCCONTACONTABIL.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATGRUPOBI" TAB="PATGRUPO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOGRUPO is null) then &#010;    select GEN_CODIGOGRUPO.NEXTVAL into :NEW.CODIGOGRUPO from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOGRUPO.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOGRUPO&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOGRUPO &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOGRUPO.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATGRUPODETALHEBI" TAB="PATGRUPODETALHE" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGODETALHE is null) then &#010;    select GEN_CODIGODETALHE.NEXTVAL into :NEW.CODIGODETALHE from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGODETALHE.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGODETALHE&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGODETALHE &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGODETALHE.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PATHISTORICOCONVERSAOBI" TAB="PATHISTORICOCONVERSAO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i number(14, 0); &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOHISTORICOCONVERSAO is null) then &#010;    select GEN_CODIGOHISTORICOCONVERSAO.NEXTVAL &#010;      into :NEW.CODIGOHISTORICOCONVERSAO &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOHISTORICOCONVERSAO.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOHISTORICOCONVERSAO&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOHISTORICOCONVERSAO &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOHISTORICOCONVERSAO.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="PESSOABI" TAB="PESSOA" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/&#010;not_currval EXCEPTION; &#010;PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOPESSOA is null) then &#010;    select GEN_CODIGOPESSOA.NEXTVAL into :NEW.CODIGOPESSOA from dual; &#010;  else &#010;  begin &#010;    EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOPESSOA.CURRVAL FROM dual&apos; &#010;    INTO i; &#010;  EXCEPTION &#010;    WHEN not_currval THEN &#010;    EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;  &apos;GEN_CODIGOPESSOA&apos; || &apos;&apos;&apos;&apos; &#010;  INTO i; &#010;  end; &#010;  while (:NEW.CODIGOPESSOA &gt; i) loop &#010;    EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOPESSOA.NEXTVAL FROM dual&apos; &#010;    INTO i; &#010;  end loop; &#010;  end if; &#010;end;"/>
<ROW TRI_KEY="PRODUTOSPEDFIS0205" TAB="PRODUTO" TIP="AFTER EACH ROW UPDATE" FONTE_OR="DECLARE VALORLOG VARCHAR(120);&#010; CURSOR CURVARLOG (ANumCampo INTEGER) IS&#010;        SELECT VLRANTERIOR&#010;          FROM SPEDFIS0205&#010;         WHERE CODIGOEMPRESA = :NEW.CODIGOEMPRESA&#010;           AND CODIGOPRODUTO = :NEW.CODIGOPRODUTO&#010;           AND NUMCAMPO = ANumCampo&#010;           AND TO_CHAR(DATAALTER, &apos;DD-MM-YYYY&apos;) = TO_CHAR(CURRENT_DATE, &apos;DD-MM-YYYY&apos;);&#010; BEGIN&#010;   IF (:OLD.REFERENPRODUTO &lt;&gt; :NEW.REFERENPRODUTO) THEN&#010;&#010;     OPEN CURVARLOG(2);&#010;     FETCH CURVARLOG INTO VALORLOG;&#010;     CLOSE CURVARLOG;&#010;&#010;     IF ((VALORLOG = &apos;&apos;) or (VALORLOG IS NULL)) THEN&#010;       INSERT INTO SPEDFIS0205 (CODIGOEMPRESA, CODIGOPRODUTO, DATAALTER, NUMCAMPO, VLRANTERIOR, DATAINI)&#010;       VALUES (:NEW.CODIGOEMPRESA, :NEW.CODIGOPRODUTO, CURRENT_DATE, 2, :OLD.REFERENPRODUTO,&#010;       (SELECT MAX(DATAALTER) FROM SPEDFIS0205 WHERE CODIGOEMPRESA = :NEW.CODIGOEMPRESA&#010;       AND CODIGOPRODUTO = :NEW.CODIGOPRODUTO AND NUMCAMPO = 2));&#010;     ELSIF (VALORLOG = :NEW.REFERENPRODUTO) THEN&#010;       DELETE FROM SPEDFIS0205 S&#010;             WHERE CODIGOEMPRESA = :NEW.CODIGOEMPRESA&#010;               AND CODIGOPRODUTO = :NEW.CODIGOPRODUTO&#010;               AND NUMCAMPO = 2&#010;               AND TO_CHAR(DATAALTER, &apos;DD-MM-YYYY&apos;) = TO_CHAR(CURRENT_DATE, &apos;DD-MM-YYYY&apos;);&#010;     END IF;&#010;   END IF;&#010;&#010;   IF (:OLD.DESCRPRODUTO &lt;&gt; :NEW.DESCRPRODUTO) THEN&#010;&#010;     OPEN CURVARLOG(3);&#010;     FETCH CURVARLOG INTO VALORLOG;&#010;     CLOSE CURVARLOG;&#010;&#010;     IF ((VALORLOG = &apos;&apos;) or (VALORLOG IS NULL)) THEN&#010;       INSERT INTO SPEDFIS0205 (CODIGOEMPRESA, CODIGOPRODUTO, DATAALTER, NUMCAMPO, VLRANTERIOR, DATAINI)&#010;       VALUES (:NEW.CODIGOEMPRESA, :NEW.CODIGOPRODUTO, CURRENT_DATE, 3, :OLD.DESCRPRODUTO,&#010;       (SELECT MAX(DATAALTER) FROM SPEDFIS0205 WHERE CODIGOEMPRESA = :NEW.CODIGOEMPRESA&#010;       AND CODIGOPRODUTO = :NEW.CODIGOPRODUTO AND NUMCAMPO = 3));&#010;     ELSIF (VALORLOG = :NEW.DESCRPRODUTO) THEN&#010;       DELETE FROM SPEDFIS0205 S&#010;             WHERE CODIGOEMPRESA = :NEW.CODIGOEMPRESA&#010;               AND CODIGOPRODUTO = :NEW.CODIGOPRODUTO&#010;               AND NUMCAMPO = 3&#010;               AND TO_CHAR(DATAALTER, &apos;DD-MM-YYYY&apos;) = TO_CHAR(CURRENT_DATE, &apos;DD-MM-YYYY&apos;);&#010;     END IF;&#010;   END IF;&#010; END;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="QUIUPUBLICACAOBI" TAB="QUIUPUBLICACAO" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare i number(14,0);/**/&#010;begin&#010;  if (:NEW.CODIGOQUIUPUBLICACAO is null) then&#010;    select GENQUIUPUBLICACAO.NEXTVAL into :NEW.CODIGOQUIUPUBLICACAO from dual;/**/&#010;  else&#010;    begin&#010;      EXECUTE IMMEDIATE &apos;SELECT GENQUIUPUBLICACAO.CURRVAL FROM dual&apos; INTO i;/**/&#010;    EXCEPTION&#010;      WHEN OTHERS THEN&#010;        EXECUTE IMMEDIATE &apos;SELECT GENQUIUPUBLICACAO.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end;/**/&#010;    while (:NEW.CODIGOQUIUPUBLICACAO &gt; i)&#010;    loop&#010;      EXECUTE IMMEDIATE &apos;SELECT GENQUIUPUBLICACAO.NEXTVAL FROM dual&apos; INTO i;/**/&#010;    end loop;/**/&#010;  end if;/**/&#010;end;&#010;"/>
<ROW TRI_KEY="RECIBOFERIASBD" TAB="RECIBOFERIAS" TIP="BEFORE EACH ROW DELETE" FONTE_OR="DECLARE &#010;  DATAATUAL DATE; &#010;BEGIN &#010;  SELECT SYSDATE INTO DATAATUAL FROM DUAL;&#010;END;&#010;"/>
<ROW TRI_KEY="SEGMENTOCESTBI" TAB="SEGMENTOCEST" TIP="BEFORE EACH ROW INSERT" FONTE_OR="declare &#010;  i smallint; &#010;  not_currval EXCEPTION; &#010;  PRAGMA EXCEPTION_INIT(not_currval, -8002); &#010;begin &#010;  if (:NEW.CODIGOSEGMENTOCEST is null) then &#010;    select GEN_CODIGOSEGMENTOCEST.NEXTVAL &#010;      into :NEW.CODIGOSEGMENTOCEST &#010;      from dual; &#010;  else &#010;    begin &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOSEGMENTOCEST.CURRVAL FROM dual&apos; &#010;        INTO i; &#010;    EXCEPTION &#010;      WHEN not_currval THEN &#010;        EXECUTE IMMEDIATE &apos;SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME=&apos;&apos;&apos; || &#010;                          &apos;GEN_CODIGOSEGMENTOCEST&apos; || &apos;&apos;&apos;&apos; &#010;          INTO i; &#010;    end; &#010;    while (:NEW.CODIGOSEGMENTOCEST &gt; i) loop &#010;      EXECUTE IMMEDIATE &apos;SELECT GEN_CODIGOSEGMENTOCEST.NEXTVAL FROM dual&apos; &#010;        INTO i; &#010;    end loop; &#010;  end if; &#010;end;&#010;"/>
<ROW TRI_KEY="ZERAMENTOCTBMOEDAAIAU" TAB="ZERAMENTOCTBMOEDA" TIP="AFTER EACH ROW INSERT OR UPDATE" FONTE_OR="begin&#010;  TOTALIZARSALDOCTBMOEDA(:NEW.CodigoEmpresa,&#010;                         :NEW.CodigoEstab,&#010;                         :NEW.ContaCtbDeb,&#010;                         :NEW.ContaCtbCred,&#010;                         :NEW.DataZeramento,&#010;                         :NEW.TipoLancamento,&#010;                         :NEW.ValorZeramento,&#010;                         null);&#010;end;&#010;&#010;&#010;&#010;"/>
<ROW TRI_KEY="ZERAMENTOCTBMOEDABUBD" TAB="ZERAMENTOCTBMOEDA" TIP="BEFORE EACH ROW UPDATE OR DELETE" FONTE_OR="begin&#010;  SUBTRAIRSALDOCTBMOEDA(:OLD.CodigoEmpresa,&#010;                        :OLD.CodigoEstab,&#010;                        :OLD.ContaCtbDeb,&#010;                        :OLD.ContaCtbCred,&#010;                        :OLD.DataZeramento,&#010;                        :OLD.TipoLancamento,&#010;                        :OLD.ValorZeramento,&#010;                        null);&#010;end;&#010;&#010;&#010;&#010;"/>
</ROWDATA>
</DATAPACKET>
