-- parafiscales
update fco_integrada_Det
Set 
    aporte_ccf = ibc_ccf * tarifa_ccf, 
    aporte_sena = ibc_ccf * tarifa_sena, 
    aporte_icbf = ibc_ccf * tarifa_icbf
where anio = 2006 and mes = 10


select centro_trabajo, aporte_arp, 
case centro_trabajo when 1 then 0.00522 when 2 then 0.01044 when 3 then 0.02436 END

update fco_integrada_det
set tarifa_arp = case centro_trabajo when 1 then 0.00522 when 2 then 0.01044 when 3 then 0.02436 else 0 END
where compania = '30'
and anio = 2006
and mes = 10

select * from fco_integrada_det
where compania = '30'
and anio = 2006
and mes = 10
and secuencia = 291



update fco_integrada_det
set aporte_arp = Round((ibc_arp * tarifa_arp - 1)/100,0)*100
where compania = '30'
and anio = 2006
and mes = 10

select* from fdt_parametros where 

UPDATE fco_integrada_det    
SET aporte_ARP =     
(SELECT Round((importe - 1)/100,0)*100 FROM dbo.fntb_acum_mes_agr('30', 'S09', 2006, 10) x    
WHERE x.trabajador = fco_integrada_det.trabajador AND x.importe <> 0)    
WHERE compania = '30' AND anio = 2006 AND mes = 10 AND (sucursal = '' OR '' = '')    
AND EXISTS (SELECT 1 FROM dbo.fntb_acum_mes_agr('30', 'S09', 2006, 10) x    
WHERE x.trabajador = fco_integrada_det.trabajador AND x.importe <> 0)    

update fco_integrada_det
SET aporte_afp = round((ibc_afp * tarifa_afp - 1) / 100, 0) * 100
where compania = '30'
and anio = 2006
and mes = 10
AND aporte_afp <> round((ibc_afp * tarifa_afp - 1) / 100, 0) * 100


SELECT * FROM trans_30_2552
where trabajador = '  79788745'
