public static List <ImplementJobGrade> GetImplementJobGradeList(string salary_plan, int year, SemiannualType semiannual, bool insert_separator)
        {
            List <ImplementJobGrade> gradeList = new List <ImplementJobGrade>();

            int period = year * 10 + (byte)semiannual;
            List <RankSalaryStandard> rss_list  = RankSalaryStandard.GetRankSalaryStandards(salary_plan, null, period);
            List <string>             jobGrades = RankSalaryStandard.GetGrades(rss_list);

            foreach (string grade in jobGrades)
            {
                ImplementJobGrade snGrade = new ImplementJobGrade(salary_plan, grade, year, semiannual);
                gradeList.Add(snGrade);
            }
            gradeList = gradeList.OrderBy(a => a.序号).ToList();
            string ranknames = "";
            List <ImplementJobGrade> grades_result = new List <ImplementJobGrade>();

            //遍历
            foreach (ImplementJobGrade grade in gradeList)
            {
                //如果职级划分不同,插入一行分割数据
                if (ranknames != grade.RankNames)
                {
                    if (ranknames != "")
                    {
                        grades_result.Add(new ImplementJobGrade(grade.RankNames));
                    }

                    ranknames = grade.RankNames;
                }
                grades_result.Add(grade);
            }
            return(grades_result);
        }
예제 #2
0
        //更新到正式表
        public void UpdateToFormalTable()
        {
            if (this.内容不同的字段.Count > 0)
            {
                return;
            }

            RankSalaryStandard m = RankSalaryStandard.GetRankSalaryStandard(this.薪酬体系, this.职等, this.职级, this.期号);

            if (m == null)
            {
                m    = new RankSalaryStandard();
                m.标识 = Guid.NewGuid();
            }
            this.CopyWatchMember(m);
            m.Save();

            //更新生效标记
            if (!this.已生效)
            {
                this.生效时间 = DateTime.Now;
                this.Save();

                RankSalaryStandardInput opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
        protected override void OnSaving()
        {
            RankSalaryStandard found = GetRankSalaryStandard(this.薪酬体系, this.职等, this.职级, this.期号);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("本期已存在同职级的标准,不能创建。");
            }
            else
            {
                base.OnSaving();
            }

            RANK_SALARY_STANDARD_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
        public static RankSalaryStandard AddRankSalaryStandard(string salaryPlan, string grade, string rank, int period)
        {
            RankSalaryStandard item = GetRankSalaryStandard(salaryPlan, grade, rank, period);

            if (item == null)
            {
                item      = new RankSalaryStandard();
                item.标识   = Guid.NewGuid();
                item.薪酬体系 = salaryPlan;
                item.职等   = grade;
                item.职级   = rank;
                item.期号   = period;

                item.Save();
            }
            return(item);
        }
        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);
        }
        //新建职级工资调整表
        public static List <GradeSalaryAdjustInput> CreateGradeSalaryAdjustTable(string salary_plan, int period, bool isVerify)
        {
            List <GradeSalaryAdjustInput> list = new List <GradeSalaryAdjustInput>();

            int prev_period = RankSalaryStandard.GetPreviousPeriod(salary_plan, period);

            if (prev_period == -1)
            {
                return(null);                   //找不到上一期,无法生成新的记录
            }
            //获取上期的调整记录
            List <GradeSalaryAdjust> prev_list = GradeSalaryAdjust.GetGradeSalaryAdjusts(salary_plan, prev_period, 0);

            //逐个职等创建新记录
            foreach (GradeSalaryAdjust gsa in prev_list)
            {
                list.Add(AddGradeSalaryAdjustInput(gsa, period, isVerify));
            }

            return(list);
        }
