Ejemplo 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();
            }
        }
        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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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 <ManagementTraineeSalary> GetMonthlySalaryList(string emplid, int year)
        {
            //获取管培生基本信息
            ManagementTraineeInfo traineeInfo = ManagementTraineeInfo.GetManagementTraineeInfo(emplid);

            return(GetMonthlySalaryList(traineeInfo, year));
        }
Ejemplo n.º 6
0
        public static ManagementTraineeInfo AddManagementTraineeInfo(string empNo, string name)
        {
            ManagementTraineeInfo item = GetManagementTraineeInfo(empNo);

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

                item.标识   = Guid.NewGuid();
                item.员工编号 = empNo;
                item.姓名   = name;
                item.更新时间 = DateTime.Now;
                item.Save();
            }
            return(item);
        }
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.届别))
            {
                throw new Exception("届别不能为空.");
            }
            if (string.IsNullOrEmpty(this.岗位级别))
            {
                throw new Exception("岗位级别不能为空.");
            }
            if (string.IsNullOrEmpty(this.学历))
            {
                throw new Exception("学历不能为空.");
            }
            if (string.IsNullOrEmpty(this.专业名称))
            {
                throw new Exception("专业名称不能为空.");
            }

            if (!ManagementTraineeInfo.CheckSpecialtyValid(Convert.ToInt32(届别), 岗位级别, 学历, 专业名称))
            {
                throw new Exception("专业名称无效.");
            }

            ManagementSpecialtyPropertyInput found = GetManagementSpecialtyPropertyInput(this.届别, this.岗位级别, this.学历, this.专业名称, this.是验证录入);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("已经存在该专业的属性信息,不能重复创建");
            }
            else
            {
                base.OnSaving();
            }

            contentDifferentFields = null;
            MANAGEMENT_SPECIALTY_PROPERTY_INPUT_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
Ejemplo n.º 8
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.姓名))
            {
                throw new Exception("姓名不能为空");
            }
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空.");
            }

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

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("已经存在该员工的管培生基本信息,不能重复创建");
            }
            else
            {
                base.OnSaving();
            }

            MMANAGEMENTTRAINEEINFO_CACHE.Set(CacheKey, this, TimeSpan.FromHours(4));
        }
Ejemplo n.º 9
0
        public static ManagementTraineeInfo GetManagementTraineeInfo(Guid id)
        {
            ManagementTraineeInfo obj = (ManagementTraineeInfo)Session.DefaultSession.GetObjectByKey(typeof(ManagementTraineeInfo), id);

            return(obj);
        }
        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);
        }
        //获取值指定管培生月薪表
        public static List <ManagementTraineeSalary> GetMonthlySalaryList(ManagementTraineeInfo trainee, int year)
        {
            List <ManagementTraineeSalary> list = new List <ManagementTraineeSalary>();

            if (trainee == null)
            {
                return(list);
            }

            //获取本年所有提资记录
            List <ManagementTraineePayStandard> standards = ManagementTraineePayStandard.GetManagementTraineePayStandards(trainee.员工编号);

            standards = standards.OrderByDescending(a => a.开始执行时间).ToList(); //倒序, 以便按时间找到的第一条记录就是执行的记录
            ManagementTraineePayStandard last_rise = null;

            if (standards.Count > 0)
            {
                //上月标准(去年最后一次提资)
                ManagementTraineePayStandard prev = standards.Find(a => a.开始执行时间 < new DateTime(year, 1, 1));
                //最近一次评定
                ManagementTraineeAbility last_ability = ManagementTraineeAbility.GetLastAbility(trainee.员工编号);
                //最近一次提资
                last_rise = standards[0]; //最后一次提资
                //构造月薪记录
                for (int i = 1; i <= 12; i++)
                {
                    ManagementTraineeSalary salary = new ManagementTraineeSalary();
                    DateTime start = new DateTime(year, i, 1);
                    ManagementTraineePayStandard effectiveStandard = standards.Find(a => a.开始执行时间 <= start);
                    //如果有执行标准
                    if (effectiveStandard != null)
                    {
                        salary.员工编号  = trainee.员工编号;
                        salary.姓名    = trainee.姓名;
                        salary.年份    = year;
                        salary.季度    = (int)((i - 0.5) / 3) + 1;
                        salary.月份    = i;
                        salary.专业属性  = trainee.专业属性;
                        salary.管培生信息 = trainee;
                        salary.年薪    = effectiveStandard.年薪;
                        salary.月薪    = effectiveStandard.月薪;
                        if (prev != null && salary.年薪 > prev.年薪)
                        {
                            salary.增幅 = effectiveStandard.增幅.ToString("#0.##") + "%";
                        }

                        if (salary.年薪 > 0)
                        {
                            salary.年薪_万元 = salary.年薪.ToString("#0.#");
                        }

                        //不能超过最后一次提资记录的那个季度,
                        int x = salary.年份 - last_rise.年份;
                        int y = salary.季度 - last_rise.季度;
                        if (x * 4 + y <= 0)
                        {
                            list.Add(salary);
                        }
                        else
                        {
                            if (last_ability != null)
                            {
                                int m = salary.年份 - last_ability.年度;
                                int n = salary.季度 - 3;
                                if (m * 4 + n < 4)
                                {
                                    list.Add(salary);
                                }
                            }
                        }
                        prev = effectiveStandard;
                    }
                }
            }
            return(list);
        }