CREATE TABLE public.ctb_apuracao_impostos_pis_cofins ( ano_mes integer NOT NULL, debito_pis numeric(18, 6) NOT NULL, debito_cofins numeric(18, 6) NOT NULL, credito_pis numeric(18, 6) NOT NULL, credito_cofins numeric(18, 6) NOT NULL, situacao character varying(1) NOT NULL, usuario integer NOT NULL, data_apuracao date NOT NULL, hora_apuracao time without time zone NOT NULL, terminal_ip character varying(15) NOT NULL, CONSTRAINT pk_ctb_apuracao_impostos_pis_cofins PRIMARY KEY (ano_mes) ) WITH ( OIDS=FALSE ); ALTER TABLE public.ctb_apuracao_impostos_pis_cofins OWNER TO postgres; CREATE TABLE public.ctb_apuracao_impostos_pis_cofins_credito ( ano_mes integer NOT NULL, ano_mes_referencia integer NOT NULL, base numeric(18, 6) NOT NULL, valor_pis_mes numeric(18, 6) NOT NULL, valor_cofins_mes numeric(18, 6) NOT NULL, perc_referencia numeric(18, 6) NOT NULL, valor_pis numeric(18, 6) NOT NULL, valor_cofins numeric(18, 6) NOT NULL, CONSTRAINT pk_ctb_apuracao_impostos_pis_cofins_credito PRIMARY KEY (ano_mes, ano_mes_referencia), CONSTRAINT fk_ctb_apuracao_impostos_pis_cofins_credito_ano_mes FOREIGN KEY (ano_mes) REFERENCES public.ctb_apuracao_impostos_pis_cofins (ano_mes) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) WITH ( OIDS=FALSE ); ALTER TABLE public.ctb_apuracao_impostos_pis_cofins_credito OWNER TO postgres; CREATE TABLE public.ctb_apuracao_impostos_pis_cofins_credito_depreciacao ( ano_mes integer NOT NULL, conta_contabil numeric(16,0) NOT NULL, descricao character varying(100) NOT NULL, base numeric(18, 6) NOT NULL, valor_pis numeric(18, 6) NOT NULL, valor_cofins numeric(18, 6) NOT NULL, CONSTRAINT pk_ctb_apuracao_impostos_pis_cofins_credito_depreciacao PRIMARY KEY (ano_mes, conta_contabil), CONSTRAINT fk_ctb_apuracao_impostos_pis_cofins_credito_depreciacao_ano_mes FOREIGN KEY (ano_mes) REFERENCES public.ctb_apuracao_impostos_pis_cofins (ano_mes) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) WITH ( OIDS=FALSE ); ALTER TABLE public.ctb_apuracao_impostos_pis_cofins_credito_depreciacao OWNER TO postgres; CREATE TABLE public.ctb_apuracao_impostos_pis_cofins_debito ( ano_mes integer NOT NULL, ano_mes_referencia integer NOT NULL, faturamento_bruto numeric(18, 6) NOT NULL, faturamento_publico numeric(18, 6) NOT NULL, perc_referencia numeric(18, 6) NOT NULL, base numeric(18, 6) NOT NULL, retencao numeric(18, 6) NOT NULL, base_liquido numeric(18, 6) NOT NULL, valor_pis numeric(18, 6) NOT NULL, valor_cofins numeric(18, 6) NOT NULL, CONSTRAINT pk_ctb_apuracao_impostos_pis_cofins_debito PRIMARY KEY (ano_mes, ano_mes_referencia), CONSTRAINT fk_ctb_apuracao_impostos_pis_cofins_credito_ano_mes FOREIGN KEY (ano_mes) REFERENCES public.ctb_apuracao_impostos_pis_cofins (ano_mes) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) WITH ( OIDS=FALSE ); ALTER TABLE public.ctb_apuracao_impostos_pis_cofins_debito OWNER TO postgres;