CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa ( sequencia integer NOT NULL, usuario integer NOT NULL, data date NOT NULL, hora time NOT NULL, data_pagamento date NOT NULL, data_credito date NOT NULL, observacao character varying NOT NULL, filial_for integer NOT NULL, fornecedor integer NOT NULL, selecionado_valor_duplicata_anterior numeric(18, 6) NOT NULL, selecionado_valor_juros_anterior numeric(18, 6) NOT NULL, selecionado_valor_multa_anterior numeric(18, 6) NOT NULL, selecionado_valor_desconto_anterior numeric(18, 6) NOT NULL, selecionado_valor_liquido_anterior numeric(18, 6) NOT NULL, selecionado_valor_pago_anterior numeric(18, 6) NOT NULL, selecionado_valor_restante_anterior numeric(18, 6) NOT NULL, total_pagamento numeric(18, 6) NOT NULL, total_aberto_anterior numeric(18, 6) NOT NULL, total_aberto_final numeric(18, 6) NOT NULL, total_credito_anterior numeric(18, 6) NOT NULL, total_credito_usado numeric(18, 6) NOT NULL, total_credito_final numeric(18, 6) NOT NULL, CONSTRAINT pk_pag_recibo_baixa PRIMARY KEY (sequencia) ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa IS 'Tabela do Recibo de baixa da duplicata a pagar'; CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa_pagamento ( recibo integer NOT NULL, sequencia integer NOT NULL, tipo_pagamento integer NOT NULL, valor numeric(18, 6) NOT NULL, CONSTRAINT pk_pag_recibo_baixa_pagamento PRIMARY KEY (recibo, sequencia), CONSTRAINT fk_pag_recibo_baixa_pagamento_recibo FOREIGN KEY (recibo) REFERENCES public.pag_recibo_baixa (sequencia) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa_pagamento OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa_pagamento IS 'Tabela do Recibo para o Pagamento de baixa da duplicata a pagar'; CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa_fluxo ( recibo integer NOT NULL, filial_mov integer NOT NULL, sequencia_fluxo integer NOT NULL, CONSTRAINT pk_pag_recibo_baixa_fluxo PRIMARY KEY (recibo, filial_mov, sequencia_fluxo), CONSTRAINT fk_pag_recibo_baixa_fluxo_recibo FOREIGN KEY (recibo) REFERENCES public.pag_recibo_baixa (sequencia) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa_fluxo OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa_fluxo IS 'Tabela para o Recibo com Sequencia do Fluxo de baixa da duplicata a pagar'; CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa_duplicata ( recibo integer NOT NULL, filial_dup integer NOT NULL, sequencia_duplicata integer NOT NULL, vlr_restante numeric(18, 6) NOT NULL, vlr_liquido numeric(18, 6) NOT NULL, CONSTRAINT pk_pag_recibo_baixa_duplicata PRIMARY KEY (recibo, filial_dup, sequencia_duplicata), CONSTRAINT fk_pag_recibo_baixa_duplicata_recibo FOREIGN KEY (recibo) REFERENCES public.pag_recibo_baixa (sequencia) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa_duplicata OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa_duplicata IS 'Tabela para o Recibo com Sequencia das duplicatas da baixa da duplicata a pagar'; CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa_cheque_recebido ( recibo integer NOT NULL, sequencia_cheque integer NOT NULL, CONSTRAINT pk_pag_recibo_baixa_cheque_recebido PRIMARY KEY (recibo, sequencia_cheque), CONSTRAINT fk_pag_recibo_baixa_cheque_recebido_recibo FOREIGN KEY (recibo) REFERENCES public.pag_recibo_baixa (sequencia) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa_cheque_recebido OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa_cheque_recebido IS 'Tabela para o Recibo com Sequencia dos Cheques Recebidos na baixa da duplicata a pagar'; CREATE TABLE IF NOT EXISTS public.pag_recibo_baixa_cheque_emitido ( recibo integer NOT NULL, banco integer NOT NULL, agencia character varying(10) NOT NULL, conta character varying(12) NOT NULL, numero_cheque character varying(14) NOT NULL, CONSTRAINT pk_pag_recibo_baixa_cheque_emitido PRIMARY KEY (recibo, banco, agencia, conta, numero_cheque), CONSTRAINT fk_pag_recibo_baixa_cheque_emitido_recibo FOREIGN KEY (recibo) REFERENCES public.pag_recibo_baixa (sequencia) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE RESTRICT ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.pag_recibo_baixa_cheque_emitido OWNER to postgres; COMMENT ON TABLE public.pag_recibo_baixa_cheque_emitido IS 'Tabela para o Recibo com os Cheques Emitidos na baixa da duplicata a pagar';