Esempio n. 1
0
        //更新到正式表
        public void UpdateToFormalTable()
        {
            if (this.内容不同的字段.Count > 0)
            {
                return;
            }

            ManagementTraineeAbility m = ManagementTraineeAbility.GetManagementTraineeAbility(员工编号, 年度);

            if (m == null)
            {
                m      = new ManagementTraineeAbility();
                m.标识   = Guid.NewGuid();
                m.创建时间 = DateTime.Now;
            }
            this.CopyWatchMember(m);
            m.序号   = this.序号;
            m.更新时间 = DateTime.Now;
            m.Save();

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

                ManagementTraineeAbilityInput opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
Esempio n. 2
0
        public ManagementTraineeYearlySalaryCalulator(ManagementTraineeInfo trainee, int year)
        {
            List <ManagementTraineeSalary> list = ManagementTraineeSalary.GetQuarterSalaryList(trainee.员工编号, year);

            一季度 = list.Find(a => a.季度 == 1);
            二季度 = list.Find(a => a.季度 == 2);
            季度  = list.Find(a => a.季度 == 3);
            四季度 = list.Find(a => a.季度 == 4);

            员工编号 = trainee.员工编号;
            年度   = year;

            管培生信息 = trainee;
            起薪    = trainee.年薪;
            if (起薪 > 0)
            {
                起薪_万元 = 起薪.ToString("#0.#");
            }
            姓名   = 管培生信息.姓名;
            公司   = 管培生信息.员工信息.公司名称;
            专业属性 = 管培生信息.专业属性;
            岗位类型 = 管培生信息.岗位类型;
            年度评定 = ManagementTraineeAbility.GetManagementTraineeAbility(员工编号, year);
            if (年度评定 != null)
            {
                评定结果 = 年度评定.能力级别;
            }
        }
        public static List <ManagementTraineePayStandard> CreatePayStandards(string emplid, int year)
        {
            EmployeeInfo employee = EmployeeInfo.GetFromCache(emplid);

            if (employee == null)
            {
                return(null);
            }

            //获取管培生基本信息
            ManagementTraineeInfo traineeInfo = ManagementTraineeInfo.GetManagementTraineeInfo(emplid);

            if (traineeInfo == null)
            {
                return(null);
            }

            DateTime start = new DateTime(year, 7, 1);
            ManagementTraineePayStandard first = CreateFirstStandard(emplid);
            //获取本年度评定前最后一次提资记录(增幅 > 0)
            ManagementTraineePayStandard latest = GetLatestRise(emplid, start);

            //如果没有找到提资记录,自动创建第一年的提资记录
            if (latest == null)
            {
                //第一年,已第一条记录为基准
                if (year == traineeInfo.入职时间.Year)
                {
                    latest = first;
                }
                else
                {
                    //创建入职当年的工资标准
                    CreatePayStandards(emplid, traineeInfo.入职时间.Year);
                    latest = GetLatestRise(emplid, start);
                }
            }
            if (latest == null)
            {
                return(null);                //如果找不到上一期提资记录,没法继续创建提资记录
            }
            //获取年度评定
            ManagementTraineeAbility ability = ManagementTraineeAbility.GetManagementTraineeAbility(emplid, year);
            string level = "A";
            string type  = traineeInfo.岗位级别 == "一级" ? traineeInfo.岗位类型 : traineeInfo.专业属性;
            //每年评定后自动产生后面四个季度的提资记录
            List <ManagementTraineePayStandard> list = new List <ManagementTraineePayStandard>();

            for (int i = 0; i < 4; i++)
            {
                decimal rise_rate    = 0;
                decimal year_salary  = latest.年薪;
                int     month_salary = latest.月薪;
                int     time         = -999; //如果次数是 -999 表示此季度不提资

                int quarter  = (i + 2) % 4 + 1;
                int the_year = quarter <= 2 ? year + 1 : year;

                int m = the_year - first.年份;
                int n = quarter - first.季度;
                int q = m * 4 + n; //距离起薪季度数

                int      x = the_year - latest.年份;
                int      y = quarter - latest.季度;
                int      quarterInterval = x * 4 + y; //距离最后一次提资季度数
                DateTime excuteStartTime = latest.开始执行时间.AddMonths(3 * quarterInterval);

                //获取提资序数
                //(第一年每半年固定提资)
                if (q <= 4)
                {
                    if (q == 2) //第一次提资
                    {
                        time = 1;
                    }
                    if (q == 4) //第二次提资
                    {
                        time = 2;
                    }
                }
                else
                {
                    if (ability == null)
                    {
                        continue;                  //如果还没有评定
                    }
                    level = ability.能力级别;
                    //默认本次提资序数=上一次提资序数+1
                    switch (level)
                    {
                    case "A":
                        if (quarterInterval >= 2)
                        {
                            time = latest.提资序数 + 1;
                        }
                        break;

                    case "B":
                        if (quarterInterval >= 3)
                        {
                            time = latest.提资序数 + 1;
                        }
                        break;

                    case "C":
                        if (quarterInterval >= 4)
                        {
                            time = latest.提资序数 + 1;
                        }
                        break;
                    }
                    //升阶(满足升阶条件,先升阶,每阶+100, 满阶是 10000)
                    double step = GetStep(traineeInfo.届别, traineeInfo.岗位级别, type, q);
                    if (step == 0)
                    {
                        time = 10000;
                    }
                    //2018-9-21 进入二阶段以后,达到也要达到提资时间间隔才能提资
                    if (step >= 2 && time > 0 && time < 100)
                    {
                        time = 100;
                    }
                }

                if (time == -999)
                {
                    continue;
                }

                ManagementTraineePayRiseStandard standard = ManagementTraineePayRiseStandard.GetManagementTraineePayRiseStandard(traineeInfo.届别, traineeInfo.岗位级别, type, level, time);
                if (standard == null)
                {
                    continue;                   //找不到提资标准
                }
                //获取增幅、年薪和月薪
                if (standard.提资方式 == (int)RiseType.金额)
                {
                    year_salary = standard.年薪;
                    rise_rate   = 100 * ((decimal)(year_salary - latest.年薪) / (decimal)latest.年薪);
                    rise_rate   = Math.Round(rise_rate, 1, MidpointRounding.AwayFromZero);
                }
                else
                {
                    rise_rate   = standard.增幅;
                    year_salary = Math.Round(latest.年薪 * (100 + rise_rate) * (decimal)0.01, 1, MidpointRounding.AwayFromZero);
                }

                month_salary = Convert.ToInt32((year_salary * (decimal)10000.0) / (decimal)12.0);

                ManagementTraineePayStandard new_item = AddManagementTraineePayStandard(emplid, employee.姓名, the_year, quarter, time);
                if (new_item != null)
                {
                    new_item.季度     = quarter;
                    new_item.年份     = the_year;
                    new_item.增幅     = rise_rate;
                    new_item.年薪     = year_salary;
                    new_item.月薪     = month_salary;
                    new_item.开始执行时间 = excuteStartTime;
                    new_item.Save();

                    list.Add(new_item);
                    latest = new_item;
                }
                if (time == 10000)
                {
                    break;                //已经满阶,退出
                }
            }
            return(list);
        }