// GET: Admin/Salary/Update public ActionResult Update(string id = "") { try { int temp; if (!int.TryParse(id, out temp)) { return(RedirectToAction("Manage", "Salary")); } SalaryInfo salary = null; using (SalaryRepository Repo = new SalaryRepository()) { salary = Repo.GetSalaryById(int.Parse(id)); } if (salary == null) { return(RedirectToAction("Manage", "Salary")); } return(View(salary)); } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Salary", "Update"))); } }
public ActionResult EditSalary(SalaryInfo model) { try { long employeeId = Convert.ToInt64(Request.Params["employeeId"]); long postId = Convert.ToInt64(Request.Params["postId"]); OperateResult or = EmployeeManager.UpdatePost(employeeId, postId); if (or.status != OperateStatus.Success) { return(Json(or, JsonRequestBehavior.AllowGet)); } or = EmployeeManager.UpdateSalary(employeeId, model); return(Json(or, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(new OperateResult() { content = Utility.GetExceptionMsg(e) }, JsonRequestBehavior.AllowGet)); } }
private void btnCalculate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTotalSalary.Text)) { ShowMessage("请输入基本工资"); return; } if (string.IsNullOrEmpty(txtQuotedSalary.Text)) { ShowMessage("请输入社保基数"); return; } double totalSalary; double.TryParse(txtTotalSalary.Text, out totalSalary); double quotedSalary; double.TryParse(txtQuotedSalary.Text, out quotedSalary); List <PayPercent> insurancesPayPercent = this.MyInsurancesPayPercent; if (insurancesPayPercent == null || insurancesPayPercent.Count < 1) { insurancesPayPercent = InsurancePolicy.YearsInsurancePolicies[0].ResidenceTypesPayPercent[0].InsurancesPayPercent; } SalaryInfo salaryInfo = new SalaryInfo(totalSalary, quotedSalary, insurancesPayPercent, this.RevenuePolicy); salaryInfo.Calculate(); string[] salaryString = GetSalaryString(salaryInfo); txtSalaryMessage.Text = salaryString[5]; }
private void ProcedurePrint_Click(object sender, RoutedEventArgs e) { if (lcv.CurrentItem == null) { return; } SalaryProcedureInfoWrap salaryProcedureInfoWrap = new SalaryProcedureInfoWrap(); SalaryInfo info = Do_GetSalaryProcedureInfo(lcv.CurrentItem as SalaryInfo, ref salaryProcedureInfoWrap); if (info != null) { string msg = ""; if (PrintDeal.CreateInstance().PrintSalarySheet(info, salaryProcedureInfoWrap, ref msg)) { MessageBox.Show("打印完成。"); } else { if (!string.IsNullOrEmpty(msg)) { MessageBox.Show(msg); } } } }
public ActionResult Update(SalaryInfo salaryInfo) { try { using (SalaryRepository Repo = new SalaryRepository()) { int totalSalary = Convert.ToInt32(salaryInfo.TotalSalary); salaryInfo.IncomTax = Math.Round(Convert.ToDecimal(TaxCalculator.CalculateTax(totalSalary)), 2); salaryInfo.BasicSalary = Convert.ToDecimal(totalSalary * 0.65); salaryInfo.MedicalAllowance = Convert.ToDecimal(totalSalary * 0.1); salaryInfo.HouseRent = Convert.ToDecimal(totalSalary * 0.25); salaryInfo.ModifiedByAccountId = CurrentUser.AccountId; salaryInfo.ModifiedDate = DateTime.Now; Repo.UpdateSalary(salaryInfo); } return(RedirectToAction("Update", "Salary", new { id = salaryInfo.Id })); } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Salary", "Update"))); } }
public void SaveSalary(SalaryInfo salaryInfo) { Data.Salary salary = ConvertToDb(salaryInfo); _context.Salaries.Add(salary); _context.SaveChanges(); }
public async Task <PaySlipDetail> GetPaySlipDetailFromSalaryInfo(SalaryInfo salaryInfo) { var rates = await taxingRuleDao.GetCurrentTaxingRates(); var suitableRate = rates.FirstOrDefault(x => x.TaxableIncomeBottom <= salaryInfo.AnnuaSalary && (x.TaxableIncomeTop >= salaryInfo.AnnuaSalary || x.TaxableIncomeTop == -1)); if (suitableRate == null) { throw new Exception($"Error in finding suitable tax rate for {salaryInfo.AnnuaSalary}"); } var baseTax = suitableRate.TaxBase; var extraTax = (int)((salaryInfo.AnnuaSalary - suitableRate.TaxableIncomeBottom) * suitableRate.TaxRatio); var incomeTax = (int)Math.Round((double)(baseTax + extraTax) / 12, MidpointRounding.ToEven); var grossIncome = (int)Math.Round((double)salaryInfo.AnnuaSalary / 12, MidpointRounding.ToEven); var netIncome = grossIncome - incomeTax; var superAnnuation = (int)Math.Round(grossIncome * salaryInfo.SuperRate, MidpointRounding.ToEven); var result = new PaySlipDetail() { SalaryInfo = salaryInfo, GrossIncome = grossIncome, IncomeTax = incomeTax, NetIncome = netIncome, SuperAnnunation = superAnnuation }; return(result); }
static private KeySkillStats GetSkillWithStats(Key_Skills skill, List <HHVacancyModel> vacanciesHasSkill, int allVacanciesCnt) { return(new KeySkillStats() { KeySkill = skill, Price = SalaryInfo.GetAverageSalary(vacanciesHasSkill), FrequencyInPercent = decimal.Divide(vacanciesHasSkill.Count, allVacanciesCnt) * 100 }); }
private bool Fitter_TextChanged(object obj) { if (obj == null) { return(true); } SalaryInfo salaryInfo = obj as SalaryInfo; if (salaryInfo == null) { return(true); } bool IsGeneralTextAccepted = true; if (!string.IsNullOrEmpty(FitterGeneralText.Text.Trim())) { switch ((EmployeeSearchType)(FitterSearchComboBox.SelectedValue)) { /* * case EmployeeSearchType.EmployeeID: * int result; * if (int.TryParse(FitterGeneralText.Text, out result)) * { * IsGeneralTextAccepted = salaryInfo.ID == result; * } * else * IsGeneralTextAccepted = false; * break; * */ case EmployeeSearchType.EmployeeName: IsGeneralTextAccepted = salaryInfo.EmployeeName.ToLower().Contains(FitterGeneralText.Text.ToLower()); break; case EmployeeSearchType.DepartmentName: IsGeneralTextAccepted = salaryInfo.DepartmentName.ToLower().Contains(FitterGeneralText.Text.ToLower()); break; } } bool IsYearTextAccepted = true; if (YearComboBox.SelectedItem != null) { IsYearTextAccepted = salaryInfo.Year == (int)(YearComboBox.SelectedItem); } bool IsMonthTextAccepted = true; if (MonthComboBox.SelectedItem != null) { IsMonthTextAccepted = salaryInfo.Month == (int)(MonthComboBox.SelectedItem); } return(IsGeneralTextAccepted && IsYearTextAccepted && IsMonthTextAccepted); }
private SalaryProcedureInfoWrap GetSalaryProcedureInfo(SalaryInfo salaryInfo, ref bool isUpdateTotalPrice) { SalaryProcedureInfoWrap salaryProcedureInfoWrap = new SalaryProcedureInfoWrap() { EmployeeName = salaryInfo.EmployeeName, DepartmentName = salaryInfo.DepartmentName, CurrentDate = new DateTime(salaryInfo.Year, salaryInfo.Month, 1) }; ObservableCollection <ProcedureInfo> CurProcedureInfoList = null; foreach (SheetInfo sheetInfo in dataManager.AllSheetList) { //结单了 if (sheetInfo.SettleDate == null) { continue; } //本月内 DateTime dateValue = sheetInfo.SettleDate.Value; if (dateValue.Year == salaryInfo.Year && dateValue.Month == salaryInfo.Month) { CurProcedureInfoList = SheetDeal.GetAllProcedureInfo(sheetInfo.ID); if (CurProcedureInfoList == null) { continue; } CurProcedureInfoList.ToList().ForEach(procedureInfo => { //该人参与该流程 if (procedureInfo.EmployeeID == salaryInfo.EmployeeID) { salaryProcedureInfoWrap.TotalPrice += procedureInfo.Price; salaryProcedureInfoWrap.SalaryProcedureInfoList.Add(new SalaryProcedureInfo { SheetID = sheetInfo.ID, SettleDate = dateValue, BSType = sheetInfo.BSType, Customer = sheetInfo.Customer, ProcedureName = procedureInfo.ProcedureName, Price = procedureInfo.Price }); } }); } } if (salaryInfo.Commission != salaryProcedureInfoWrap.TotalPrice) { isUpdateTotalPrice = true; salaryInfo.Commission = salaryProcedureInfoWrap.TotalPrice; } return(salaryProcedureInfoWrap); }
public async Task DeleteSalaryAsync(SalaryInfo monthinfo, CancellationToken cancellationToken = default(CancellationToken)) { if (monthinfo == null) { throw new ArgumentNullException(nameof(monthinfo)); } Context.Remove(monthinfo); await Context.SaveChangesAsync(cancellationToken); }
public decimal GetAverageRegionSalary(int areaId) { var vacs = _vacancyDataHandlerService.GetRegionVacancies(_vacancyDataHandlerService.GetVacanciesWithSalary(_vacancyService.Vacancies), areaId); if (!vacs.Any()) { return(-1); } return(SalaryInfo.GetAverageSalary(vacs)); }
public Employee GetById(int id) { EmployeeEntity employeeEntity = _employeeRepository.GetById(id); DepartmentInfo departmentInfo = _departmentService.GetByCode(employeeEntity.DepartmentCode); SalaryInfo salaryInfo = _salaryService.GetByCode(employeeEntity.SalaryCode); return(Map(employeeEntity, salaryInfo, departmentInfo)); }
// ... public SalaryInfo CalculateSalary(int salary) { var retval = new SalaryInfo() { Salary = salary * (0.40), Hra = salary * (0.40) * (0.50) // *0.2 ... }; return(retval); }
public async Task <IActionResult> Save([FromBody] SalaryInfo info) { GuardUtils.NotNull(info, nameof(info)); info.Key = string.IsNullOrEmpty(info.Key) ? info.Name : info.Key; info.FormType = FormType.Import; info.FormName = FormType.Import.GetDescription(); info.SalaryType = SalaryType.Import; var model = await _salaryService.Save(info); return(Json(model)); }
public IActionResult GetHealthInsuranceQuote([FromBody] SalaryInfo salary) { try { var healthInsuranceQuotes = _taxCalculationService.CalculateHealthInsuranceQuotes(salary.Value); return(Ok(healthInsuranceQuotes)); } catch { return(BadRequest()); } }
public IActionResult GetTaxesForSalary([FromBody] SalaryInfo salary) { try { var taxQuotes = _taxCalculationService.CalculateTaxQuotes(salary.Value); return(Ok(taxQuotes)); } catch { return(BadRequest()); } }
public async Task <IActionResult> AddNewSalaryInfo([FromBody] NewSalaryInfoVM vm) { if (!ModelState.IsValid) { string errorMsg = null; foreach (var m in ModelState.Values) { foreach (var msg in m.Errors) { errorMsg = msg.ErrorMessage; } } return(BadRequest(errorMsg)); } var user = await _userManager.FindByIdAsync(User.Identity.Name); if (user == null) { return(NotFound()); } if (await _userManager.IsInRoleAsync(user, "Admin")) { SalaryInfo newSalaryInfo = new SalaryInfo { Country = vm.Country, Currency = vm.Currency, High = vm.High, Low = vm.Low, Median = vm.Median, Occupation = vm.Occupation, IsDisplayable = true }; await _siRepository.AddAsync(newSalaryInfo); await _siRepository.CommitAsync(); var salaryInfoVM = Mapper.Map <SalaryInfo, SalaryInfoVM>(newSalaryInfo); return(CreatedAtRoute("GetSalaryInfo", new { controller = "Admin", id = salaryInfoVM.SalaryInfoId }, salaryInfoVM)); } return(StatusCode(401)); }
/// <summary> /// Coverts SalaryInfo to WebSalaryInfo /// </summary> public static WebSalaryInfo SalaryInfoToWebSalaryInfo(this SalaryInfo salaryInfo) { var webSalaryInfo = new WebSalaryInfo { Id = salaryInfo.Id, Salary = salaryInfo.Salary, BankAccount = salaryInfo.BankAccount, PaymentType = salaryInfo.PaymentTypeName, Rate = salaryInfo.Rate, Type = salaryInfo.TypeName }; return(webSalaryInfo); }
private void FlushCommission_Click(object sender, RoutedEventArgs e) { if (lcv.CurrentItem == null) { return; } SalaryProcedureInfoWrap salaryProcedureInfoWrap = new SalaryProcedureInfoWrap(); SalaryInfo info = Do_GetSalaryProcedureInfo(lcv.CurrentItem as SalaryInfo, ref salaryProcedureInfoWrap); if (info != null) { MessageBox.Show("统计完成!"); } }
private void ViewBSBtn_Click(object sender, RoutedEventArgs e) { if (lcv.CurrentItem == null) { return; } SalaryProcedureInfoWrap salaryProcedureInfoWrap = new SalaryProcedureInfoWrap(); SalaryInfo info = Do_GetSalaryProcedureInfo(lcv.CurrentItem as SalaryInfo, ref salaryProcedureInfoWrap); if (info != null) { ProcedureInfoPanel.DataContext = salaryProcedureInfoWrap; ProcedureInfoPanel.Visibility = Visibility.Visible; } }
/// <summary> /// 保存薪酬项 /// </summary> /// <param name="info">薪酬项</param> /// <returns>薪酬项信息</returns> public async Task <SalaryInfo> Save(SalaryInfo info) { GuardUtils.NotNull(info, nameof(info)); var model = info.ToModel <Salary>(); if (info.Id != Guid.Empty) { model = await _salaryDb.UpdateAsync <Salary>(model); } else { model.OrderIndex = _salaryDb.Get <Salary>().Max(x => x.OrderIndex) + 1; model = await _salaryDb.SaveAsync <Salary>(model); } return(model.ToViewModel <SalaryInfo>()); }
private SalaryInfo Do_GetSalaryProcedureInfo(SalaryInfo salaryInfo, ref SalaryProcedureInfoWrap salaryProcedureInfoWrap) { if (salaryInfo == null) { return(null); } bool isUpdateTotalPrice = false; salaryProcedureInfoWrap = GetSalaryProcedureInfo(salaryInfo, ref isUpdateTotalPrice); if (isUpdateTotalPrice) { SalaryDeal.UpdateSalaryInfo(salaryInfo); dataManager.AllSalaryList = AlgorithmClass.DeepClone <ObservableCollection <SalaryInfo> >(AllSalaryList); } return(salaryInfo); }
public IActionResult CreateSalary([FromBody] CreateSalaryInfoRequest createSalaryInfoRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!Enum.TryParse(createSalaryInfoRequest.Type, out SalaryType salaryType)) { return(BadRequest($"Salary type {createSalaryInfoRequest.Type} does not exist")); } if (!Enum.TryParse(createSalaryInfoRequest.PaymentType, out PaymentType paymentType)) { return(BadRequest($"Salary type {createSalaryInfoRequest.Type} does not exist")); } var dbSalaryInfo = new SalaryInfo { Type = (int)salaryType, PaymentType = (int)paymentType, Rate = createSalaryInfoRequest.Rate, Salary = createSalaryInfoRequest.Salary, BankAccount = createSalaryInfoRequest.BankAccount }; using (var txn = _dbContext.Database.BeginTransaction()) { try { _dbContext.Salaries.Add(dbSalaryInfo); _dbContext.SaveChanges(); txn.Commit(); } catch { txn.Rollback(); throw; } } return(Ok(dbSalaryInfo.SalaryInfoToWebSalaryInfo())); }
public async Task SetSalaryAsync(SalaryInfo salaryinfo, CancellationToken cle = default(CancellationToken)) { if (salaryinfo == null) { throw new ArgumentNullException(nameof(salaryinfo)); } if (Context.PositionInfos.Any(x => x.ID == salaryinfo.ID)) { Context.Attach(salaryinfo); Context.Update(salaryinfo); } else { Context.Add(salaryinfo); } await Context.SaveChangesAsync(cle); }
public ActionResult EditSalary(SalaryInfo model) { //if (!ModelState.IsValid) //{ // return Json( // new OperateResult // { // content = Model.Utility.GetModelStateErrors(ModelState), // }, // JsonRequestBehavior.AllowGet // ); //} EmployeeManager manager = new EmployeeManager(); OperateResult or = manager.UpdateSalary(model); return(Json(or, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 更新Salary信息 /// </summary> public static int UpdateSalaryInfo(SalaryInfo salaryInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Update("UpdateSalaryInfo", salaryInfo); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.UpdateSalaryInfo() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(result); }
/// <summary> /// 插入Salary信息 /// </summary> public static int InsertSalary(SalaryInfo salaryInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int id = 0; try { mapper.BeginTransaction(); id = (int)(mapper.Insert("InsertSalary", salaryInfo)); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.InsertSalary() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(id); }
public Data.Salary ConvertToDb(SalaryInfo salaryInfo) { return(new Data.Salary { Id = salaryInfo.Id, TotalSalary = salaryInfo.TotalSalary, BasicSalary = salaryInfo.BasicSalary, HouseRent = salaryInfo.HouseRent, MedicalAllowance = salaryInfo.MedicalAllowance, IncomTax = salaryInfo.IncomTax, LoanDeduction = salaryInfo.LoanDeduction, OtherDeductions = salaryInfo.OtherDeductions, EmployeeInfoId = salaryInfo.EmployeeInfoId, CreatedDate = salaryInfo.CreatedDate, CreatedByAccountId = salaryInfo.CreatedByAccountId, ModifiedDate = salaryInfo.ModifiedDate, ModifiedByAccountId = salaryInfo.ModifiedByAccountId }); }
private Employee Map(EmployeeEntity employeeEntity, SalaryInfo salaryInfo, DepartmentInfo departmentInfo) { return(new Employee() { FirstName = employeeEntity.FirstName, LastName = employeeEntity.LastName, JobTitle = employeeEntity.JobTitle, EmploymentDate = employeeEntity.EmploymentDate, Profile = new PersonalInfo() { DateOfBith = employeeEntity.DateOfBirth, MonthlySalary = salaryInfo.Amount }, Department = new DepartmentInfo() { Code = employeeEntity.DepartmentCode, Name = departmentInfo.Name } }); }
//...some other info public CreditRequest() { PassportInfo = new PassportInfo(); SalaryInfo = new SalaryInfo(); }