
/*------ ATD 371668 ------*/
if not exists(select 1 from OPCSISTCAD where codsis = 'LIF' and codopc = '1.33')
    insert into OPCSISTCAD(codsis,codopc,nomeopc,ativado,numeroativ,mediauso,numdemeses,usoultmes)
    values('LIF','1.33','Demonstrativo Apur.Simples Nac','S',0,0,0,0)
go


if not exists(select 1 from OPCSISTCAD where codsis = 'LIF' and codopc = '5.10')
    insert into OPCSISTCAD(codsis,codopc,nomeopc,ativado,numeroativ,mediauso,numdemeses,usoultmes)
    values('LIF','5.10','Faixa Tribut.Simples Nacional','S',0,0,0,0)
go


IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS WHERE xtype='U' AND name='FAIXATRIBUTACAOSIMPLESNACIONAL')
BEGIN
	CREATE TABLE FAIXATRIBUTACAOSIMPLESNACIONAL(
				ID              INT IDENTITY NOT NULL,
				SEGMENTO		NUMERIC (1,0), 
				VALORINICIAL	NUMERIC(15,2),
				VALORFINAL		NUMERIC(15,2),
				ALIQUOTA		NUMERIC(8,5),
				VALORDEDUCAO    NUMERIC(15,2),
				ICMS			NUMERIC(5,2),
				ISS				NUMERIC(5,2),
				IPI				NUMERIC(5,2),
				IRPJ			NUMERIC(5,2),
				CSLL			NUMERIC(5,2),
				PIS				NUMERIC(5,2),
				COFINS			NUMERIC(5,2),
				ALIQUOTAREDUZIDA  NUMERIC(8,5),
				LIMITE            NUMERIC(5,2),
				VIGENCIA          DATETIME,
				RUSUARIO          INT,
				ATUALIZADOEM      DATETIME,
				CONSTRAINT PK_FAIXATRIBUTACAOSIMPLESNACIONAL PRIMARY KEY (ID))
END
GO
