//更新到正式表
        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();
            }
        }
Esempio n. 2
0
        //更新正式调整记录
        public void UpdateToFormalRecord()
        {
            GradeSalaryAdjust gsa = GetGradeSalaryAdjust(this.薪酬体系, this.职等, this.期号, 0);

            if (gsa == null)
            {
                gsa = AddGradeSalaryAdjust(this.薪酬体系, this.职等, this.期号, 0);
            }
            this.CopyWatchMember(gsa);
            gsa.Save();
        }
Esempio n. 3
0
        void LoadData()
        {
            //分隔行没有数据
            if (is_separator)
            {
                return;
            }

            薪酬体系 = jobGrade.薪酬体系;
            称    = jobGrade.称;
            期号   = period;
            职等   = jobGrade;

            RankNames = "";
            标识        = jobGrade.标识;

            rss_list.Clear();

            List <JobRank> jobranks = JobRank.GetJobRanks(jobGrade.标识);

            foreach (JobRank rank in jobranks)
            {
                //本期标准
                RankSalaryStandardInput rss = RankSalaryStandardInput.AddRankSalaryStandardInput(jobGrade.薪酬体系, jobGrade.称, rank.称, period, rank.序号, is_verify);
                rss_list.Add(rss);
                开始执行日期 = rss.开始执行日期;
                //赋值
                string       propertyName  = "R" + rss.序号;
                string       monthlySalary = rss.月薪.ToString();
                PropertyInfo property      = this.GetType().GetProperty(propertyName);
                if (property != null)
                {
                    property.SetValue(this, monthlySalary, null);
                }

                if (RankNames != "")
                {
                    RankNames += ":";
                }
                RankNames += rank.称;
            }

            int t = is_verify ? 2 : 1; //统计表类型:0: 正式, 1: 初次录入, 2: 验证录入

            gsa = GradeSalaryAdjust.GetGradeSalaryAdjust(jobGrade.薪酬体系, jobGrade.称, period, t);
            if (gsa == null)
            {
                gsa = GradeSalaryAdjust.AddGradeSalaryAdjust(jobGrade.薪酬体系, jobGrade.称, period, t);
                gsa.Calculate();
            }

            SetFieldValue();
        }
Esempio n. 4
0
        protected override void OnSaving()
        {
            GradeSalaryAdjust found = GetGradeSalaryAdjust(this.薪酬体系, this.职等, this.期号, this.类型);

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

            GRADE_SALARY_COUNTER_CACHE.Set(CacheKey, this, TimeSpan.FromHours(4));
        }
        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);
        }
Esempio n. 7
0
        public static GradeSalaryAdjust AddGradeSalaryAdjust(string salaryPlan, string grade, int period, int type)
        {
            GradeSalaryAdjust item = GetGradeSalaryAdjust(salaryPlan, grade, period, type);

            if (item == null)
            {
                item      = new GradeSalaryAdjust();
                item.标识   = Guid.NewGuid();
                item.薪酬体系 = salaryPlan;
                item.职等   = grade;
                item.期号   = period;
                item.类型   = type;

                JobGrade jobGrade = JobGrade.GetJobGrade(salaryPlan, grade);
                if (jobGrade != null)
                {
                    item.职等数   = jobGrade.职等数;
                    item.对比的职等 = jobGrade.对比的职等;
                    item.序号    = jobGrade.序号;
                }
                item.Save();
            }
            return(item);
        }
Esempio n. 8
0
        public static GradeSalaryAdjust GetGradeSalaryAdjust(Guid id)
        {
            GradeSalaryAdjust obj = (GradeSalaryAdjust)Session.DefaultSession.GetObjectByKey(typeof(GradeSalaryAdjust), id);

            return(obj);
        }
Esempio n. 9
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 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();
            }
        }