protected void LoadData(bool compare) { CreateWaitDialog("正在查询...", "请稍等"); monthly_salary_list = MonthlySalaryInput.GetEditingRows(this.salary_plan, group, period, isCheck); //如果没有记录,自动创建 if (monthly_salary_list.Count == 0) { monthly_salary_list = CreateEditingRows(); } //如果比较 if (compare) { monthly_salary_list_opposite = MonthlySalaryInput.GetEditingRows(this.salary_plan, group, period, !isCheck); } //设置备注 foreach (MonthlySalaryInput ms in monthly_salary_list) { if (jobgrade == null) { ms.执行_月薪类型 = "特资"; } } SetWaitDialogCaption("正在加载..."); gridControl1.DataSource = monthly_salary_list; gridControl1.Refresh(); advBandedGridView1.ExpandAllGroups(); CloseWaitDialog(); showDifferent = compare; }
private void advBandedGridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { MonthlySalaryInput row = advBandedGridView1.GetRow(e.FocusedRowHandle) as MonthlySalaryInput; //重置职等列表 if (jobgrade == null && row != null) { JobGrade currJobGrade = JobGrade.GetJobGrade(row.薪酬体系, row.职等); if (currJobGrade != null) { repositoryItemRank.ReadOnly = false; repositoryItemSalaryType.ReadOnly = false; repositoryItemRank.Items.Clear(); repositoryItemRank.Items.Add(""); foreach (JobRank rank in currJobGrade.职级表) { repositoryItemRank.Items.Add(rank.称); } } else { repositoryItemRank.ReadOnly = true; repositoryItemSalaryType.ReadOnly = true; repositoryItemRank.Items.Clear(); } } }
private void btn清除未生效记录_Click(object sender, EventArgs e) { if (MessageBox.Show("本次操作将删除未生效的记录,继续吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes) { //清除旧的记录 MonthlySalaryInput.ClearMonthlySalaryInput(salary_plan, group, -1, isCheck); emp_list = GetEmployeeList(); CreateEditingRows(); LoadData(false); } }
private void OnEmployeeSelectd(object sender, EmployeeInfo emp) { if (monthly_salary_list.Find(a => a.员工编号 == emp.员工编号) == null) { MonthlySalaryInput item = AddRow(monthly_salary_list.Count + 1, emp); monthly_salary_list.Add(item); UpdateRowNumber(); gridControl1.RefreshDataSource(); advBandedGridView1.FocusedRowHandle = advBandedGridView1.RowCount - 1; } }
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); }
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); }
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(); int order = 1; foreach (EmployeeInfo emp in emp_list) { MonthlySalaryInput ms = AddRow(order, emp); list.Add(ms); order++; } return(list); }
//更新行号 void UpdateRowNumber() { int order = 1; foreach (MonthlySalaryInput item in monthly_salary_list) { item.序号 = order; item.Save(); MonthlySalaryInput item_opposite = item.另一人录入的记录; if (item_opposite != null) { item_opposite.序号 = order; item_opposite.Save(); } order++; } }
private void advBandedGridView1_CellValueChanged(object sender, CellValueChangedEventArgs e) { //如果评定职级发生改变 if (e.Column.FieldName == "评定_职级") { MonthlySalaryInput row = advBandedGridView1.GetRow(e.RowHandle) as MonthlySalaryInput; if (row != null) { RankSalaryStandard rss = RankSalaryStandard.GetEffectRankSalaryStandard(row.薪酬体系, row.职等, row.评定_职级, DateTime.Today); if (rss != null) { row.评定_月薪 = rss.月薪; } else { row.评定_月薪 = 0; } row.Save(); gridControl1.Refresh(); } } //如果执行职级发生改变 if (e.Column.FieldName == "执行_职级" || e.Column.FieldName == "执行_月薪类型") { MonthlySalaryInput row = advBandedGridView1.GetRow(e.RowHandle) as MonthlySalaryInput; if (row != null && row.执行_月薪类型 == "常资") { RankSalaryStandard rss = RankSalaryStandard.GetEffectRankSalaryStandard(row.薪酬体系, row.职等, row.执行_职级, DateTime.Today); if (rss != null) { row.执行_月薪 = rss.月薪; } else { row.执行_月薪 = 0; } row.Save(); gridControl1.Refresh(); } } }
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 btn删除_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { if (MessageBox.Show("确实删除当前记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes) { MonthlySalaryInput currentItem = (MonthlySalaryInput)colView.GetFocusedRow(); monthly_salary_list.Remove(currentItem); MyHelper.WriteLog(LogType.信息, "删除员工月薪执行录入记录", currentItem.ToString <MonthlySalaryInput>()); UpdateRowNumber(); gridControl1.RefreshDataSource(); currentItem.Delete(); MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { if (showDifferent == false) { return; } e.Appearance.ForeColor = Color.Black; e.Appearance.BackColor = Color.Transparent; MonthlySalaryInput row = advBandedGridView1.GetRow(e.RowHandle) as MonthlySalaryInput; if (row != null) { foreach (ModifyField field in row.内容不同的字段) { if (field.称 == e.Column.FieldName) { e.Appearance.ForeColor = Color.Yellow; e.Appearance.BackColor = Color.Red; } } } }