IF OBJECT_ID('PDV_CUPOM_NAO_FISCAL_EST_RPS_IT') IS NULL
BEGIN
CREATE TABLE [dbo].[PDV_CUPOM_NAO_FISCAL_EST_RPS_IT](
	[CD_CTR] [bigint] NOT NULL,
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_CX] [int] NOT NULL,
	[CD_CTR_IT] [int] NOT NULL,
	[CD_PROD] [int] NOT NULL,
	[QT_IT] [int] NULL,
	[VLR_UNITARIO] [money] NULL,
	[VLR_DESCONTO] [money] NULL,
	[VLR_TOTAL] [money] NULL,
 CONSTRAINT [PDV_CUPOM_NAO_FISCAL_EST_RPS_IT_idx] PRIMARY KEY CLUSTERED 
(
	[CD_CTR] ASC,
	[CD_EMP] ASC,
	[CD_FILIAL] ASC,
	[CD_CX] 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_CUPOM_NAO_FISCAL_EST_RPS_IT]  WITH CHECK ADD  CONSTRAINT [PDV_CUPOM_NAO_FISCAL_EST_RPS_IT_fk] FOREIGN KEY([CD_CTR], [CD_EMP], [CD_FILIAL], [CD_CX])
REFERENCES [dbo].[PDV_CUPOM_NAO_FISCAL_EST_RPS] ([CD_CTR], [CD_EMP], [CD_FILIAL], [CD_CX])
ON DELETE CASCADE

ALTER TABLE [dbo].[PDV_CUPOM_NAO_FISCAL_EST_RPS_IT] CHECK CONSTRAINT [PDV_CUPOM_NAO_FISCAL_EST_RPS_IT_fk]
END
