ALTER TABLE BOLETRECEBER ADD DTATUAVENBOLREC DATE 
/
ALTER TABLE BOLETPAGAR ADD DTATUAVENBOLPAG DATE
/
CREATE TABLE DTVENCBOL
(
   NRSEQVENCBOL   	NUMBER,
   CDFILIAL       		VARCHAR2(04)  		NOT NULL,
   NRLANCTONF     		VARCHAR2(10)  		NOT NULL,
   NRSEQVENC      		VARCHAR2(02)     		NOT NULL,
   NRPARCELAVENC   	VARCHAR2(02)     		NOT NULL,
   DTVENCBOL      		DATE,
   NRORG                       	NUMBER 			DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     		DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_DTVENCBOL CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO             	DATE                   		NULL,
   DTULTATU                  	DATE                  		NULL,
   NRORGINCLUSAO      	NUMBER             		DEFAULT 1 NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  		DEFAULT '1' NULL,
   NRORGULTATU          	NUMBER             		DEFAULT 1 NULL,
   CDOPERULTATU        	VARCHAR2(12)  		DEFAULT '1',
	CONSTRAINT PK_DTVENCBOL PRIMARY KEY (NRSEQVENCBOL)
)
/
CREATE INDEX FK_FIS00746 ON DTVENCBOL (CDFILIAL ASC, NRLANCTONF ASC, NRSEQVENC ASC, NRPARCELAVENC ASC)
/
ALTER TABLE DTVENCBOL
    ADD CONSTRAINT FKFIS00746CONTAPAGAR FOREIGN KEY  (CDFILIAL , NRLANCTONF, NRSEQVENC , NRPARCELAVENC)
       REFERENCES CONTAPAGAR (CDFILIAL, NRLANCTONF, NRSEQVENPAG, NRPARCELAPAG) ON DELETE CASCADE
/
ALTER TABLE DTVENCBOL
    ADD CONSTRAINT FKFIS00747CONTARECEBER FOREIGN KEY  (CDFILIAL , NRLANCTONF, NRSEQVENC , NRPARCELAVENC)
       REFERENCES CONTARECEBER (CDFILIAL, NRLANCTONF, NRSEQVENREC, NRPARCELAREC) ON DELETE CASCADE