コード例 #1
0
        public double calculate()
        {
            var sbc = _functionParams.CalculationBaseResult.Overdraft.Employee.SBCMax25UMA;
            //Originalmente el sbc debe de tomarse del 25 tope UMA, pero en el caso de ser 0,
            //deberá tomarse el Fijo, siempre y cuando el cálculo sea para obligaciones
            var    saldiariovigente = new SalDiarioVigenteFunction(_functionParams).calculate();
            double salariominimo    = 0;

            if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneA)
            {
                salariominimo = new SalariosMinimos_ZonaA(_functionParams).calculate();
            }
            else if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneB)
            {
                salariominimo = new SalariosMinimos_ZonaB(_functionParams).calculate();
            }
            else if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneC)
            {
                salariominimo = new SalariosMinimos_ZonaC(_functionParams).calculate();
            }

            var condition = saldiariovigente > salariominimo;

            if (sbc <= 0 && (_functionParams.CalculationBaseResult.IsLiability || condition))
            {
                sbc = _functionParams.CalculationBaseResult.Overdraft.Employee.SBCFixedPart;
            }

            var result = Convert.ToDouble(sbc);

            return(result);
        }
コード例 #2
0
        public double calculate()
        {
            var result = 0.0;

            //Horas por turno del empleado
            var workshiftHours = new HorasPorTurnoFunction(_functionParams).calculate();

            //Salario Minimo
            var minimunSalary = 0.0;

            if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneA)
            {
                minimunSalary = new SalariosMinimos_ZonaA(_functionParams).calculate();
            }
            else if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneB)
            {
                minimunSalary = new SalariosMinimos_ZonaB(_functionParams).calculate();
            }
            else if (_functionParams.CalculationBaseResult.Overdraft.Employee.SalaryZone == SalaryZone.ZoneC)
            {
                minimunSalary = new SalariosMinimos_ZonaC(_functionParams).calculate();
            }

            //Period
            var periodEmployeeSalaries = new List <PeriodEmployeeSalary>();
            var initialDate            = _functionParams.CalculationBaseResult.Overdraft.PeriodDetail.InitialDate;
            var finalDate = _functionParams.CalculationBaseResult.Overdraft.PeriodDetail.FinalDate;

            //Salarios diarios
            var historicEmployeeSalaryAdjustments = _functionParams.CalculationBaseResult.Overdraft.Employee.HistoricEmployeeSalaryAdjustments.
                                                    Where(p => p.ModificationDate >= initialDate && p.ModificationDate <= finalDate);

            if (historicEmployeeSalaryAdjustments.Any())
            {
                historicEmployeeSalaryAdjustments.ForEach(historic =>
                {
                    periodEmployeeSalaries.Add(new PeriodEmployeeSalary()
                    {
                        ApplicationDate = historic.ModificationDate, DiarySalary = historic.DailySalary
                    });
                });
            }
            else
            {
                var actualDailySalary = new SalDiarioVigenteFunction(_functionParams).calculate();
                periodEmployeeSalaries.Add(new PeriodEmployeeSalary()
                {
                    ApplicationDate = new DateTime(1900, 1, 1), DiarySalary = Convert.ToDecimal(actualDailySalary)
                });
            }

            //HE Exempts
            var heExempts = GetHEExempts();

            result = He_TopesXSemana(heExempts, minimunSalary, periodEmployeeSalaries, workshiftHours);

            return(result);
        }