alter  FUNCTION dbo.fn_fco_cir_otros_ing
(    
    @pch_compania char(4),    
    @psi_anio smallint,    
    @pch_trabajador char(10)    
)    
RETURNS decimal(19,6)    
AS    
BEGIN    
    DECLARE     
        @vch_agr_otring char(3),  
        @vdc_otring decimal(19,6),    
        @vsi_dif_dias smallint,    
        @vdt_hasta smalldatetime,    
        @vdt_desde smalldatetime,    
        @vdc_tope_che decimal(19,6),    
        @vdc_sal_minimo  decimal(19,6),                
        @vch_var_cheque  varchar(15)    
            
    /* PARÁMETRO DEL VALOR DE SALARIOS PENSIONES */    
    /* SCN Mayo 4 de 2007 */  
    SELECT @vch_agr_otring = dato FROM vw_fdt_parametros    
    WHERE compania = @pch_compania AND parametro = 'retencion' AND secuencia = 6   
      
   /* VALOR DE LOS Pensiones */    
    SELECT @vdc_otring =    
      acum_imp_mes_01 + acum_imp_mes_02 + acum_imp_mes_03 + acum_imp_mes_04 +    
      acum_imp_mes_05 + acum_imp_mes_06 + acum_imp_mes_07 + acum_imp_mes_08 +    
      acum_imp_mes_09 + acum_imp_mes_10 + acum_imp_mes_11 + acum_imp_mes_12    
    FROM acumulados_mensuales    
    WHERE compania = @pch_compania     
      AND trabajador = @pch_trabajador    
      AND agr_conceptos = @vch_agr_otring 
      AND concepto = 0    
      AND anio = @psi_anio    
  
    
    RETURN IsNull(@vdc_otring, 0)    
END    
  
