private Dictionary <string, List <Installment> > GetInstallments(InstallmentRequest installmentRequest) { Dictionary <string, List <Installment> > all = new Dictionary <string, List <Installment> >(); double totalAmount = MoneyUtils.ToDouble(installmentRequest.totalAmount); foreach (BinAndBank binAndBank in installmentRequest.BinAndBanks()) { string bankCode = binAndBank.bankCode; int count = Convert.ToInt32(bankCode.Substring(3)) + 3;//+3 extension time :D List <Installment> installments = new List <Installment>(); for (int i = 1; i <= count; i++) { Installment installment = new Installment { numberOfInstallment = Convert.ToString(i), installmentAmount = MoneyUtils.FormatTurkishLira(totalAmount / (ulong)i), totalAmount = MoneyUtils.FormatTurkishLira(totalAmount), vposConfig = PrepareVposConfig(bankCode) }; installments.Add(installment); } all.Add(binAndBank.bin, installments); } return(all); }
public EmployeeDistribution MapEmployeeToEmployeeDistribution(Employee employee, decimal distributionAmount) { return(new EmployeeDistribution { RegistrationId = employee.RegistrationId, Name = employee.Name, DistributionAmount = MoneyUtils.SetMoneyTextFromDecimal(distributionAmount) }); }
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)); }
public Summary MapResultToSummary(List <EmployeeDistribution> employeeDistributions, string numberOfEmployees, decimal totalAmount, decimal totalDistributed, decimal distributionAmountBalance) { return(new Summary { Distributions = employeeDistributions, TotalEmployees = numberOfEmployees, DistributedAmount = MoneyUtils.SetMoneyTextFromDecimal(totalDistributed), DistributionAmountBalance = MoneyUtils.SetMoneyTextFromDecimal(distributionAmountBalance), AvailableAmount = MoneyUtils.SetMoneyTextFromDecimal(totalAmount) }); }
protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5BL_SBPVBT_1153 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Bool(); //Put your code here foreach (var position in Parameter.BillPositions) { var billPosition = new CL1_BIL.ORM_BIL_BillPosition(); billPosition.Load(Connection, Transaction, position.BillPositionID); if (billPosition != null) { billPosition.PositionPricePerUnitValue_BeforeTax = position.ChangedPrice; billPosition.PositionValue_BeforeTax = position.ChangedPrice * billPosition.Quantity; var tax = CL1_ACC_TAX.ORM_ACC_TAX_Tax.Query.Search(Connection, Transaction, new CL1_ACC_TAX.ORM_ACC_TAX_Tax.Query { ACC_TAX_TaxeID = billPosition.ApplicableSalesTax_RefID, Tenant_RefID = securityTicket.TenantID, IsDeleted = false }).SingleOrDefault(); if (tax != null) { billPosition.PositionPricePerUnitValue_IncludingTax = MoneyUtils.CalculateGrossPriceForTaxInPercent(position.ChangedPrice, (decimal)tax.TaxRate); billPosition.PositionValue_IncludingTax = billPosition.PositionPricePerUnitValue_IncludingTax * billPosition.Quantity; } billPosition.Save(Connection, Transaction); var billHeader = new CL1_BIL.ORM_BIL_BillHeader(); billHeader.Load(Connection, Transaction, billPosition.BIL_BilHeader_RefID); var allPositionsForHeader = CL5_APOBilling_Bill.Complex.Retrieval.cls_Get_BillPositions_with_Articles_for_BillHeader.Invoke(Connection, Transaction, new P_L5BL_GBPwAfBH_1848 { BillHeaderID = billHeader.BIL_BillHeaderID }, securityTicket).Result; var billSumIncludeTax = allPositionsForHeader.Sum(x => x.BillPosition.PositionValue_IncludingTax); var billSumBeforeTax = allPositionsForHeader.Sum(x => x.BillPosition.PositionValue_BeforeTax); billHeader.TotalValue_BeforeTax = billSumBeforeTax; billHeader.TotalValue_IncludingTax = billSumIncludeTax; billHeader.Save(Connection, Transaction); } } return(returnValue); #endregion UserCode }
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)); }