//更新到正式表 public void UpdateToFormalTable() { if (this.内容不同的字段.Count > 0) { return; } GradeSalaryAdjust m = GradeSalaryAdjust.GetGradeSalaryAdjust(this.薪酬体系, this.职等, this.期号, 0); if (m == null) { m = new GradeSalaryAdjust(); m.标识 = Guid.NewGuid(); } this.CopyWatchMember(m); m.Save(); //更新生效标记 if (!this.已生效) { this.生效时间 = DateTime.Now; this.Save(); GradeSalaryAdjustInput opposite = 另一人录入的记录; opposite.生效时间 = DateTime.Now; opposite.Save(); } }
public static GradeSalaryAdjustInput AddGradeSalaryAdjustInput(GradeSalaryAdjust prev_gsa, int period, bool isVerify) { GradeSalaryAdjustInput item = GetGradeSalaryAdjustInput(prev_gsa.薪酬体系, prev_gsa.职等, period, isVerify); if (item == null) { item = new GradeSalaryAdjustInput(); item.标识 = Guid.NewGuid(); item.薪酬体系 = prev_gsa.薪酬体系; item.职等 = prev_gsa.职等; item.期号 = period; item.是验证录入 = isVerify; //复制上一期的数据 item.职等数 = prev_gsa.职等数; item.对比的职等 = prev_gsa.对比的职等; item.序号 = prev_gsa.序号; item.级差 = prev_gsa.级差; item.半年调资额 = prev_gsa.半年调资额; item.每年调资额 = prev_gsa.每年调资额; item.Save(); //自动创建职级工资记录 List <RankSalaryStandardInput> rss_list = new List <RankSalaryStandardInput>(); //获取上一期的职级工资列表 List <RankSalaryStandard> prev_rss_lilst = RankSalaryStandard.GetRankSalaryStandards(prev_gsa.薪酬体系, prev_gsa.职等, prev_gsa.期号); foreach (RankSalaryStandard rss in prev_rss_lilst) { //创建 RankSalaryStandardInput new_rss = RankSalaryStandardInput.AddRankSalaryStandardInput(rss.薪酬体系, rss.职等, rss.职级, period, rss.序号, isVerify); //自动更新数据 new_rss.月薪 = rss.月薪 + item.半年调资额; new_rss.录入人 = "系统"; new_rss.录入时间 = DateTime.Now; new_rss.Save(); rss_list.Add(new_rss); } item.职级工资表 = rss_list; } return(item); }
protected override void OnSaving() { if (is_separator) { throw new Exception("分隔行不能保存"); } GradeSalaryAdjustInput found = GetGradeSalaryAdjustInput(this.薪酬体系, this.职等, this.期号, this.是验证录入); if (found != null && found.标识 != this.标识) { throw new Exception("本期已存在同职等的调整记录,不能重复创建。"); } else { base.OnSaving(); } contentDifferentFields = null; GRADE_SALARY_ADJUST_INPUT_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1)); }
public static GradeSalaryAdjustInput GetGradeSalaryAdjustInput(Guid id) { GradeSalaryAdjustInput obj = (GradeSalaryAdjustInput)Session.DefaultSession.GetObjectByKey(typeof(GradeSalaryAdjustInput), id); return(obj); }
//重新统计 public void Calculate() { int differential = 0; int halfYearAdjust = 0; //半年调 int yearAdjust = 0; double total = 0; int avg = 0; double yearAdjustRate = 0; int max = 0; int min = 0; List <RankSalaryStandardInput> rss_list = RankSalaryStandardInput.GetRankSalaryStandardInputs(this.薪酬体系, this.职等, this.期号, this.是验证录入); if (rss_list.Count > 0) { total = rss_list.Sum(a => a.月薪); avg = (int)(total / rss_list.Count); min = rss_list.Min(a => a.月薪); max = rss_list.Max(a => a.月薪); if (rss_list.Count >= 2) { IRankSalary rss0 = rss_list[0]; IRankSalary rss1 = rss_list[1]; differential = rss0.月薪 - rss1.月薪; } } #region 计算年调率 if (this.期调整 != null) { int avg_previous = previous_gsh.平均工资; if (avg_previous > 0) { halfYearAdjust = avg - previous_gsh.平均工资; yearAdjust = halfYearAdjust * 2; yearAdjustRate = (double)yearAdjust / avg_previous; } } #endregion this.级差 = differential; this.半年调资额 = halfYearAdjust; this.每年调资额 = yearAdjust; this.年调率 = yearAdjustRate; this.平均工资 = avg; this.最低工资 = min; this.最高工资 = max; #region 计算职等差 //获取对比的职等 GradeSalaryAdjustInput contrast = GradeSalaryAdjustInput.GetGradeSalaryAdjustInput(this.薪酬体系, this.对比的职等, this.期号, this.是验证录入); if (contrast != null) { this.职等差 = contrast.最低工资 - this.最高工资; } #endregion this.Save(); }