예제 #7
0
        //重新统计
        public void Calculate()
        {
            int    differential   = 0;
            double total          = 0;
            int    avg            = 0;
            double yearAdjustRate = 1;
            int    max            = 0;
            int    min            = 0;

            List <IRankSalary> rss_list = new List <IRankSalary>();

            if (类型 == 0)
            {
                foreach (IRankSalary irs in RankSalaryStandard.GetRankSalaryStandards(this.薪酬体系, this.职等, this.期号))
                {
                    rss_list.Add(irs);
                }
            }
            else
            {
                foreach (IRankSalary irs in RankSalaryStandardInput.GetRankSalaryStandardInputs(this.薪酬体系, this.职等, this.期号, this.类型 == 2))
                {
                    rss_list.Add(irs);
                }
            }

            rss_list = rss_list.FindAll(a => a.月薪 > 0).ToList(); //过滤掉没有设置月薪的记录

            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 计算年调率

            this.每年调资额 = Convert.ToInt32(this.半年调资额 * 1.5);

            int previous_period            = RankSalaryStandard.GetPreviousPeriod(this.薪酬体系, this.期号);
            GradeSalaryAdjust previous_gsh = GradeSalaryAdjust.GetGradeSalaryAdjust(this.薪酬体系, this.职等, previous_period, 0);
            //如果找到上期数据(通取正式数据)
            if (previous_gsh != null)
            {
                int avg_previous = previous_gsh.平均工资;
                if (avg_previous > 0)
                {
                    yearAdjustRate = (double)每年调资额 / avg_previous;
                }
            }
            else //首次标准
            {
                if (avg != 0)
                {
                    yearAdjustRate = (double)每年调资额 / avg;
                }
            }

            #endregion

            this.级差   = differential;
            this.年调率  = yearAdjustRate;
            this.平均工资 = avg;
            this.最低工资 = min;
            this.最高工资 = max;

            #region 计算职等差

            //获取对比的职等
            GradeSalaryAdjust contrast = GradeSalaryAdjust.GetFromCache(this.薪酬体系, this.对比的职等, this.期号, this.类型);
            if (contrast != null)
            {
                this.职等差 = contrast.最低工资 - this.最高工资;
            }

            #endregion

            this.Save();
        }
        public static RankSalaryStandard GetRankSalaryStandard(Guid id)
        {
            RankSalaryStandard obj = (RankSalaryStandard)Session.DefaultSession.GetObjectByKey(typeof(RankSalaryStandard), id);

            return(obj);
        }
        public ImplementJobGrade(string salaryPlan, string grade, int year, SemiannualType semiannual)
        {
            is_separator = false;

            this.year   = year;
            this.period = year * 10 + (byte)semiannual;

            薪酬体系 = salaryPlan;
            职等   = grade;
            期号   = period;

            ID = salaryPlan + grade + period;

            RankNames = "";

            rss_list = RankSalaryStandard.GetRankSalaryStandards(salaryPlan, grade, period);
            foreach (RankSalaryStandard rss in rss_list)
            {
                开始执行日期 = rss.开始执行日期;
                //赋值
                string propertyName  = "R" + rss.序号;
                string monthlySalary = rss != null?rss.月薪.ToString() : "";

                PropertyInfo property = this.GetType().GetProperty(propertyName);
                if (property != null)
                {
                    property.SetValue(this, monthlySalary, null);
                }

                if (RankNames != "")
                {
                    RankNames += ":";
                }
                RankNames += rss.职级;
            }
            GradeSalaryAdjust gsa = GradeSalaryAdjust.GetGradeSalaryAdjust(salaryPlan, grade, period, 0);

            if (gsa == null)
            {
                gsa = GradeSalaryAdjust.AddGradeSalaryAdjust(salaryPlan, grade, period, 0);
                gsa.Calculate();
            }

            序号    = gsa.职等数;
            职等数   = gsa.职等数.ToString();
            级差    = gsa.级差.ToString();
            平均工资  = gsa.平均工资.ToString();
            最低工资  = gsa.最低工资;
            最高工资  = gsa.最高工资;
            对比的职等 = gsa.对比的职等;

            if (gsa.年调率 > 0)
            {
                半年调资额 = gsa.半年调资额.ToString();
                年调    = gsa.每年调资额.ToString();

                半年调率 = (gsa.年调率 * 100 / 1.5).ToString("#0.#") + "%";
                年调率  = (gsa.年调率 * 100).ToString("#0.#") + "%";
            }

            if (gsa.年调率 == 1)
            {
                年调率 = "";
            }
            if (!string.IsNullOrEmpty(对比的职等))
            {
                职等差 = gsa.职等差.ToString();
            }
            if (gsa.期调整 != null)
            {
                期级别平均 = gsa.期调整.平均工资.ToString();
            }
        }
 //获取上一期的标准
 public static List <RankSalaryStandard> GetPreviousPeriodStandards(string salaryPlan, string group, int period)
 {
     return(RankSalaryStandard.GetPreviousPeriodStandards(salaryPlan, group, period));
 }