Ejemplo n.º 1
0
        private static void SumKpi(List <KpiItem> items, string empLid, int year, int month)
        {
            if (string.IsNullOrEmpty(empLid))
            {
                return;
            }

            List <KpiItem> list   = items.FindAll(a => a.员工编号 == empLid && a.年 == year && a.月 == month);
            decimal        个人执行绩效 = list.Sum(a => a.个人绩效标准);
            decimal        个人绩效实得 = list.Sum(a => a.个人绩效实得);
            decimal        公司奖励实得 = list.Sum(a => a.公司奖励实得);
            decimal        实得绩效工资 = 个人绩效实得 + 公司奖励实得;

            EffectivePerformanceSalary 绩效考核 = EffectivePerformanceSalary.AddEffectivePerformanceSalary(empLid, year, month);

            if (绩效考核 != null)
            {
                绩效考核.姓名   = PsHelper.GetEmplName(empLid);
                绩效考核.绩效工资 = 个人执行绩效;
                绩效考核.实得工资 = 实得绩效工资;
                绩效考核.录入人  = "系统同步获取";
                绩效考核.录入时间 = DateTime.Now;
                绩效考核.Save();
            }
        }
Ejemplo n.º 2
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空。");
            }
            if (PsHelper.GetEmplName(this.员工编号) == "")
            {
                throw new Exception("找不到指定员工编号的员工。");
            }

            if (string.IsNullOrEmpty(编号))
            {
                if (this.生效日期 == DateTime.MinValue)
                {
                    throw new Exception("生效日期不能为空。");
                }

                if (this.标识 == Guid.Empty)
                {
                    this.标识 = Guid.NewGuid();
                }
                this.编号 = GetNewNumber();
                //如果是新编号,更新编号信息的当前序号
                this.NumberInfo.UpdateCurrentSN();

                PerformanceSalaryInput found = Get(this.编号, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("同一编号【{0}】不能重复创建,请稍后重试。", this.编号));
                }

                found = GetEditing(this.员工编号, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("该员工【{0}】已经有一条绩效工资正在录入,不能重复。", this.员工编号));
                }
            }

            if (另一人录入的记录 != null)
            {
                TimeSpan ts = DateTime.Now - 另一人录入的记录.录入时间;
                if (ts.TotalMilliseconds > 10000 && 另一人录入的记录.录入人 == AccessController.CurrentUser.姓名)
                {
                    throw new Exception("两次录入不能是同一个人。");
                }
            }

            if (string.IsNullOrEmpty(this.录入人) || (DateTime.Now - this.录入时间).TotalMilliseconds > 10000)
            {
                this.录入人  = AccessController.CurrentUser.姓名;
                this.录入时间 = DateTime.Now;
            }

            if (this.双人录入结果 == null)
            {
                this.双人录入结果 = "";
            }
            base.OnSaving();
        }
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空。");
            }
            if (PsHelper.GetEmplName(this.员工编号) == "")
            {
                throw new Exception("找不到指定员工编号的员工。");
            }

            if (string.IsNullOrEmpty(编号))
            {
                if (this.标识 == Guid.Empty)
                {
                    this.标识 = Guid.NewGuid();
                }
                this.编号 = GetNewNumber();
                //如果是新编号,更新编号信息的当前序号
                this.NumberInfo.UpdateCurrentSN();

                EffectivePerformanceSalaryInput found = Get(this.编号, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("同一编号【{0}】不能重复创建,请稍后重试。", this.编号));
                }

                found = GetEditing(this.员工编号, this.年, this.月, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("该员工【{0}】已经有一条执行的绩效工资记录正在录入,不能重复。", this.员工编号));
                }
            }

            if (this.双人录入结果 == null)
            {
                this.双人录入结果 = "";
            }

            base.OnSaving();
        }
Ejemplo n.º 4
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空。");
            }
            if (PsHelper.GetEmplName(this.员工编号) == "")
            {
                throw new Exception("找不到指定员工编号的员工。");
            }
            if (string.IsNullOrEmpty(this.项目))
            {
                throw new Exception("项目不能为空。");
            }

            //获取报销标准
            ReimbursementStandard reimbursementStandard = ReimbursementStandard.GetEffective(this.员工编号, this.项目, new DateTime(this.年, this.月, 1));

            if (reimbursementStandard == null)
            {
                throw new Exception("找不到该员工的 " + this.项目 + " 报销标准,不能录入。");
            }
            else
            {
                if (this.报销金额 > reimbursementStandard.报销金额)
                {
                    throw new Exception("报销金额不能大于报销标准。");
                }
            }

            if (string.IsNullOrEmpty(编号))
            {
                if (this.标识 == Guid.Empty)
                {
                    this.标识 = Guid.NewGuid();
                }

                PersonReimbursementInput other = GetEditing(this.员工编号, this.年, this.月, this.项目, !this.是验证录入);
                this.编号 = other == null?GetNewNumber() : other.编号;

                //如果是新编号,更新编号信息的当前序号
                this.NumberInfo.UpdateCurrentSN();

                PersonReimbursementInput found = Get(this.编号, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("同一编号【{0}】不能重复创建,请稍后重试。", this.编号));
                }

                found = GetEditing(this.员工编号, this.年, this.月, this.项目, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("该员工【{0}】已经有一条{1}报销记录正在录入,不能重复。", this.员工编号, this.项目));
                }
            }

            if (另一人录入的记录 != null)
            {
                TimeSpan ts = DateTime.Now - 另一人录入的记录.录入时间;
                if (ts.TotalMilliseconds > 10000 && 另一人录入的记录.录入人 == AccessController.CurrentUser.姓名)
                {
                    throw new Exception("两次录入不能是同一个人。");
                }
            }

            if (string.IsNullOrEmpty(this.录入人) || (DateTime.Now - this.录入时间).TotalMilliseconds > 10000)
            {
                this.录入人  = AccessController.CurrentUser.姓名;
                this.录入时间 = DateTime.Now;
            }

            if (this.双人录入结果 == null)
            {
                this.双人录入结果 = "";
            }
            base.OnSaving();
        }