IF OBJECT_ID('EST_RPS') IS NULL
BEGIN
CREATE TABLE [dbo].[EST_RPS](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[DT_COMP] [date] NULL,
	[DT_EMIS] [date] NULL,
	[TP_RPS] [int] NULL,
	[NUM_RPS] [int] NULL,
	[SERIE_RPS] [int] NULL,
	[CD_NT_OP_SERVICO] [int] NULL,
	[REG_ESP_TRIB] [int] NULL,
	[OPT_SIMPLES] [int] NULL,
	[INCENT_FISCAL] [int] NULL,
	[STATUS] [int] NULL,
	[TRIB_MUN] [int] NULL,
	[TRIB_PREST] [int] NULL,
	[VLR_SERVICOS] [money] NULL,
	[VLR_DEDUCOES] [money] NULL,
	[VLR_PIS] [money] NULL,
	[VLR_COFINS] [money] NULL,
	[VLR_INSS] [money] NULL,
	[VLR_IR] [money] NULL,
	[VLR_CSLL] [money] NULL,
	[VLR_ISS] [money] NULL,
	[VLR_ISS_RET] [money] NULL,
	[VLR_OTR_RETENCOES] [money] NULL,
	[VLR_BASE_CALCULO] [money] NULL,
	[PERC_ALQ_ISS] [money] NULL,
	[VLR_LIQUIDO_NFSE] [money] NULL,
	[VLR_DESC_INCONDICIONADO] [money] NULL,
	[VLR_DESC_CONDICIONADO] [money] NULL,
	[VLR_RED_BC] [money] NULL,
	[VLR_REPASSE] [money] NULL,
	[VLR_APROX_IMPOSTO] [money] NULL,
	[PERC_ALQ_APROX_IMPOSTO] [money] NULL,
	[CNPJ_TOMADOR] [varchar](14) NULL,
	[RZ_TOMADOR] [varchar](100) NULL,
	[END_TOMADOR] [varchar](100) NULL,
	[NR_TOMADOR] [varchar](100) NULL,
	[CPL_TOMADOR] [varchar](100) NULL,
	[BAIRRO_TOMADOR] [varchar](100) NULL,
	[CD_MUN_TOMADOR] [varchar](100) NULL,
	[UF_TOMADOR] [varchar](100) NULL,
	[CEP_TOMADOR] [varchar](100) NULL,
	[CNPJ_PRESTADOR] [varchar](100) NULL,
	[INSC_MUN_PRESTADOR] [varchar](100) NULL,
	[END_PRESTADOR] [varchar](100) NULL,
	[NR_PRESTADOR] [varchar](100) NULL,
	[CPL_PRESTADOR] [varchar](100) NULL,
	[BAIRRO_PRESTADOR] [varchar](100) NULL,
	[UF_PRESTADOR] [varchar](100) NULL,
	[CEP_PRESTADOR] [varchar](100) NULL,
	[CD_PAIS_PRESTADOR] [varchar](100) NULL,
	[DDD_PRESTADOR] [varchar](100) NULL,
	[TEL_PRESTADOR] [varchar](100) NULL,
	[RZ_PRESTADOR] [varchar](100) NULL,
	[EMAIL_PRESTADOR] [varchar](100) NULL,
	[CIDADE_TOMADOR] [varchar](60) NULL,
	[CIDADE_PRESTADOR] [varchar](60) NULL,
 CONSTRAINT [PK_EST_RPS] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END

