ALTER TABLE Trn_Facturas ADD ImpAviTab MONEY DEFAULT(0) NOT NULL,TarifaAvta DECIMAL(14,4) DEFAULT(0) NOT NULL,CodTarifAvta VARCHAR(4)
,VrBomberil MONEY DEFAULT(0) NOT NULL,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL,CodTarifBom VARCHAR(4),VrAutRetIat MONEY DEFAULT(0) NOT NULL,VrAutRetBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_Factcon ADD ImpAviTab MONEY DEFAULT(0) NOT NULL,TarifaAvta DECIMAL(14,4) DEFAULT(0) NOT NULL,CodTarifAvta VARCHAR(4)
,VrBomberil MONEY DEFAULT(0) NOT NULL,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL,CodTarifBom VARCHAR(4),VrAutRetIat MONEY DEFAULT(0) NOT NULL,VrAutRetBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_DevFcr ADD ImpAviTab MONEY DEFAULT(0) NOT NULL,TarifaAvta DECIMAL(14,4) DEFAULT(0) NOT NULL,VrBomberil MONEY DEFAULT(0) NOT NULL,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL
,VrAutRetIat MONEY DEFAULT(0) NOT NULL,VrAutRetBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_DevFco ADD ImpAviTab MONEY DEFAULT(0) NOT NULL,TarifaAvta DECIMAL(14,4) DEFAULT(0) NOT NULL,VrBomberil MONEY DEFAULT(0) NOT NULL,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL
,VrAutRetIat MONEY DEFAULT(0) NOT NULL,VrAutRetBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_Kardex ADD TarifaIat DECIMAL(14,4) DEFAULT(0) NOT NULL,VrAviTab MONEY DEFAULT(0) NOT NULL,CodTarIat VARCHAR(4)
,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL,VrSobBom MONEY DEFAULT(0) NOT NULL,CodTarBom VARCHAR(4)
GO
ALTER TABLE Trn_TraFacRemesas ADD TarifaIat DECIMAL(14,4) DEFAULT(0) NOT NULL,VrAviTab MONEY DEFAULT(0) NOT NULL,CodTarIat VARCHAR(4)
,TarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL,VrSobBom MONEY DEFAULT(0) NOT NULL,CodTarBom VARCHAR(4),VrAutoIat MONEY DEFAULT(0) NOT NULL,VrAutoBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE tm_TraRemFact ADD tmTarifIat DECIMAL(14,4) DEFAULT(0) NOT NULL,tmVrAviTab MONEY DEFAULT(0) NOT NULL,tmCdTarifIat VARCHAR(4)
,tmTarifBom DECIMAL(14,4) DEFAULT(0) NOT NULL,tmVrSobBom MONEY DEFAULT(0) NOT NULL,tmCdTarifBom VARCHAR(4),tmVrAutoIat MONEY DEFAULT(0) NOT NULL,tmVrAutoBom MONEY DEFAULT(0) NOT NULL
GO
ALTER TABLE tm_Kdex ADD tmTarifaIat DECIMAL(14,4) DEFAULT(0) NOT NULL,tmVrAviTab MONEY DEFAULT(0) NOT NULL,tmCodTarIat VARCHAR(4)
,tmTarifaBom DECIMAL(14,4) DEFAULT(0) NOT NULL,tmVrSobBom MONEY DEFAULT(0) NOT NULL,tmCodTarBom VARCHAR(4)
GO
--Ene 11/2024
INSERT INTO adm_Opciones (IdOpc,Opcion,TipoDato,Valor,NivUp,nModulo)
 VALUES ('ABF','IMPUESTO DE AVISOS / TABLEROS Y BOMBERIL EN FACTURACION','BOOLEAN','0',5,'MAIN')
GO
INSERT INTO ClaseSub (IdClase,NomClase,Inactivo)
 VALUES ('0035','IMPUESTO AVISOS Y TABLEROS',0)
INSERT INTO ClaseSub (IdClase,NomClase,Inactivo)
 VALUES ('0036','SOBRETASA BOMBERIL',0)
GO
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0023','IMPUESTO DE AVISOS Y TABLEROS',0)
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0024','SOBRETASA BOMBERIL',0)
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0025','AUTORRETENCION AVISOS (DB)',0)
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0026','AUTORRETENCION AVISOS (CR)',0)
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0027','AUTORRETENCION BOMBERIL (DB)',0)
INSERT INTO ClaseDiv (IdClase,NomClase,Inactivo)
 VALUES ('0028','AUTORRETENCION BOMBERIL (CR)',0)
GO

DECLARE @TipoDoc VARCHAR(3)
DECLARE @TipoMov VARCHAR(1)
DECLARE TiposDoc_cursor CURSOR FOR
SELECT IdDoc FROM Sys_TiposDoc
WHERE (SUBSTRING(IdDoc,1,2)= 'FC' OR SUBSTRING(IdDoc,1,2)= 'FO' OR SUBSTRING(IdDoc,1,2)= 'DO'
 OR SUBSTRING(IdDoc,1,2)= 'DF') AND IdDoc<>'DOP' AND IdDoc<>'DFI'
OPEN TiposDoc_cursor
FETCH NEXT FROM TiposDoc_cursor INTO @TipoDoc
WHILE @@FETCH_STATUS = 0
BEGIN
 IF (SUBSTRING(@TipoDoc,1,2)= 'DO' OR SUBSTRING(@TipoDoc,1,2)= 'DF')
  SET @TipoMov='C'
 ELSE
  SET @TipoMov='D'
 
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,34,'IMPUESTO AVISOS Y TABLEROS',@TipoMov)
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,35,'SOBRETASA BOMBERIL',@TipoMov)
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,36,'AUTORRETENCION AVISOS',@TipoMov)
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,37,'AUTORRETENCION AVISOS - CTA POR PAGAR','C')
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,38,'AUTORRETENCION BOMBERIL','D')
 INSERT INTO Sys_TiposDocCue (IdDoc,IdClase,ClaseCuenta,TipoMov)
  VALUES (@TipoDoc,39,'AUTORRETENCION BOMBERIL  - CTA POR PAGAR','C')
 FETCH NEXT FROM TiposDoc_cursor INTO @TipoDoc
END
CLOSE TiposDoc_cursor
DEALLOCATE TiposDoc_cursor
GO
