Exemplo n.º 1
0
        //获取指定员工指定时间执行的标准
        public static SalaryStructure GetEffective(string emplid, DateTime date)
        {
            GroupOperator criteria = new GroupOperator(GroupOperatorType.And,
                                                       new BinaryOperator("员工编号", emplid, BinaryOperatorType.Equal),
                                                       new BinaryOperator("开始执行日期", date.Date, BinaryOperatorType.LessOrEqual)
                                                       );

            XPCollection objset = new XPCollection(MyHelper.XpoSession, typeof(SalaryStructure), criteria, new SortProperty("开始执行日期", SortingDirection.Descending));

            if (objset.Count > 0)
            {
                SalaryStructure item = (SalaryStructure)objset[0];
                if (item.截止日期 == DateTime.MinValue || item.截止日期 >= date.Date)
                {
                    return(item);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        //更新到正式表
        public void UpdateToFormalTable()
        {
            if (另一人录入的记录 == null || this.内容不同的字段.Count > 0)
            {
                return;
            }

            SalaryStructure m = SalaryStructure.AddSalaryStructure(this.员工编号, this.开始执行日期);

            this.CopyWatchMember(m);

            m.创建人  = this.录入人;
            m.创建时间 = DateTime.Now;
            m.Save();

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

                SalaryStructureEntry opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
Exemplo n.º 3
0
        protected override void OnSaving()
        {
            SalaryStructure found = GetSalaryStructure(this.员工编号, this.开始执行日期);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("已存在该员工的相同薪酬结构记录,不能重复创建。");
            }
            else
            {
                base.OnSaving();
            }

            SALARY_STRUCTURE_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
Exemplo n.º 4
0
        public static SalaryStructure AddSalaryStructure(string emplid, DateTime effDate)
        {
            SalaryStructure item = GetSalaryStructure(emplid, effDate);

            if (item == null)
            {
                item        = new SalaryStructure();
                item.标识     = Guid.NewGuid();
                item.员工编号   = emplid;
                item.开始执行日期 = effDate;
                item.创建人    = AccessController.CurrentUser.姓名;
                item.创建时间   = DateTime.Now;
                item.Save();
            }
            return(item);
        }
Exemplo n.º 5
0
        public static SalaryStructure GetSalaryStructure(Guid id)
        {
            SalaryStructure obj = (SalaryStructure)Session.DefaultSession.GetObjectByKey(typeof(SalaryStructure), id);

            return(obj);
        }
        public EmployeeSalaryStructure(EmployeeInfo empInfo)
        {
            DateTime 期间开始 = DateTime.Today;

            员工信息 = empInfo;

            薪酬结构 = SalaryStructure.GetEffective(empInfo.员工编号, 期间开始);
            借款工资 = WageLoan.GetEffective(empInfo.员工编号, 期间开始);
            报账工资 = RembursementSalary.GetEffective(empInfo.员工编号, 期间开始);
            月薪标准 = MonthlySalary.GetEffective(empInfo.员工编号, 期间开始);

            //处理,获取相关数据
            this.员工编号 = empInfo.员工编号;
            this.姓名   = empInfo.姓名;
            this.性别   = empInfo.性别;
            this.职务   = empInfo.职务名称;
            this.公司   = empInfo.公司;
            this.部门   = empInfo.部门名称;
            this.职等   = empInfo.职等;

            if (月薪标准 != null)
            {
                this.开始执行日期  = 月薪标准.开始执行日期;
                this.年薪_12个月 = 月薪标准.执行_月薪 * 12;
                this.年薪_合计   = 月薪标准.执行_月薪 * 12;
                this.月薪项目_小计 = 月薪标准.执行_月薪;
            }
            if (薪酬结构 != null)
            {
                this.结构类型    = 薪酬结构.类型;
                this.年薪_奖励   = 薪酬结构.年薪_奖励;
                this.年薪_绩效工资 = 薪酬结构.年薪_绩效工资;
                this.年薪_12个月 = 薪酬结构.年薪_12个月;
                this.年薪_合计   = 薪酬结构.年薪_合计;

                this.月薪项目_月工资    = 薪酬结构.月薪项目_月工资;
                this.月薪项目_年休假    = 薪酬结构.月薪项目_年休假;
                this.月薪项目_满勤奖    = 薪酬结构.月薪项目_满勤奖;
                this.月薪项目_交通餐饮补贴 = 薪酬结构.月薪项目_交通餐饮补贴;
                this.月薪项目_小计     = 薪酬结构.月薪项目_小计;

                this.月薪项目_减项_绩效工资 = 薪酬结构.月薪项目_减项_绩效工资;
                this.开始执行日期       = 薪酬结构.开始执行日期;
            }
            else
            {
                this.结构类型  = "标准";
                this.年薪_奖励 = 0;

                this.月薪项目_交通餐饮补贴 = PsHelper.GetTrafficSubsidies(员工编号, 期间开始);
                this.月薪项目_满勤奖    = PsHelper.GetFullAttendancePayFromCache(empInfo.薪资体系, empInfo.薪等, 期间开始);
                this.月薪项目_年休假    = PsHelper.GetVacPayFromCache(empInfo.薪资体系, empInfo.薪等, 期间开始);
                this.月薪项目_月工资    = 月薪项目_小计 - 月薪项目_满勤奖 - 月薪项目_年休假 - 月薪项目_交通餐饮补贴;
            }
            if (借款工资 != null)
            {
                月薪项目_减项_工资借款 = 借款工资.月借款额度;
            }
            if (报账工资 != null)
            {
                月薪项目_减项_报账工资 = 报账工资.月度可报账标准_税前;
            }
        }