public async Task <ActionResult> Index(int EmployeeId) { List <Employee> emplist = new List <Employee>(); emplist = await AsyncEmployee(); if (EmployeeId > 0) { emplist = emplist.Where(s => s.id == EmployeeId).ToList(); } foreach (var emp in emplist) { if (emp.contractTypeName == "MonthlySalaryEmployee") { var objMonthlySalary = new MonthlySalary(); emp.annualSalary = objMonthlySalary.CalculateAnnualSalary(emp.monthlySalary); } else if (emp.contractTypeName == "HourlySalaryEmployee") { var objHourlySalary = new HourlySalary(); emp.annualSalary = objHourlySalary.CalculateAnnualSalary(emp.hourlySalary); } } return(View(emplist)); }
static void Main(string[] args) { //连接数据库 SqlConnection conn = MyHelper.GetConnection(); DevExpress.Xpo.XpoDefault.DataLayer = CreateThreadSafeDataLayer(conn); DevExpress.Xpo.Session.DefaultSession.Connection = conn; Console.WriteLine("正在同步薪酬体系...."); SalaryPlan.SychSalaryPlan(); Console.WriteLine("正在同步薪等...."); SalaryGrade.SychSalaryGrade(); Console.WriteLine("正在同步薪级...."); SalaryStep.SychSalaryStep(); Console.WriteLine("正在同步员工基本信息...."); EmployeeInfo.SychEmployeeInfo(); Console.WriteLine("正在同步工资表...."); SalaryResult.SychSalaryResult(); Console.WriteLine("正在清理无效的月薪记录...."); MonthlySalary.ClearInvalidRecord(); Console.WriteLine("正在同步绩效考核结果...."); KpiItem.SychKpiItem(); Console.WriteLine("同步完毕!"); //Console.WriteLine("按任意键退出..."); //Console.ReadKey(true); }
public AdjustMonthlySalaryForm(string salary_plan, string group, int year, SemiannualType st, bool isCheck) : this() { this.salary_plan = salary_plan; this.group = group; this.year = year; this.sntype = st; this.isCheck = isCheck; this.period = year * 10 + (byte)st; //获取公司代码 company_code = PsHelper.GetCompanyCode(salary_plan); //获取职等(默认自动为每个职等建立一个群组) jobgrade = JobGrade.GetJobGrade(salary_plan, group); //通过薪等编号获取员工名单 emp_list = GetEmployeeList(); //设置标记, 标记有异动的人员 foreach (EmployeeInfo emp in emp_list) { MonthlySalary effectiveMonthlySalary = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); if (effectiveMonthlySalary == null) { emp.标记 = true; } } }
public IndividualAdjustMonthlySalaryForm(string salary_plan, string group, bool isCheck) : this() { this.salary_plan = salary_plan; this.group = group; this.isCheck = isCheck; //获取公司代码 company_code = PsHelper.GetCompanyCode(salary_plan); //获取职等(默认自动为每个职等建立一个群组) jobgrade = JobGrade.GetJobGrade(salary_plan, group); //获取期号 int lastestPeriodNonYear = MonthlySalary.GetLastestPeriodNonYear(salary_plan, group); period = lastestPeriodNonYear == -1 ? 100001 : lastestPeriodNonYear + 1; //通过薪等编号获取员工名单 emp_list = GetEmployeeList(); //设置标记, 标记有异动的人员 foreach (EmployeeInfo emp in emp_list) { MonthlySalary effectiveMonthlySalary = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); if (effectiveMonthlySalary == null) { emp.标记 = true; } } }
} // end Parameterized constructor /// <summary> /// To override the ToString method so object property values are returned /// </summary> /// <returns>The string containing the object property values</returns> public override string ToString() { return "\r\n" + FirstName.ToString() + " " + LastName.ToString() + ":\r\n\t" + "Type: " + EmpType.ToString().ToLowerInvariant() + "\r\n\t" + "ID: " + EmpID.ToString() + "\r\n\t" + "Monthly Salary: " + MonthlySalary.ToString("C") + "\r\n\t" + "Commission Rate: " + CommissionRate.ToString("C") + "\n"; } // end method ToString()
/// <summary> /// Action to view the salaries of a respective month /// </summary> /// <param name="month">Month of which the salaries is going to load</param> /// <param name="year">Year from which the month belong</param> /// <param name="page">page number</param> /// <returns></returns> public ActionResult ViewSalaries(int month, int year, int?page) { try { HttpCookie conString = Request.Cookies.Get("rwxgqlb"); ViewBag.Month = new Month { Number = month, Year = year }; List <ViewSalariesViewModel> lstStaff = new List <ViewSalariesViewModel>(); Month salaryMonth = new Month { Number = month, Year = year }; foreach (var item in Staff.GetAllSetSalaryStaff(salaryMonth, Cryptography.Decrypt(conString.Value))) { MonthlySalary salary = item.GetMonthSalary(salaryMonth); lstStaff.Add(new ViewSalariesViewModel { CNIC = item.CNIC, Id = item.StaffId, Name = item.Name, Absents = salary.Absents, PerAbsent = salary.PerAbsentDeduction, Salary = salary.Salary, TSalary = salary.TotalSalary }); } if (lstStaff.Count == 0) { ViewBag.Error = true; } PagedList <ViewSalariesViewModel> model = new PagedList <ViewSalariesViewModel>(lstStaff, page ?? 1, 30); //Code to make chart int cyear = DateTime.Now.Year; List <_MonthlySalariesChartPartialViewModel> cmodel = new List <_MonthlySalariesChartPartialViewModel>(); for (int i = 1; i <= 12; i++) { decimal monthTotal = 0; Month cmonth = new Month { Number = i, Year = cyear }; foreach (var item in Staff.GetAllSetSalaryStaff(cmonth, Cryptography.Decrypt(conString.Value))) { monthTotal += item.GetMonthSalary(cmonth).TotalSalary; } cmodel.Add(new _MonthlySalariesChartPartialViewModel { Month = cmonth.Name + "", TotalSalaries = decimal.Round(monthTotal).ToString() }); } TempData["MonthlySalaryChart"] = cmodel; return(View(model)); } catch (Exception ex) { return(Content(ex.Message)); } }
public override int GetHashCode() { unchecked { var hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ MonthlySalary.GetHashCode(); hashCode = (hashCode * 397) ^ CommissionRate.GetHashCode(); return(hashCode); } }
private MonthlySalaryInput AddRow(int order, EmployeeInfo emp) { string lastSalaryGrade = SalaryResult.GetLastestSalaryGrade(emp.员工编号); if (lastSalaryGrade == null) { lastSalaryGrade = emp.职等; } //2018-7-11 软件开发人员的职等的专门的,不同于其他管理人员 if (salary_plan == "软件开发" && jobgrade != null) { lastSalaryGrade = jobgrade.称; } bool copyEffective = false; //将当前执行的标准带过来 MonthlySalary effectiveMonthlySalary = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); if (effectiveMonthlySalary != null) { if (effectiveMonthlySalary.薪酬体系 == salary_plan && effectiveMonthlySalary.职等 == lastSalaryGrade) { copyEffective = true; } //如果是管培生或副总以上人员,都带出来 if (jobgrade == null) { copyEffective = true; } } //创建员工月薪记录 MonthlySalaryInput ms = MonthlySalaryInput.AddMonthlySalaryInput(emp.员工编号, period, isCheck, copyEffective); ms.序号 = order; ms.薪酬体系 = salary_plan; ms.职等 = lastSalaryGrade; ms.群组 = group; //2018-4-23 新建的记录备注不要带过来 if (ms.录入人.Trim() == "") { ms.开始执行日期 = DateTime.MinValue; ms.调整类型 = ""; ms.备注 = ""; } if (jobgrade == null) { ms.执行_月薪类型 = "特资"; } ms.Save(); return(ms); }
public ISalary SelectEmployeeType(string Type) { ISalary salary; if (Type.Equals("HourlySalaryEmployee")) { salary = new HourlySalary(); } else { salary = new MonthlySalary(); } return(salary); }
private static ISalary CreateSalary(string contractType) { ISalary salary = null; switch (contractType) { case ContractType.HOURLY_SALARY: salary = new HourlySalary(); break; case ContractType.MONTHLY_SALARY: salary = new MonthlySalary(); break; } return(salary); }
protected void LoadData() { CreateWaitDialog("正在查询...", "请稍等"); List <EmployeeInfo> emp_list = GetEmployeeList(); //排序 emp_list = emp_list.OrderBy(a => a.部门序号).ThenBy(a => a.员工序号).ToList(); List <MonthlySalary> monthly_salary_list = new List <MonthlySalary>(); foreach (EmployeeInfo emp in emp_list) { //获取员工的执行月薪记录 MonthlySalary ms = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); //如果没有找到,构造一个空的实例 if (ms == null) { ms = new MonthlySalary(); ms.员工编号 = emp.员工编号; } monthly_salary_list.Add(ms); } //排序 monthly_salary_list = monthly_salary_list.OrderByDescending(a => a.执行_月薪).ToList(); int order = 1; foreach (MonthlySalary item in monthly_salary_list) { item.序号 = order++; if (jobgrade == null) { item.执行_月薪类型 = "特资"; } } SetWaitDialogCaption("正在加载..."); CloseWaitDialog(); gridControl1.DataSource = monthly_salary_list; gridControl1.RefreshDataSource(); btn导出.Enabled = true; CloseWaitDialog(); }
List <MonthlySalaryInput> CreateEditingRows() { List <MonthlySalaryInput> list = new List <MonthlySalaryInput>(); //排序 emp_list = emp_list.OrderBy(a => a.部门序号).ThenBy(a => a.机构序号).ThenBy(a => a.机构名称).ThenBy(a => a.员工序号).ToList(); DateTime lastSalaryDate = SalaryResult.GetLastSalaryDate(); int order = 1; foreach (EmployeeInfo emp in emp_list) { //2018-5-25 只创建没有月薪标准的人员 //将当前执行的标准带过来 MonthlySalary effectiveMonthlySalary = MonthlySalary.GetEffective(emp.员工编号, lastSalaryDate); if (effectiveMonthlySalary != null) { continue; } string lastSalaryGrade = SalaryResult.GetLastestSalaryGrade(emp.员工编号); if (lastSalaryGrade == null) { lastSalaryGrade = emp.职等; } //创建员工月薪记录 MonthlySalaryInput ms = MonthlySalaryInput.AddMonthlySalaryInput(emp.员工编号, period, isCheck, true); ms.序号 = order; ms.薪酬体系 = salary_plan; ms.职等 = lastSalaryGrade; ms.群组 = group; //2018-4-23 新建的记录备注不要带过来 if (ms.录入人.Trim() == "") { ms.开始执行日期 = DateTime.MinValue; ms.调整类型 = ""; ms.备注 = ""; } ms.Save(); list.Add(ms); order++; } return(list); }
private void btn检查异动_Click(object sender, EventArgs e) { CreateWaitDialog("正在检查是否存在异动人员...", "请稍等"); //清理异动人员薪酬表 List <EmployeeInfo> list = MonthlySalary.ClearInvalidRecord(); CloseWaitDialog(); if (list.Count == 0) { MessageBox.Show("没有异动人员"); } else { MessageBox.Show("有 " + list.Count + " 个异动人员, 他们的月薪执行记录已被清除,请重新录入"); } }
//获取员工的月薪资料 bool ReadMonthlySalaryData() { MonthlySalary ms = MonthlySalary.GetEffective(this.员工编号, 期间开始); if (ms == null) { return(false); } 薪酬体系 = ms.薪酬体系; 评定职等 = ms.职等; 评定职级 = ms.评定_职级; 执行职级 = ms.执行_职级; 标准职级月薪 = ms.评定_月薪; 执行职级月薪 = ms.执行_月薪; 月薪类型 = ms.执行_月薪类型; return(true); }
private void OnEmployeeSelectd(object sender, EmployeeInfo emp) { if (monthly_salary_list.Find(a => a.员工编号 == emp.员工编号) == null) { string lastSalaryGrade = SalaryResult.GetLastestSalaryGrade(emp.员工编号); if (lastSalaryGrade == null) { lastSalaryGrade = emp.职等; } bool copyEffective = false; //将当前执行的标准带过来 MonthlySalary effectiveMonthlySalary = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); if (effectiveMonthlySalary != null) { if (effectiveMonthlySalary.薪酬体系 == salary_plan && effectiveMonthlySalary.职等 == lastSalaryGrade) { copyEffective = true; } //如果是管培生或副总以上人员,都带出来 if (jobgrade == null) { copyEffective = true; } } //创建员工月薪记录 MonthlySalaryInput item = MonthlySalaryInput.AddMonthlySalaryInput(emp.员工编号, period, isCheck, copyEffective); item.序号 = advBandedGridView1.RowCount; item.薪酬体系 = salary_plan; item.职等 = emp.职等; item.群组 = group; //2018-4-23 调整类型和备注不要带过来 item.调整类型 = ""; item.备注 = ""; item.Save(); monthly_salary_list.Add(item); UpdateRowNumber(); gridControl1.RefreshDataSource(); advBandedGridView1.FocusedRowHandle = advBandedGridView1.RowCount - 1; } }
private void EditSalaryStructureForm_Load(object sender, EventArgs e) { this.Text = "员工薪酬结构录入 - " + currSalaryStructureEntry.员工编号 + " - " + (currSalaryStructureEntry.是验证录入 ? "验证录入" : "初次录入"); emp = currSalaryStructureEntry.员工信息; ms = MonthlySalary.GetEffective(emp.员工编号, DateTime.Today); if (ms == null) { MessageBox.Show("找不到该员工的执行月薪标准,请录入标准后再试"); Close(); } 满勤奖标准 = PsHelper.GetFullAttendancePayFromCache(emp.薪资体系, emp.薪等, new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1)); 未休年休假工资 = PsHelper.GetVacPayFromCache(emp.薪资体系, emp.薪等, new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1)); 交通餐饮补助标准 = PsHelper.GetTrafficSubsidies(emp.员工编号, new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1)); lbl用户.Text = currSalaryStructureEntry.员工信息.姓名; lbl员工编号.Text = currSalaryStructureEntry.员工编号; comboBoxEdit结构类型.EditValue = currSalaryStructureEntry.类型; LoadData(); }
public async Task <IEnumerable <EmployeeDTO> > LoadAllEmployeesAsync() { Factory <CalculateSalary> CalculateSalaryFactory = new Factory <CalculateSalary>(); DataAccessLayer data = new DataAccessLayer(); Uri uri = new Uri("http://masglobaltestapi.azurewebsites.net/"); await data.CallWebAPIAsync(uri, "api/Employees"); string serializedResponse = data.SerializedResponse; if (serializedResponse != "" && serializedResponse != "NotFound") { List <Dictionary <string, string> > deserializedResponse = JsonConvert.DeserializeObject <List <Dictionary <string, string> > >(serializedResponse); if (deserializedResponse.Count > 0) { foreach (Dictionary <string, string> row in deserializedResponse) { EmployeeDTO employeeDTO = new EmployeeDTO(); foreach (KeyValuePair <string, string> item in row) { switch (item.Key) { case "id": employeeDTO.Id = item.Value; break; case "name": employeeDTO.Name = item.Value; break; case "contractTypeName": employeeDTO.ContractTypeName = item.Value; break; case "roleId": employeeDTO.RoleId = item.Value; break; case "roleName": employeeDTO.RoleName = item.Value; break; case "roleDescription": employeeDTO.RoleDescription = item.Value; break; case "hourlySalary": employeeDTO.HourlySalary = item.Value; break; case "monthlySalary": employeeDTO.MonthlySalary = item.Value; break; default: break; } } if (employeeDTO.ContractTypeName == "MonthlySalaryEmployee") { MonthlySalary monthlySalary = CalculateSalaryFactory.Create <MonthlySalary>(); employeeDTO.AnnualSalary = monthlySalary.CalculateAnnualSalary(employeeDTO.MonthlySalary); } else if (employeeDTO.ContractTypeName == "HourlySalaryEmployee") { HourlySalary hourlySalary = CalculateSalaryFactory.Create <HourlySalary>(); employeeDTO.AnnualSalary = hourlySalary.CalculateAnnualSalary(employeeDTO.HourlySalary); } EmployeesDTO.Add(employeeDTO); } } } return(EmployeesDTO); }