protected override void OnSaving() { StepPayRate found = GetStepPayRate(薪级标识, 执行日期); if (found != null && found.标识 != this.标识) { throw new Exception("不能重复设置职级工资"); } else { base.OnSaving(); } }
public static StepPayRate AddStepPayRate(int gradeId, int stepId, DateTime effDt) { StepPayRate rec = GetStepPayRate(stepId, effDt); if (rec == null) { rec = new StepPayRate(); rec.标识 = Guid.NewGuid(); rec.薪等标识 = gradeId; rec.薪级标识 = stepId; rec.执行日期 = effDt; rec.Save(); } return(rec); }
public EmployeePayData(EmployeeInfo employee, DateTime date, bool realtime) { this.employeeInfo = employee; this.isRealtime = realtime; 公司序号 = employee.公司序号; 职务 = employee.职务名称; 职级名称 = PsHelper.GetSupvsrLvDescr(employee.职务等级); 工龄 = employee.工龄 / (decimal)12.0; 华劲工龄 = employee.华劲工龄; 任职时间 = employee.任职时间; 是主管 = employee.职务名称 != null && (employee.职务名称.IndexOf("部门主管") != -1 || employee.职务名称.IndexOf("厂长") != -1 || employee.职务名称.IndexOf("场长") != -1); LevelInfo level = LevelInfo.职务等级表.Find(a => a.编码 == employee.职务等级); if (level != null) { 职等 = level.级别; } 年 = date.Year; 月 = date.Month; 期间_开始 = new DateTime(年, 月, 1); if (isRealtime) { 期间_开始 = 期间_开始.AddMonths(-1); } 期间_结束 = 期间_开始.AddMonths(1).AddDays(-1); if (标准职务工资表 == null) { 标准职务工资表 = StepPayRate.GetEffectives(期间_开始); } if (个人职务工资表 == null) { 个人职务工资表 = PersonPayRate.GetEffectives(期间_开始); } }
public void Calculate() { decimal 标准职务工资, 个人职务工资; 是标准职务工资 = true; 满勤奖_显示 = "—"; 年休假_显示 = "—"; 津贴补助_显示 = "—"; //获取薪酬信息 GetPayInfo(); //获取上表工资标准 SalaryBaseInfo sbi = PsHelper.GetSalaryGrade(员工编号, 期间_开始); if (sbi != null) { 表工资标准 = sbi.表工资标准; 年休假工资 = sbi.年休假工资; 满勤奖金额 = sbi.满勤奖金额; 满勤奖_显示 = 满勤奖金额 > 0 ? 满勤奖金额.ToString("#0.##") : "—"; 年休假_显示 = 年休假工资 > 0 ? 年休假工资.ToString("#0.##") : "—";; } #region 计算职务工资 StepPayRate stepPayRate = null; List <StepPayRate> rates = 标准职务工资表.FindAll(a => a.薪级标识 == 薪级_月初).OrderByDescending(a => a.执行日期).ToList(); if (rates.Count > 0) { stepPayRate = rates[0]; 开始执行日期 = 开始执行日期_月初; } //月底职级 List <StepPayRate> rates_月底 = 标准职务工资表.FindAll(a => a.薪级标识 == 薪级_月底).OrderByDescending(a => a.执行日期).ToList(); if (rates.Count > 0) { StepPayRate stepPayRate_月底 = rates[0]; //如果月底职级改变,去工资低的 if (stepPayRate_月底.标识 != stepPayRate.标识) { stepPayRate = stepPayRate.工资额 < stepPayRate_月底.工资额 ? stepPayRate : stepPayRate_月底; 开始执行日期 = 开始执行日期_月底; } } PersonPayRate personPayRate = null; List <PersonPayRate> pRates = 个人职务工资表.FindAll(a => a.生效日期 == 期间_开始 && a.员工编号 == this.员工编号).OrderByDescending(a => a.生效日期).ToList(); if (isRealtime) { pRates = 个人职务工资表.FindAll(a => a.效 && a.员工编号 == this.员工编号).OrderByDescending(a => a.生效日期).ToList(); } if (pRates.Count > 0) { personPayRate = pRates[0]; 开始执行日期 = personPayRate.生效日期; //津贴补助 津贴补助 = personPayRate.津贴1金额 + personPayRate.津贴2金额; 津贴补助_显示 = 津贴补助 > 0 ? 津贴补助.ToString("#0.##") : "—"; } 标准职务工资 = stepPayRate == null ? 0 : stepPayRate.工资额; 个人职务工资 = personPayRate == null ? 0 : personPayRate.月薪; 职务工资 = 个人职务工资 == 0 ? 标准职务工资 : 个人职务工资; 是标准职务工资 = 个人职务工资 == 0; //2017-7-23 加上年休假工资 职级工资 = 职务工资 + 年休假工资; //重新计算有效的薪等薪级 工资职级 = " - "; if (stepPayRate != null && 是标准职务工资) { 封闭薪等 = stepPayRate.薪等标识; 封闭薪级 = stepPayRate.薪级标识; SalaryNode grade = SalaryNode.工资等级表.Find(a => a.标识 == 封闭薪等); if (grade != null) { 薪等 = grade.称; } grade = SalaryNode.工资等级表.Find(a => a.标识 == 封闭薪级); if (grade != null) { 薪级 = grade.称; } 工资职级 = 薪等 + 薪级; } #endregion SalaryResult sr = SalaryResult.GetFromCache(员工编号, 年, 月); 公司编码 = sr == null ? employeeInfo.公司 : sr.公司编号; 职务等级 = sr == null ? employeeInfo.职务等级 : sr.职务等级; 职级 = PsHelper.GetSupvsrLvDescr(职务等级); }
/// <summary> /// 通过 Id 获取 /// </summary> /// <param name="id"></param> /// <returns></returns> public static StepPayRate GetStepPayRate(Guid id) { StepPayRate obj = (StepPayRate)Session.DefaultSession.GetObjectByKey(typeof(StepPayRate), id); return(obj); }