Пример #1
0
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            var performanceCodes = context.PerformanceInformation.Performances.Select(p => p.Code).Distinct();

            foreach (var performanceCode in performanceCodes)
            {
                var performances = context.PerformanceInformation.Performances.Where(p => p.Code == performanceCode);

                var wage        = performances.FirstOrDefault()?.Value;
                var description = performances.FirstOrDefault()?.Description;
                var hours       = performances.Sum(p => p.Hours);
                var days        = performances.Sum(p => p.Days);
                var value       = hours * wage;

                //Add a calculation result for this area
                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       performanceCode.ToString(), description,
                                                       days: days,
                                                       hours: hours,
                                                       value: value.HasValue ? value.Value : 0));
            }

            return(calculations);
        }
Пример #2
0
        /// <summary>
        /// Bedrijfsvoorheffing
        /// </summary>
        /// <param name="context"></param>
        /// <param name="componentContext"></param>
        /// <returns></returns>
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            var taxableWage = componentContext.AmountForCalculationArea;
            var payrollTax  = 0.0d;

            //Calculate annual bruto income
            var annualBrutoWage =
                CalculateLeastCommonDenominator(context, componentContext, taxableWage, 15.00d) * 12; //

            //Calculate worker taxes
            var workerTaxes = CalculateWorkerTaxes(context, componentContext, annualBrutoWage);

            //Netto annual wage = bruto - taxes
            var annualNettoWage = annualBrutoWage - workerTaxes;

            //Calculate basic taxes
            var basicTaxes = CalculateBasicTaxes(context, componentContext, annualNettoWage);

            //Calculate deductions on basic taxes
            var deductions = CalculateDeductions(context, componentContext);

            var annualTaxes = basicTaxes + deductions;

            payrollTax = annualTaxes / 12;

            calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                   "BVH", "Bedrijfsvoorheffing", value: -payrollTax));

            return(calculations);
        }
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            // If the person has a low income (small wage), there's an additional discount on the Witholding Tax (Bedrijfsvoorheffing)
            if (componentContext.AmountForCalculationArea <= 2291.80d)
            {
                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       "DeductionForSmallWages", "Vermindering BVH van 6.46", value: 6.46d));
            }

            return(calculations);
        }
Пример #4
0
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            var bruto = componentContext.AmountForCalculationArea;

            var socialWorkBonus = componentContext.CalculationResults.FirstOrDefault(r => r.Code == "SocialWorkBonus");

            if (socialWorkBonus != null)
            {
                var fiscalWorkBonus = socialWorkBonus.Value * 0.1440;
                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       "FiscalWorkBonus", "Fiscale werkbonus", value: fiscalWorkBonus));
            }

            return(calculations);
        }
Пример #5
0
        public Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();
            var bruto        = componentContext.AmountForCalculationArea;

            var bonus = 0.0d;

            if (bruto <= 1501.82d)
            {
                switch (context.EmployeeInformation.EmployeeType)
                {
                case EmployeeType.WhiteCollar:
                    bonus = 183.97d;
                    break;

                case EmployeeType.BlueCollar:
                    bonus = 198.69d;
                    break;
                }
            }
            else if (1501.82d <= bruto && bruto <= 2385.41d)
            {
                switch (context.EmployeeInformation.EmployeeType)
                {
                case EmployeeType.WhiteCollar:
                    bonus = 183.97d - (0.2082 * (bruto - 1501.82d));
                    break;

                case EmployeeType.BlueCollar:
                    bonus = 198.69d - (0.2249 * (bruto - 1501.82d));
                    break;
                }
            }
            else if (2385.41d < bruto)
            {
                bonus = 0.0d;
            }

            calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                   "SocialWorkBonus", "Sociale werkbonus", value: bonus));

            return(Task.FromResult(calculations));
        }
Пример #6
0
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations     = new List <CalculationResult>();
            var dayCompensations =
                context.PerformanceInformation.Performances.Where(p => p.Type == PerformanceType.BusinessDayOnSite);

            //TODO group by value
            if (dayCompensations.Any())
            {
                var amountOfDays     = dayCompensations.Count();
                var compensationRate = dayCompensations.FirstOrDefault().Value;
                var value            = amountOfDays * compensationRate;

                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       "DayCompensation", "Bruto Dagvergoeding", value: value));
            }

            return(calculations);
        }
Пример #7
0
        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            //The bruto base salary for the employee
            var brutoSalary = context.PerformanceInformation.BaseSalary;
            //The number of days that the employee is supposed to work
            var performanceBaseline = context.PerformanceInformation.PerformanceBaseline;
            //The amount of hours/day that the employee is supposed to work
            var contractualHoursPerDay = context.PerformanceInformation.ContractualHoursPerDay;
            //The hourly rate for the employee
            var hourlyRateForEmployee = (brutoSalary / performanceBaseline) / contractualHoursPerDay;

            var performanceCodes = context.PerformanceInformation.Performances
                                   .Where(p =>
                                          p.Type == PerformanceType.BusinessDay ||
                                          p.Type == PerformanceType.Illness ||
                                          p.Type == PerformanceType.WorkingHoliday ||
                                          p.Type == PerformanceType.Holiday)
                                   .Select(p => p.Code)
                                   .Distinct();

            foreach (var performanceCode in performanceCodes)
            {
                var performances = context.PerformanceInformation.Performances.Where(p => p.Code == performanceCode);
                var hours        = performances.Sum(p => p.Hours);
                var description  = performances.FirstOrDefault()?.Description;
                var days         = performances.Sum(p => p.Days);

                var value = hourlyRateForEmployee * hours;

                //Add a calculation result for this area
                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       performanceCode.ToString(), description,
                                                       days: days,
                                                       hours: hours,
                                                       value: value));
            }

            return(calculations);
        }
Пример #8
0
        public Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();
            var bruto        = componentContext.AmountForCalculationArea;

            var contributionPct = 1d;

            if (context.EmployeeInformation.EmployeeType == EmployeeType.BlueCollar)
            {
                contributionPct = 1.08d;
            }

            bruto = bruto * contributionPct;

            var contribution = -(bruto * 13.07 / 100);

            calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order, "RSZ",
                                                   "RSZ bijdrage", value: contribution));

            return(Task.FromResult(calculations));
        }
Пример #9
0
        // TODO safety check did you mean PluginService?

        public async Task <List <CalculationResult> > Calculate(MuntContext context, ComponentContext componentContext)
        {
            var calculations = new List <CalculationResult>();

            var advances = await this.advancesService.GetAdvancesForEmployeeId(context.EmployeeInformation.Id);

            var advancesAlreadyPaidInThisPeriod = advances.Where(a =>
                                                                 context.CalculationInformation.StartDate <= a.PaidOn &&
                                                                 a.PaidOn <= context.CalculationInformation.EndDate);

            if (!advancesAlreadyPaidInThisPeriod.Any())
            {
                return(calculations); // Nothing to do, short circuit here
            }
            foreach (var advance in advancesAlreadyPaidInThisPeriod.OrderBy(a => a.PaidOn))
            {
                calculations.Add(CalculationResult.New(componentContext.CalculationAreaOrder, componentContext.Order,
                                                       "Advances", $"Voorschot {advance.PaidOn.DateTime.ToShortDateString()}", value: -(advance.Amount)));
            }

            return(calculations);
        }