コード例 #1
0
        private double CalculateBasicTaxesDeductionOnBasicTaxes(MuntContext context, ComponentContext componentContext, double basicTaxes)
        {
            var basicTaxesWithDeduction = basicTaxes;

            if (true)     //TODO Check from context whether the employee is an inhabitant of Belgium
            {
                if (true) //TODO Check from context whether the employee is single or has a partner with his/her own income (not on charge)
                {
                    basicTaxesWithDeduction -= 1655.83d;
                }
                else
                {
                    //Subcalucation based on 30pct of the annualBrutoWage
                    //max = 10490.00d
                    //calc
                }
            }
            else //The inhabitant is not a citizen of Belgium
            {
                //for reference, nothing changes
                basicTaxesWithDeduction = basicTaxes;
            }

            return(basicTaxesWithDeduction);
        }
コード例 #2
0
        private double CalculateDeductionsForNonCitizens(MuntContext context, ComponentContext componentContext)
        {
            var deductions = 0.0d;

            if (false)//Employee has group insurance
            {
            }

            if (false)//Employee has insurance for old age or premature death
            {
            }

            if (false)//Employee has pension arrangement
            {
            }

            if (false)//Employee has overtime bonus
            {
            }

            if (false)//Employee has workbonus
            {
            }

            return(deductions);
        }
コード例 #3
0
        private double CalculateDeductions(MuntContext context, ComponentContext componentContext)
        {
            var deductions = 0.0d;

            if (true) //Check if employee is a belgian citizen
            {
                deductions = CalculateDeductionsForCitizens(context, componentContext);
            }
            else if (true)//employee is not a citizen,
            {
                deductions = CalculateDeductionsForNonCitizens(context, componentContext);
            }

            deductions = Math.Round(deductions, 2);

            if (false) //Employee is employed
            {
                if (deductions <= 2417.96)
                {
                    deductions -= 77.52d;
                }
            }
            else if (false) //Employee is company director
            {
                if (deductions <= 2157.12d)
                {
                    deductions -= 77.52d;
                }
            }

            return(Math.Round(deductions, 2));
        }
コード例 #4
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);
        }
コード例 #5
0
        private double CalculateBasicTaxesForIndependendOrUnchargedPartner(MuntContext context, ComponentContext componentContext, double annualNettoWage)
        {
            var taxesByScale = 0.0d;

            if (0.01d <= annualNettoWage && annualNettoWage < 11070.00d)
            {
                taxesByScale = annualNettoWage * 0.2675;
            }
            else if (11070.00d <= annualNettoWage && annualNettoWage < 12140.00d)
            {
                taxesByScale = 2961.23 + ((annualNettoWage - 11070.00d) * 0.3210);
            }
            else if (12140.00d <= annualNettoWage && annualNettoWage < 17590.00d)
            {
                taxesByScale = 3304.70 + ((annualNettoWage - 12140.00d) * 0.4280);
            }
            else if (17590.00d <= annualNettoWage && annualNettoWage < 38840.00d)
            {
                taxesByScale = 5637.30 + ((annualNettoWage - 17590.00d) * 0.4815);
            }
            else if (38840.00d <= annualNettoWage)
            {
                taxesByScale = 15869.18 + ((annualNettoWage - 38840.00d) * 0.5350);
            }

            return(taxesByScale);
        }
コード例 #6
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);
        }
コード例 #7
0
        private double CalculateWorkerTaxesForEmployee(MuntContext context, ComponentContext componentContext, double annualBrutoWage)
        {
            var workerTaxes = 0.0d;

            if (annualBrutoWage < 8620.00d)
            {
                //30pct
                workerTaxes = annualBrutoWage * 0.30;
            }
            else if (8260.00d <= annualBrutoWage && annualBrutoWage < 20360.00d)
            {
                //2586.00 + 11pct of anything above 8260.00d
                workerTaxes = 2586.00 + (annualBrutoWage - 8260.00d) * 0.11;
            }
            else if (20360.00d <= annualBrutoWage && annualBrutoWage < 35133.33d)
            {
                //2586.00 + 3pct of anything above 20360.00d
                workerTaxes = 3877.40 + (annualBrutoWage - 20360.00d) * 0.03;
            }
            else if (35133.33d <= annualBrutoWage)
            {
                workerTaxes = 4320.00d;
            }

            return(workerTaxes);
        }
コード例 #8
0
        private double CalculateDeductionsForCitizens(MuntContext context, ComponentContext componentContext)
        {
            var deductions = 0.0d;

            //charges on family
            if (true)
            {
                deductions += CalculateDeductionForChargesOfFamily(context, componentContext);
            }

            if (context.EmployeeInformation.NumberOfChildrenOnCharge > 0)//Check if any children on charge
            {
                deductions += CalculateDeductionChildrenOnCharge(context, componentContext);
            }

            //personal contributions

            //overtime

            //low income

            //low income govornment sector

            //working bonus

            return(deductions);
        }
コード例 #9
0
        private double CalculateDeductionForChargesOfFamilyPartnerNoIncome(MuntContext context, ComponentContext componentContext)
        {
            var deduction = 0.0d;

            //TODO

            return(deduction);
        }
