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

            ManagementTraineeInfo m = ManagementTraineeInfo.GetManagementTraineeInfo(this.员工编号);

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

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

                ManagementTraineeInfoInput opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
Esempio n. 2
0
        public static ManagementTraineeInfoInput AddManagementTraineeInfoInput(string emplid, bool isVerify, bool copyEffective)
        {
            ManagementTraineeInfoInput item = GetManagementTraineeInfoInput(emplid, isVerify);

            if (item == null)
            {
                item = new ManagementTraineeInfoInput();

                if (copyEffective)
                {
                    //将当前的管培生信息带进来
                    ManagementTraineeInfo effectiveManagementTraineeInfo = ManagementTraineeInfo.GetManagementTraineeInfo(emplid);
                    if (effectiveManagementTraineeInfo != null)
                    {
                        item.CopyEffective = copyEffective;
                        effectiveManagementTraineeInfo.CopyWatchMember(item);
                    }
                }

                item.标识    = Guid.NewGuid();
                item.员工编号  = emplid;
                item.是验证录入 = isVerify;
                item.录入人   = "   ";
                item.录入时间  = DateTime.Now;

                item.Save();
            }
            return(item);
        }
        public static ManagementTraineePayStandard CreateFirstStandard(string emplid)
        {
            EmployeeInfo employee = EmployeeInfo.GetFromCache(emplid);

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

            ManagementTraineePayStandard item = GetManagementTraineePayStandard(emplid, 0);

            if (item == null)
            {
                //获取管培生基本信息
                ManagementTraineeInfo traineeInfo = ManagementTraineeInfo.GetManagementTraineeInfo(emplid);
                if (traineeInfo != null)
                {
                    int year = Convert.ToInt32(traineeInfo.届别);
                    item = AddManagementTraineePayStandard(emplid, employee.姓名, year, 3, 0);

                    item.年份     = year;
                    item.季度     = 3;
                    item.增幅     = 0;
                    item.年薪     = traineeInfo.年薪;
                    item.月薪     = Convert.ToInt32((item.年薪 * (decimal)10000.0) / (decimal)12.0);
                    item.开始执行时间 = new DateTime(item.年份, 7, 1);

                    item.Save();
                }
            }
            return(item);
        }
        public static List <ManagementTraineeSalary> GetMonthlySalaryList(string emplid, int year)
        {
            //获取管培生基本信息
            ManagementTraineeInfo traineeInfo = ManagementTraineeInfo.GetManagementTraineeInfo(emplid);

            return(GetMonthlySalaryList(traineeInfo, year));
        }
        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);
        }