public static dynamic GetPaymentSheet(PayrunDetail_Dto curDetail, IJsonSerializer jsonSerializer) { List <PayrunAllowanceSummary_Dto> payrunAllowances = curDetail.PayrunAllowancesSummaries.ToList(); PayrunAllowanceSummary_Dto housingAllowance = payrunAllowances.LastOrDefault(x => x.AllowanceType.Value == "Housing"); string otherAllowancesSum = "" + (payrunAllowances.Sum(x => x.Value) - (housingAllowance == null ? 0 : housingAllowance.Value)).ToString("N2"); DateTime curPeriod = new DateTime(curDetail.Year, curDetail.Month, 1); dynamic paymentSlipDSRow = new ExpandoObject(); paymentSlipDSRow.payrunId = curDetail.PayrunId; paymentSlipDSRow.getEmpRefCode = curDetail.Employee.GetReferenceId; paymentSlipDSRow.getEmpName = curDetail.Employee.Name; FinancialDetails financialDetails = jsonSerializer.Deserialize <FinancialDetails>(curDetail.Employee.ExtraProperties["financialDetails"].ToString()); BanksRDTO curBank = financialDetails.Banks.Last();//financialDetails.Banks.SingleOrDefault(x => DateTime.Parse(x.FromDate).Month >= curPeriod.Month && DateTime.Parse(x.ToDate).Month <= curPeriod.Month); paymentSlipDSRow.getBankName = curBank.GetBankName; paymentSlipDSRow.getBankIBAN = curBank.BankIBAN; paymentSlipDSRow.getBasicSalary = "" + curDetail.BasicSalary.ToString("N2"); paymentSlipDSRow.getAllowanceHousing = housingAllowance == null ? "—" : "" + housingAllowance.Value.ToString("N2"); paymentSlipDSRow.getOtherIncome = otherAllowancesSum; paymentSlipDSRow.getDeductions = "" + curDetail.GrossDeductions.ToString("N2"); paymentSlipDSRow.getPayment = "" + curDetail.NetAmount.ToString("N2"); paymentSlipDSRow.month = curDetail.Month; paymentSlipDSRow.year = curDetail.Year; return(paymentSlipDSRow); }
public async Task UpdateUserMoney(ChangeMoneyDto input) { if (input.Money == 0) { throw new UserFriendlyException("请输入充值金额"); } var user = _userRepository.Get(input.UserId); if (user == null) { throw new UserFriendlyException("请重试"); } var nowMoney = user.NowMoney; var money = nowMoney + input.Money; var fin = new FinancialDetails { UserId = input.UserId, Mark = input.Mark, Desc = "后台(人工调整)", Money = input.Money, NowMoney = money, Type = input.Money > 0 ? 0 : 1, PayType = 0 }; await _financialDetailsRepository.InsertAsync(fin); user.NowMoney = money; await _userRepository.UpdateAsync(user); }
public IActionResult OnGetPaymentsSheet(int payrunId) { Payrun payrun = PayrunAppService.Repository.WithDetails().SingleOrDefault(x => x.Id == payrunId); if (payrun != null) { List <PayrunDetail> payrunDetails = payrun.PayrunDetails.ToList(); List <dynamic> dynamicDS = new List <dynamic>(); for (int i = 0; i < payrunDetails.Count; i++) { PayrunDetail curDetail = payrunDetails[i]; List <PayrunAllowanceSummary> payrunAllowances = curDetail.PayrunAllowancesSummaries.ToList(); PayrunAllowanceSummary housingAllowance = payrunAllowances.LastOrDefault(x => x.AllowanceType.Value == "Housing"); string otherAllowancesSum = "" + (payrunAllowances.Sum(x => x.Value) - (housingAllowance == null ? 0 : housingAllowance.Value)).ToString("N2"); DateTime curPeriod = new DateTime(curDetail.Year, curDetail.Month, 1); dynamic paymentSlipDSRow = new ExpandoObject(); paymentSlipDSRow.payrunId = payrunId; paymentSlipDSRow.sNo = i + 1; paymentSlipDSRow.getEmpRefCode = curDetail.Employee.GetReferenceId; paymentSlipDSRow.getEmpName = curDetail.Employee.Name; FinancialDetails financialDetails = JsonSerializer.Deserialize <FinancialDetails>(curDetail.Employee.ExtraProperties["financialDetails"].ToString()); BanksRDTO curBank = financialDetails.Banks.Last();//financialDetails.Banks.SingleOrDefault(x => DateTime.Parse(x.FromDate).Month >= curPeriod.Month && DateTime.Parse(x.ToDate).Month <= curPeriod.Month); paymentSlipDSRow.getBankName = curBank.GetBankName; paymentSlipDSRow.getBankIBAN = curBank.BankIBAN; paymentSlipDSRow.getBasicSalary = "" + curDetail.BasicSalary.ToString("N2"); paymentSlipDSRow.getAllowanceHousing = housingAllowance == null ? "—" : "" + housingAllowance.Value.ToString("N2"); paymentSlipDSRow.getOtherIncome = otherAllowancesSum; paymentSlipDSRow.getDeductions = "" + curDetail.GrossDeductions.ToString("N2"); paymentSlipDSRow.getPayment = "" + curDetail.NetAmount.ToString("N2"); paymentSlipDSRow.month = curDetail.Month; paymentSlipDSRow.year = curDetail.Year; paymentSlipDSRow.isPosted = payrun.IsPSPosted; dynamicDS.Add(paymentSlipDSRow); } return(new JsonResult(dynamicDS)); } return(StatusCode(500)); }
public async Task <IActionResult> OnPost(Employee_UV_Dto employee, IList <PhysicalID_UV_Dto> physicalIDs, IList <BasicSalaryRDTO> basicSalaries, IList <AllowanceRDTO> allowances, IList <BanksRDTO> banks, Contact primaryContact, NationalAddress nationalAddress, IList <Contact> secondaryContacts, IList <Qualification> qualifications, IList <Dependant> dependants, IList <PhysicalId <int> > dependantsIds, IList <WorkShiftRDto> workShifts) { try { for (int i = 0; i < physicalIDs.Count; i++) { //physicalIDs[i].SetId(GuidGenerator.Create()); physicalIDs[i].IDTypeId = physicalIDs[i].IDType.Id; physicalIDs[i].IDType = null; physicalIDs[i].IssuedFromId = physicalIDs[i].IssuedFrom.Id; physicalIDs[i].IssuedFrom = null; } var empIds = new List <PhysicalID_UV_Dto>(); empIds.AddRange(physicalIDs); //employee.PhysicalIDs = empIds; employee.WorkShiftId = workShifts.Last().WorkShiftId; //Employee_UV_Dto employeeObj = JsonSerializer.Deserialize<Employee_UV_Dto>(employee); FinancialDetails financialDetails = new FinancialDetails(basicSalaries, allowances, banks); ContactInformation contactInformation = new ContactInformation(primaryContact, nationalAddress, secondaryContacts); QualificationDetail qualificationDetail = new QualificationDetail(qualifications); DependantsDetail dependantsDetail = new DependantsDetail(dependants, dependantsIds); WorkShiftDetail workShiftDetail = new WorkShiftDetail(workShifts); employee.ExtraProperties.Add("financialDetails", financialDetails); employee.ExtraProperties.Add("contactInformation", contactInformation); employee.ExtraProperties.Add("qualificationDetail", qualificationDetail); employee.ExtraProperties.Add("dependantsDetail", dependantsDetail); employee.ExtraProperties.Add("workShiftDetail", workShiftDetail); //Employee_Dto empAdded = await employeeAppService.CreateEmployee(employee); } catch (Exception ex) { } return(Page()); }