コード例 #10
0
        /// <summary>
        /// This calculation will take the bruto wage and round it down to the lowest dividend of 15.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="componentContext"></param>
        /// <param name="brutoWage"></param>
        /// <param name="dividendBase"></param>
        /// <returns></returns>
        private double CalculateLeastCommonDenominator(MuntContext context, ComponentContext componentContext, double brutoWage, double dividendBase = 15.00d)
        {
            //First take the dividend  for the current wage without rest
            var dividend = Math.Floor(brutoWage / dividendBase);
            //Next, calculate the bruto wage according to this scale
            var brutoWageAccordingToDivided = dividend * dividendBase;

            return(brutoWageAccordingToDivided);
        }
コード例 #11
0
        private double CalculateDeductionForChargesOfFamilySingleOrPartnerIncome(MuntContext context, ComponentContext componentContext)
        {
            var deduction = 0.0d;

            if (false)//Employee is single or Partner has income
            {
                deduction = -300.0d;
            }

            return(deduction);
        }
コード例 #12
0
        private double CalculateDeductionChildrenOnCharge(MuntContext context, ComponentContext componentContext)
        {
            var deduction = 0.0d;
            var numberOfChildrenOnCharge             = context.EmployeeInformation.NumberOfChildrenOnCharge - context.EmployeeInformation.NumberOfChildrenOnChargeWithHandicap;
            var numberOfChildrenOnChargeWithHandicap = context.EmployeeInformation.NumberOfChildrenOnChargeWithHandicap;

            deduction = CalculateDeductionChildrenOnChargeScale(numberOfChildrenOnCharge);
            //Child with handicap *2
            deduction += CalculateDeductionChildrenOnChargeScale(numberOfChildrenOnChargeWithHandicap) * 2;

            return(deduction);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        private double CalculateDeductionForChargesOfFamily(MuntContext context, ComponentContext componentContext)
        {
            var deduction = 0.0d;

            if (true)//is single or partner has income
            {
                deduction = CalculateDeductionForChargesOfFamilySingleOrPartnerIncome(context, componentContext);
            }
            else if (false)//partner has no income
            {
                deduction = CalculateDeductionForChargesOfFamilyPartnerNoIncome(context, componentContext);
            }

            return(deduction);
        }
コード例 #15
0
        /// <summary>
        /// Based on the type of worker (employee, self employed, company directors, ...)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="componentContext"></param>
        /// <param name="annualBrutoWage"></param>
        /// <returns></returns>
        private double CalculateWorkerTaxes(MuntContext context, ComponentContext componentContext, double annualBrutoWage)
        {
            var workerTaxes = 0.0d;

            if (true) //Check if employee is an employee
            {
                workerTaxes = CalculateWorkerTaxesForEmployee(context, componentContext, annualBrutoWage);
            }
            else if (true)//Check if employee is a company director
            {
                workerTaxes = CalculateWorkerTaxesForCompanyDirector(context, componentContext, annualBrutoWage);
            }

            return(workerTaxes);
        }
コード例 #16
0
        /// <summary>
        /// Calculates the basic taxes (second scale of calculation, the basic scale)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="componentContext"></param>
        /// <param name="annualNettoWage"></param>
        /// <returns></returns>
        private double CalculateBasicTaxes(MuntContext context, ComponentContext componentContext, double annualNettoWage)
        {
            var basicTaxes = 0.0d;

            if (true) //Check if employee is a belgian citizen
            {
                basicTaxes = CalculateBasicTaxesForCitizens(context, componentContext, annualNettoWage);
            }
            else if (true)//employee is not a citizen,
            {
                basicTaxes = CalculateBasicTaxesByScale(context, componentContext, annualNettoWage);
            }

            return(Math.Round(basicTaxes, 2));
        }
コード例 #17
0
        private double CalculateWorkerTaxesForCompanyDirector(MuntContext context, ComponentContext componentContext, double annualBrutoWage)
        {
            var workerTaxes = 0.0d;

            if (annualBrutoWage < 81333.33d)
            {
                //3pct
                workerTaxes = annualBrutoWage * 0.03;
            }
            else if (81333.33d <= annualBrutoWage)
            {
                //2586.00 + 11pct of anything above 8260.00d
                workerTaxes = 2440.00d;
            }

            return(workerTaxes);
        }
コード例 #18
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);
        }
コード例 #19
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);
        }
コード例 #20
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));
        }
コード例 #21
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);
        }
コード例 #22
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));
        }
コード例 #23
0
        private double CalculateBasicTaxesForCitizens(MuntContext context, ComponentContext componentContext, double annualNettoWage)
        {
            var basicTaxes = 0.0d;

            if (true)//Check if employee is independend or has no partner on its charge
            {
                basicTaxes = CalculateBasicTaxesForIndependendOrUnchargedPartner(context, componentContext, annualNettoWage);
                //Deduction for belgian citizens
                basicTaxes -= 1655.83d;
            }
            else if (true)//The partner is on the employee's charge
            {
                //TODO
                //Subcalucation based on 30pct of the annualBrutoWage
                //max = 10490.00d
                //CalculateBasicTaxesByScale
                //difference between two result (from employee and partner) is subtracted
                //basicTaxes = Addition - 3311.66d
            }

            return(basicTaxes);
        }
コード例 #24
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);
        }