IF OBJECT_ID('PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB') IS NULL
	BEGIN 

		CREATE TABLE [dbo].[PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB](
			[CD_EMP] [int] NOT NULL,
			[CD_FILIAL] [int] NOT NULL,
			[CD_VD] [int] NOT NULL,
			[CD_IT] [int] NOT NULL,
			[CD_CTR] [int] NOT NULL,
		 CONSTRAINT [PK_PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB] PRIMARY KEY CLUSTERED 
		(
			[CD_EMP] ASC,
			[CD_FILIAL] ASC,
			[CD_VD] ASC,
			[CD_IT] ASC,
			[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].[PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB]  WITH CHECK ADD  CONSTRAINT [FK_PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB_EST_PROD_CPL_TRIB_ST_DEB] FOREIGN KEY([CD_CTR])
		REFERENCES [dbo].[EST_PROD_CPL_TRIB_ST_DEB] ([CD_CTR])
		ON UPDATE CASCADE
		ON DELETE CASCADE		

		ALTER TABLE [dbo].[PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB] CHECK CONSTRAINT [FK_PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB_EST_PROD_CPL_TRIB_ST_DEB]
		
		ALTER TABLE [dbo].[PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB]  WITH CHECK ADD  CONSTRAINT [FK_PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB_PDV_VD_IT] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_VD], [CD_IT])
		REFERENCES [dbo].[PDV_VD_IT] ([CD_EMP], [CD_FILIAL], [CD_VD], [CD_IT])
		ON UPDATE CASCADE
		
		ALTER TABLE [dbo].[PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB] CHECK CONSTRAINT [FK_PDV_VD_IT_EST_PROD_CPL_TRIB_ST_DEB_PDV_VD_IT]
		
	END