/// <summary> /// 根据员工ID获取其应用的考勤方案(解决一个员工在系统内多个公司入职的情况) /// </summary> /// <param name="strEmployeeID"></param> /// <returns></returns> public T_HR_ATTENDANCESOLUTION GetAttendanceSolutionByEmployeeID(string strCompanyID, string strEmployeeID) { if (string.IsNullOrEmpty(strCompanyID) || string.IsNullOrEmpty(strEmployeeID)) { return(null); } AttendanceSolutionAsignBLL bllAttendSolAsign = new AttendanceSolutionAsignBLL(); T_HR_ATTENDANCESOLUTIONASIGN entAttendSolAsign = bllAttendSolAsign.GetAttendanceSolutionAsignByEmployeeID(strCompanyID, strEmployeeID); if (entAttendSolAsign == null) { return(null); } return(entAttendSolAsign.T_HR_ATTENDANCESOLUTION); }
/// <summary> /// 根据员工ID获取该员工所有未签卡记录 /// </summary> /// <param name="EmployeeID">员工ID</param> /// <returns></returns> public IQueryable <T_HR_EMPLOYEEABNORMRECORD> GetAbnormRecordByEmployeeID(string employeeID) { AttendanceSolutionAsignBLL bll = new AttendanceSolutionAsignBLL(); string strAbnormCategory = (Convert.ToInt32(Common.AbnormCategory.Absent) + 1).ToString(); string strSingInState = (Convert.ToInt32(Common.IsChecked.No) + 1).ToString(); var temp = bll.GetAttendanceSolutionAsignByEmployeeID(employeeID); if (temp == null) { return(null); } DateTime currDate = DateTime.Now.Date; DateTime dStart; //是否当月结算:1表示否,2表示是 string strTag = temp.T_HR_ATTENDANCESOLUTION.ISCURRENTMONTH; if (strTag == "1") { if (currDate.Day <= Convert.ToInt32(temp.T_HR_ATTENDANCESOLUTION.SETTLEMENTDATE)) { dStart = currDate.AddMonths(-1).AddDays(-currDate.Day + 1); } else { dStart = DateTime.Parse(currDate.AddMonths(-1).ToString("yyyy-MM") + "-1"); } } else { dStart = DateTime.Parse(currDate.ToString("yyyy-MM") + "-1"); } return(dal.GetObjects().Include("T_HR_ATTENDANCERECORD").Where(s => s.T_HR_ATTENDANCERECORD.EMPLOYEEID == employeeID && s.ABNORMCATEGORY == strAbnormCategory && s.SINGINSTATE == strSingInState && (s.ABNORMALDATE >= dStart && s.ABNORMALDATE <= currDate)).OrderBy("ABNORMALDATE")); }
/// <summary> /// 根据员工ID获取员工的带薪假期的天数,调休假天数,及已休假天数。 /// </summary> /// <param name="employeeID">员工ID</param> /// <param name="date">日期</param> /// <returns></returns> public List <V_EMPLOYEELEAVE> GetEmployeeLeaveByEmployeeID(string employeeID, DateTime date) { List <V_EMPLOYEELEAVE> leaveList = new List <V_EMPLOYEELEAVE>(); try { //获取员工组织架构 EmployeeBLL employeeBll = new EmployeeBLL(); V_EMPLOYEEPOST employeePost = employeeBll.GetEmployeeDetailByID(employeeID); //获取员工的入职信息 EmployeeEntryBLL entryBll = new EmployeeEntryBLL(); T_HR_EMPLOYEEENTRY entry = entryBll.GetEmployeeEntryByEmployeeID(employeeID); DateTime entryDate = entry.ENTRYDATE.Value; int m = Utility.DateDiff(entryDate, date, "M"); string departmentID = employeePost.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.DEPARTMENTID; string comparyID = employeePost.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID; var ent = from a in dal.GetObjects().Include("T_HR_LEAVETYPESET") join al in dal.GetObjects <T_HR_ATTENDFREELEAVE>().Include("T_HR_ATTENDANCESOLUTION").Include("T_HR_LEAVETYPESET") on a.T_HR_LEAVETYPESET.LEAVETYPESETID equals al.T_HR_LEAVETYPESET.LEAVETYPESETID join ad in dal.GetObjects <T_HR_ATTENDANCESOLUTION>() on al.T_HR_ATTENDANCESOLUTION.ATTENDANCESOLUTIONID equals ad.ATTENDANCESOLUTIONID join at in dal.GetObjects <T_HR_ATTENDANCESOLUTIONASIGN>() on ad.ATTENDANCESOLUTIONID equals at.T_HR_ATTENDANCESOLUTION.ATTENDANCESOLUTIONID where (at.ASSIGNEDOBJECTID == departmentID || at.ASSIGNEDOBJECTID == comparyID) && a.MINIMONTH <= m && a.MAXMONTH >= m select new V_EMPLOYEELEAVE() { EmployeeID = employeeID, EmployeeCode = employeePost.T_HR_EMPLOYEE.EMPLOYEECODE, EmployeeName = employeePost.T_HR_EMPLOYEE.EMPLOYEECNAME, LeaveTypeName = a.T_HR_LEAVETYPESET.LEAVETYPENAME, LeaveTypeSetID = a.T_HR_LEAVETYPESET.LEAVETYPESETID, MaxDays = a.T_HR_LEAVETYPESET.MAXDAYS.Value, FineType = a.T_HR_LEAVETYPESET.FINETYPE, IsPerfectAttendanceFactor = a.ISPERFECTATTENDANCEFACTOR, LeaveDays = a.LEAVEDAYS.Value }; leaveList = ent.Count() > 0 ? ent.ToList() : null; //获取年度考勤结算日 AttendanceSolutionAsignBLL bll = new AttendanceSolutionAsignBLL(); var tempEnt = bll.GetAttendanceSolutionAsignByEmployeeID(employeeID); string strDate = tempEnt.T_HR_ATTENDANCESOLUTION.YEARLYBALANCEDATE; string strType = tempEnt.T_HR_ATTENDANCESOLUTION.YEARLYBALANCETYPE; //结算方式 //获取加班调休假的天数 EmployeeLevelDayCountBLL leaveDaybll = new EmployeeLevelDayCountBLL(); AdjustLeaveBLL adjustbll = new AdjustLeaveBLL(); decimal leaveDays = leaveDaybll.GetLevelDayCountByEmployeeID(employeeID, date, strDate); V_EMPLOYEELEAVE leave = new V_EMPLOYEELEAVE(); ent = from a in dal.GetObjects <T_HR_LEAVETYPESET>() where !string.IsNullOrEmpty(a.LEAVETYPEVALUE) select new V_EMPLOYEELEAVE { EmployeeID = employeeID, EmployeeCode = employeePost.T_HR_EMPLOYEE.EMPLOYEECODE, EmployeeName = employeePost.T_HR_EMPLOYEE.EMPLOYEECNAME, LeaveTypeName = a.LEAVETYPENAME, LeaveTypeSetID = a.LEAVETYPESETID, MaxDays = a.MAXDAYS.Value, FineType = a.FINETYPE, LeaveDays = leaveDays }; leave = ent.Count() > 0 ? ent.FirstOrDefault() : null; if (leave != null) { leaveList.Add(leave); } //获取已休天数,并算出可休假天数 foreach (var obj in leaveList) { //剩余可休假为累计的情况 if (strType == "1") { //往年可休假的总数 decimal leaveHistoryDays = leaveDaybll.GetLevelDayCountHistoryByEmployeeID(employeeID, date, strDate); //往年已休假的总数 decimal UsedUpDays = adjustbll.GetUseUpHistory(obj.LeaveTypeSetID, obj.EmployeeID, date, strDate); obj.LeaveDays += leaveHistoryDays - UsedUpDays; } obj.UsedLeaveDays = adjustbll.GetUseUp(obj.LeaveTypeSetID, obj.EmployeeID, date, strDate); obj.UseableLeaveDays = obj.LeaveDays - obj.UsedLeaveDays; } } catch (Exception ex) { Tracer.Debug(ex.ToString()); } return(leaveList); }