/****** Object:  Table [dbo].[EST_PROD_CPL_ACERTO_CUSTO]    Script Date: 07/23/2013 12:33:29 ******/
IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PROD_CPL_ACERTO_CUSTO]') AND type in (N'U'))
begin
	CREATE TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO](
		[CD_CTR] [int] NOT NULL,
		[CD_EMP] [int] NOT NULL,
		[CD_FILIAL] [int] NOT NULL,
		[CD_PROD] [int] NOT NULL,
		[VLR_CUSTO_ACERTO] [money] NOT NULL,
		[CD_USU] [int] NOT NULL,
		[DT_MOV] [datetime] NOT NULL,
		[DT_CAD] [datetime] NOT NULL,
	 CONSTRAINT [PK_EST_PROD_CPL_ACERTO_CUSTO] 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]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO]  WITH CHECK ADD  CONSTRAINT [FK_EST_PROD_CPL_ACERTO_CUSTO_EST_PROD_CPL] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_PROD])
	REFERENCES [dbo].[EST_PROD_CPL] ([CD_EMP], [CD_FILIAL], [CD_PROD])

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] CHECK CONSTRAINT [FK_EST_PROD_CPL_ACERTO_CUSTO_EST_PROD_CPL]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_CD_CTR]  DEFAULT ((0)) FOR [CD_CTR]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_CD_PROD]  DEFAULT ((0)) FOR [CD_PROD]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_VLR_CUSTO_ACERTO]  DEFAULT ((0)) FOR [VLR_CUSTO_ACERTO]

	ALTER TABLE [dbo].[EST_PROD_CPL_ACERTO_CUSTO] ADD  CONSTRAINT [DF_EST_PROD_CPL_ACERTO_CUSTO_CD_USU]  DEFAULT ((0)) FOR [CD_USU]
end