//更新到正式表
        public void UpdateToFormalTable()
        {
            if (另一人录入的记录 == null || this.内容不同的字段.Count > 0)
            {
                return;
            }

            WageLoan m = WageLoan.AddWageLoan(this.员工编号, this.开始时间);

            this.CopyWatchMember(m);

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

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

                WageLoanEntry opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
Exemplo n.º 2
0
        protected override void OnSaving()
        {
            WageLoan found = GetWageLoan(this.员工编号, this.开始时间);

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

            WAGELOAN_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
Exemplo n.º 3
0
        public static WageLoan AddWageLoan(string emplid, DateTime effDate)
        {
            WageLoan item = GetWageLoan(emplid, effDate);

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

            return(obj);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 同步上月工资明细
        /// </summary>
        /// <returns></returns>
        public static StringBuilder SychSalaryResult()
        {
            List <CalRunInfo> cals = new List <CalRunInfo>();
            StringBuilder     sb   = new StringBuilder();

            DateTime        prevMonth = DateTime.Now.AddMonths(-1);
            DateTime        prd_begin = new DateTime(prevMonth.Year, prevMonth.Month, 1);
            OleDbConnection conn      = new OleDbConnection(MyHelper.GetPsConnectionString());

            using (conn)
            {
                OleDbDataReader rs = null;
                try
                {
                    conn.Open();
                    using (OleDbCommand cmd = conn.CreateCommand())
                    {
                        string sql = String.Format("select distinct A.CAL_RUN_ID,A.DESCR, RUN_FINALIZED_IND, B.CAL_PRD_ID, C.PRD_BGN_DT, C.PRD_END_DT from SYSADM.ps_GP_CAL_RUN A left join SYSADM.ps_GP_CAL_RUN_DTL B ON A.cal_run_id = B.cal_run_id  left join SYSADM.ps_GP_CAL_PRD C ON C.cal_prd_id = B.CAL_PRD_ID where C.PRD_BGN_DT = date'{0:yyyy-M-d}'", prd_begin);
                        cmd.CommandText = sql;
                        rs = cmd.ExecuteReader();
                        while (rs.Read())
                        {
                            bool finalized = (string)rs["RUN_FINALIZED_IND"] == "Y";
                            if (finalized)
                            {
                                string cal_run_id = (string)rs["CAL_RUN_ID"];

                                CalRunInfo cal = CalRunInfo.Get(cal_run_id);
                                if (cal != null)
                                {
                                    cals.Add(cal);
                                    WageLoan.AutoGenerateMonthlyWageLoanItems(cal.年度, cal.月份);
                                }
                            }
                        }

                        rs.Close();

                        foreach (CalRunInfo cal in cals)
                        {
                            string cal_run_id = cal.日历组编号;

                            foreach (string groupId in cal.薪资组列表)
                            {
#if (DEBUG)
                                StringBuilder msgBuilder = SychSalaryResult(cal_run_id, groupId);
                                sb.Append(msgBuilder.ToString());

                                StringBuilder msgBuilderItem = SalaryResultItem.SychSalaryResultItem(cal_run_id, groupId);
                                sb.Append(msgBuilderItem.ToString());
#else
                                SalaryAuditingResult sar = SalaryAuditingResult.AddSalaryAuditingResult(groupId, cal_run_id);

                                if (sar.表工资已审核)
                                {
                                    continue;
                                }

                                if (sar.已审核 || sar.已冻结)
                                {
                                    sb.Append(String.Format("薪资组{0}, 日历组({0})的工资已审核或者已冻结,不能重新同步。", groupId, cal_run_id));
                                    return(sb);
                                }
                                else
                                {
                                    StringBuilder msgBuilder = SychSalaryResult(cal_run_id, groupId);
                                    sb.Append(msgBuilder.ToString());

                                    StringBuilder msgBuilderItem = SalaryResultItem.SychSalaryResultItem(cal_run_id, groupId);
                                    sb.Append(msgBuilderItem.ToString());
                                }
#endif
                            }
                        }
                    }
                }
                finally
                {
                    if (rs != null)
                    {
                        rs.Close();
                    }
                    conn.Close();
                }
            }
            return(sb);
        }
        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)
            {
                月薪项目_减项_报账工资 = 报账工资.月度可报账标准_税前;
            }
        }