private decimal CalculateProfitDistributionForEmployee(Employee employee, List <PFSModel> pfsList, List <PTAModel> ptaList, Dictionary <string, decimal> paaDict)
        {
            decimal  salary        = MoneyUtils.SetDecimalFromString(employee.Salary);
            DateTime admissionDate = employee.AdmissionDate;
            string   area          = employee.Area;
            string   position      = employee.Position;

            return(salary * AppConstants.MONTHS_IN_YEAR * GetEquationResult(salary, admissionDate, area, position, pfsList, ptaList, paaDict));
        }
示例#2
0
        public async Task <ActionResult <Summary> > GetSummaryForProfitDistributionAsync(decimal totalAmount)
        {
            var employees = await GetEmployeesAsync();

            List <EmployeeDistribution> employeeDistributions = await profitCalculations.DistributeProfitForEmployeesAsync(employees.ToList());

            decimal totalDistributed          = employeeDistributions.Sum(emp => MoneyUtils.SetDecimalFromString(emp.DistributionAmount));
            decimal distributionAmountBalance = decimal.Subtract(totalAmount, totalDistributed);

            if (IsNegative(distributionAmountBalance))
            {
                return(new BadRequestObjectResult(ERROR_BALANCE));
            }

            return(objectMappers.MapResultToSummary(employeeDistributions, employees.Count.ToString(), totalAmount, totalDistributed, distributionAmountBalance));
        }