ALTER TABLE PARAMFISCAL ADD IDINFPAGAPURACAO VARCHAR2(01)
   CONSTRAINT CKC_IDINFPAGAPURACAO_PARAMFISC CHECK (IDINFPAGAPURACAO IN (NULL, 'N', 'S'))
/
   
ALTER TABLE PARAMIMPOSGUIA ADD CDRECEITA VARCHAR2(20) 
/

CREATE TABLE PARAMGUIAIMPLOCAL(
    NRSEQIMPGUIALOCAL     NUMBER            NOT NULL,
    IDLOCALIDADE          VARCHAR2(1)       NOT NULL,
    CDIMPOSTO             VARCHAR2(2)  		NOT NULL,    
    CDFORMPGTO            VARCHAR2(2),
    NRDIAFIXVENC          NUMBER,
    IDVENCDIANAOUTIL      VARCHAR2(1)    	DEFAULT 'A'     NOT NULL,
    CDFILIALCALEND        VARCHAR2(4),
    IDTPCALEND            VARCHAR2(1)    	DEFAULT 'F'     NOT NULL,
    CDRECEITA             VARCHAR2(20),
    NRORG             	  NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           	  VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        	  DATE            DEFAULT SYSDATE,
    DTULTATU         	  DATE            DEFAULT SYSDATE,
    NRORGINCLUSAO    	  NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO   	  VARCHAR2(12)    DEFAULT '1' 					NULL,
    NRORGULTATU      	  NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU     	  VARCHAR2(12)    DEFAULT '1',
	   CONSTRAINT CKC_IDLOCALIDADE_PARAMGUIAIMP CHECK (IDLOCALIDADE IN ('F','E','M')),
       CONSTRAINT CKC_IDVENCIMENTODIAUTIL_PARAMG CHECK (IDVENCDIANAOUTIL IN ('A','P')),
       CONSTRAINT CKC_IDTPCALENDL_PARAMGUIAIMPLO CHECK (IDTPCALEND IN ('F','C','B')),
       CONSTRAINT CKC_IDATIVO_PARAMGUIAIMPLOCAL CHECK (IDATIVO IN ('S','N')),
	   CONSTRAINT PK_PARAMGUIAIMPLOCAL PRIMARY KEY (NRSEQIMPGUIALOCAL)
)
/

CREATE INDEX FIS00899_FK ON PARAMGUIAIMPLOCAL (CDIMPOSTO ASC)
/

ALTER TABLE PARAMGUIAIMPLOCAL 
   ADD CONSTRAINT FKFIS00899IMPOSTO FOREIGN KEY (CDIMPOSTO)
      REFERENCES IMPOSTO (CDIMPOSTO)
/

CREATE INDEX FIS00900_FK ON PARAMGUIAIMPLOCAL (CDFORMPGTO ASC)
/

ALTER TABLE PARAMGUIAIMPLOCAL 
   ADD CONSTRAINT FKFIS00900FORMPGTO FOREIGN KEY (CDFORMPGTO)
      REFERENCES FORMPGTO (CDFORMPGTO)
/

CREATE INDEX FIS00901_FK ON PARAMGUIAIMPLOCAL (CDFILIALCALEND ASC)
/

ALTER TABLE PARAMGUIAIMPLOCAL 
   ADD CONSTRAINT FKFIS00901FILIAL  FOREIGN KEY (CDFILIALCALEND)
      REFERENCES FILIAL (CDFILIAL)
/
