/******************************************************************************/
/***               Generated by IBExpert 19/02/2019 15:15:13                ***/
/******************************************************************************/

/******************************************************************************/
/***      Following SET SQL DIALECT is just for the Database Comparer       ***/
/******************************************************************************/
SET SQL DIALECT 3;



/******************************************************************************/
/***                                 Tables                                 ***/
/******************************************************************************/


--CREATE GENERATOR DCI_BOLETOS_ID;

CREATE TABLE BOLETOS (
    SEQ              INTEGER NOT NULL,
    NRBOLETO         INTEGER,
    PARCELA          VARCHAR(3) CHARACTER SET WIN1252,
    DATEMI           DATE,
    DATVEN           DATE,
    VALOR            NUMERIC(14,2),
    MULTA            NUMERIC(14,2),
    MORADIARIA       NUMERIC(14,2),
    CODCOBR          INTEGER,
    CODCLI           INTEGER,
    NOMECLI          VARCHAR(50) CHARACTER SET WIN1252,
    ENDERECO         VARCHAR(50) CHARACTER SET WIN1252,
    NRENDER          VARCHAR(6) CHARACTER SET WIN1252,
    CIDADE           VARCHAR(40) CHARACTER SET WIN1252,
    CODCID_NFE       VARCHAR(10) CHARACTER SET WIN1252,
    CEP              VARCHAR(9) CHARACTER SET WIN1252,
    UF               VARCHAR(2) CHARACTER SET WIN1252,
    OBSERVACAO       BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET WIN1252,
    CPFCNPJ          VARCHAR(20) CHARACTER SET WIN1252,
    RGINSCR          VARCHAR(20) CHARACTER SET WIN1252,
    BAIRRO           VARCHAR(30) CHARACTER SET WIN1252,
    NRNOTA           VARCHAR(6) CHARACTER SET WIN1252,
    VALORJUROS       NUMERIC(14,3) default 0,
    EMPRESA          INTEGER default 1,
    VALORMULTACALC   NUMERIC(14,3) default 0,
    VALORJUROSCALC   NUMERIC(14,3) default 0,
    ID               INTEGER,
    CAIXAEMISSAO     INTEGER,
    FORMAPAGTO       INTEGER,
    INSTRUCAO2       VARCHAR(100),
    INSTRUCAO1       VARCHAR(100),
    NRDOC            VARCHAR(20),
    ACEITE           INTEGER,
    ESPECIE          VARCHAR(10),
    CARTEIRA         VARCHAR(10),
    NOSSONUMERO      VARCHAR(30),
    DATAPROC         DATE,
    IDPARCELA        INTEGER,
    JUROS            NUMERIC(14,3) default 0,
    CODIGOBARRAS     VARCHAR(80),
    LINHADIGITAVEL   VARCHAR(80),
    NOSSONUMEROMONT  VARCHAR(30),
    VALORMULTA       NUMERIC(14,3) default 0,
    VALORDESCONTO    NUMERIC(14,3) default 0,
    IDSACADO         INTEGER,
    IDCEDENTE        INTEGER,
    IDBANCO          INTEGER,
    DATPAG           DATE,
    VALORPAGO        NUMERIC(14,2),
    REMESSA          D_BOOLEAN default 0 /* D_BOOLEAN = SMALLINT DEFAULT 0 CHECK (VALUE BETWEEN 0 AND 1) */,
    IDREMESSA integer, 
    DATAREMESSA      DATE,
    USUARIOBAIXA     INTEGER,
    HORAPAG          TIME,
    NRTITULO varchar(20),
    DIASPROTESTO integer,
    ALTERARVENCIMENTO D_BOOLEAN
);




/******************************************************************************/
/***                                Indices                                 ***/
/******************************************************************************/

CREATE UNIQUE INDEX IDXNRBOLETO ON BOLETOS (NRBOLETO, PARCELA);


/******************************************************************************/
/***                                Triggers                                ***/
/******************************************************************************/


SET TERM ^ ;



/******************************************************************************/
/***                          Triggers for tables                           ***/
/******************************************************************************/



/* Trigger: INSBOLETOS */
CREATE OR ALTER TRIGGER INSBOLETOS FOR BOLETOS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID = GEN_ID(dci_boletos_id, 1);
   NEW.SEQ = NEW.ID;
END
^


SET TERM ; ^



/******************************************************************************/
/***                               Privileges                               ***/
/******************************************************************************/


