Exemplo n.º 1
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 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();
        }