
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_RC_PGTO_PDV_ITENS_PAGOS_RC_PGTO_PDV]') AND parent_object_id = OBJECT_ID(N'[dbo].[RC_PGTO_PDV_ITENS_PAGOS]'))
ALTER TABLE [dbo].[RC_PGTO_PDV_ITENS_PAGOS] DROP CONSTRAINT [FK_RC_PGTO_PDV_ITENS_PAGOS_RC_PGTO_PDV]
GO


/****** Object:  Table [dbo].[RC_PGTO_PDV_ITENS_PAGOS]    Script Date: 07/12/2012 15:13:12 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RC_PGTO_PDV_ITENS_PAGOS]') AND type in (N'U'))
DROP TABLE [dbo].[RC_PGTO_PDV_ITENS_PAGOS]
GO



/****** Object:  Table [dbo].[RC_PGTO_PDV_ITENS_PAGOS]    Script Date: 07/12/2012 15:13:12 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[RC_PGTO_PDV_ITENS_PAGOS](
	[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
	[CD_CTR_PGTO] [int] NULL,
	[CD_RC_DEB] [int] NULL,
	[CD_FILIAL] [int] NULL,
	[NR_FATURA] [varchar](50) NULL,
	[VLR_JURO] [money] NULL,
	[VLR_TOTAL] [money] NULL,
	[VLR_PAGO] [money] NULL,
	[TP_DOC] [int] NULL,
	[FATURA] [bit] NULL,
	[VLR_TOTAL_COM_JURO] [money] NULL,
	[VLR_DESCONTO] [money] NULL,
	[VLR_SALDO] [money] NULL,
 CONSTRAINT [PK_RC_PGTO_PDV_ITENS_PAGOS] PRIMARY KEY CLUSTERED 
(
	[CD_CTR] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[RC_PGTO_PDV_ITENS_PAGOS]  WITH CHECK ADD  CONSTRAINT [FK_RC_PGTO_PDV_ITENS_PAGOS_RC_PGTO_PDV] FOREIGN KEY([CD_CTR_PGTO])
REFERENCES [dbo].[RC_PGTO_PDV] ([CD_CTR_PGTO])
GO

ALTER TABLE [dbo].[RC_PGTO_PDV_ITENS_PAGOS] CHECK CONSTRAINT [FK_RC_PGTO_PDV_ITENS_PAGOS_RC_PGTO_PDV]
GO


