/// <summary> /// 统计某个时间段内的某个部门以及其所有子部门的员工的报销统计情况 /// </summary> /// <param name="startDt">统计的开始时间</param> /// <param name="endDt">统计的结束时间</param> /// <param name="departmentID">统计的部门编号</param> /// <returns></returns> /// <param name="companyID"></param> /// <param name="employeeName"></param> /// <param name="loginUser"></param> public List <EmployeeReimburseStatistics> EmployeeStatistics(DateTime startDt, DateTime endDt, int departmentID, int companyID, string employeeName, Account loginUser) { List <EmployeeReimburseStatistics> iRet = new List <EmployeeReimburseStatistics>(); List <Employee> EmployeeList = new GetEmployee().GetEmployeeByConditionForReimburseStatistics (employeeName, companyID, -1, departmentID, true); if (departmentID == -1) //如果查全部员工需去掉没有查询权限的员工 { EmployeeList = HrmisUtility.RemoteUnAuthEmployee(EmployeeList, AuthType.HRMIS, loginUser, HrmisPowers.A903); } //构建返回的List foreach (Employee employee in EmployeeList) { EmployeeReimburseStatistics employeeReimburseStatistics = new EmployeeReimburseStatistics(); employeeReimburseStatistics.Employee = employee; CalculateEmployeeReimburse(employeeReimburseStatistics, employee.Account.Id, startDt, endDt); iRet.Add(employeeReimburseStatistics); } iRet = AddTotleItem(iRet); CaculateSumEmployeeReimburseStatistics(iRet); return(iRet); }
private void Import(DataTable dt) { List <EmployeeWelfare> employeeWelfarelist = new List <EmployeeWelfare>(); List <Employee> employeeList = new GetEmployee().GetEmployeeBasicInfoByBasicCondition("", EmployeeTypeEnum.All, -1, -1, true, -1); employeeList = HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Operator, HrmisPowers.A605); if (employeeList != null) { foreach (Employee employee in employeeList) { EmployeeWelfare welfare = _DalEmployeeWelfare.GetEmployeeWelfareByAccountID(employee.Account.Id); if (welfare == null) { welfare = EmployeeWelfare.EmptyWelfare(); } welfare.Owner = employee.Account; employeeWelfarelist.Add(welfare); } } ValueItemsAndSave(employeeWelfarelist, dt); }
protected override void ExcuteSelf() { IContract iContract = new ContractDal(); GetEmployee getEmployee = new GetEmployee(); List<Employee> employeeList = new List<Employee>(); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.NormalEmployee, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.ProbationEmployee, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.BorrowedEmployee, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.PartTimeEmployee, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.PracticeEmployee, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.Retirement, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.RetirementHire, -1, _DepartmentID, true,-1)); employeeList.AddRange( getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.WorkEmployee, -1, _DepartmentID, true,-1)); employeeList = HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Account, _Powers); foreach (Employee employee in employeeList) { string description = string.Empty; Contract contract = iContract.GetLastContractInAllTypeByAccountID(employee.Account.Id, _CurrentDate); if (contract == null) { description = string.Format("{0}目前没有合同信息", employee.Account.Name); } if (string.IsNullOrEmpty(description)) { continue; } SystemError error = new SystemError(description, ErrorType.EmployeeContractError, employee.Account.Id); error.ErrorEmployee = employee; error.EditUrl = string.Format("{0}employeeID={1}", ErrorType.EmployeeContractError.EditPageUrl, SecurityUtil.DECEncrypt(employee.Account.Id.ToString())); _SystemErrorList.Add(error); } }
/// <summary> /// 查询 /// </summary> public void ExecutEvent(string letter) { if (!ValidateFrom() || !ValidateTo()) { } else { try { _View.ErrorMessage = string.Empty; EmployeeTypeEnum employeetype = EmployeeTypeUtility.GetEmployeeTypeByID(Convert.ToInt32(_View.EmployeeType)); //_EmployeeList = // _IEmployeeFacade.GetEmployeeByBasicConditionAndFirstLetter(_View.EmployeeName, employeetype, // _View.PositionId, _View.DepartmentId, // _View.RecursionDepartment, // letter); //20090807 修改查询条件 by liudan _EmployeeList = _IEmployeeFacade.GetEmployeeByBasicConditionWithFirstLetterAndCompanyAge(_View.EmployeeName, employeetype, _View.PositionId, _View.DepartmentId, _View.RecursionDepartment, letter, AgeFrom, AgeTo, Convert.ToInt32(_View.EmployeeStatusId)); _EmployeeList = HrmisUtility.RemoteUnAuthEmployee(_EmployeeList, AuthType.HRMIS, _Operator, HrmisPowers.A401); List <Employee> emplyees = new List <Employee>(); foreach (Employee emplyee in _EmployeeList) { //根据所属公司id,得到所属公司名称 Employee temp = emplyee; if (temp.EmployeeDetails == null || temp.EmployeeDetails.Work == null || temp.EmployeeDetails.Work.Company == null) { } else { //todo noted by wsl transfer waiting for modify temp.EmployeeDetails.Work.Company = _IDepartmentBll.GetDepartmentById( temp.EmployeeDetails.Work.Company.Id, new Account()); } temp.EmployeeDetails = temp.EmployeeDetails ?? new EmployeeDetails(); temp.EmployeeDetails.Work = temp.EmployeeDetails.Work ?? new Work(); temp.EmployeeDetails.Work.Company = temp.EmployeeDetails.Work.Company ?? new Department(); emplyees.Add(temp); } _CardView.Employees = emplyees; _View.ErrorMessage = "<span class='font14b'>共查到 </span>" + "<span class='fontred'>" + _EmployeeList.Count + "</span>" + "<span class='font14b'> 条信息</span>"; } catch (Exception ex) { _View.ErrorMessage = "<span class='fontred'>" + ex.Message + "</span>"; } } }
/// <summary> /// 获取再dt时刻的在职员工 /// </summary> /// <returns></returns> public List <Employee> GetEmployeeOnDutyByDepartmentAndDateTime(int departmentID, DateTime dt, bool onlyBasicInfo, Account loginUser, int powersID, List <Employee> allEmployeeSource) { GetEmployeeByDateTime getEmployeeByDateTime = new GetEmployeeByDateTime(); List <Employee> OnDutyEmployeeList = getEmployeeByDateTime.OnDutyEmployees(dt, departmentID, onlyBasicInfo, true, allEmployeeSource); return(HrmisUtility.RemoteUnAuthEmployee(OnDutyEmployeeList, AuthType.HRMIS, loginUser, HrmisPowers.A405)); }
/// <summary> /// 根据部门分组 /// </summary> /// <param name="startDt"></param> /// <param name="endDt"></param> /// <param name="departmentID"></param> /// <param name="item"></param> /// <param name="companyID"></param> /// <param name="isIncludeChildDeptMember"></param> /// <returns></returns> /// <param name="loginUser"></param> public List <EmployeeSalaryStatistics> TimeSpanStatisticsGroupByDepartment(DateTime startDt, DateTime endDt, int departmentID, AccountSetPara item, int companyID, bool isIncludeChildDeptMember, Account loginUser) { List <EmployeeSalaryStatistics> iRet = new List <EmployeeSalaryStatistics>(); //划分月份 List <DateTime> Months = SplitMonth(startDt, endDt); //查出每个月份月底这个时间点的,某一部门及其所有子部门(包括改过名字部门) List <Department> AllDepartment = GetAllDepartment(Months, departmentID); AllDepartment = Tools.RemoteUnAuthDeparetment(AllDepartment, AuthType.HRMIS, loginUser, HrmisPowers.A607); //计算每个月 for (int j = 0; j < Months.Count; j++) { EmployeeSalaryStatistics employeeSalaryStatistics = new EmployeeSalaryStatistics(); employeeSalaryStatistics.SalaryDay = Months[j]; employeeSalaryStatistics.EmployeeSalaryStatisticsItemList = new List <EmployeeSalaryStatisticsItem>(); //得到这个月的所有部门 List <Department> departmentList = _GetDepartmentHistory.GetDepartmentNoStructByDateTime(Months[j]); departmentList = Tools.RemoteUnAuthDeparetment(departmentList, AuthType.HRMIS, loginUser, HrmisPowers.A607); List <Employee> EmployeesSource = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee( new HrmisUtility().StartMonthByYearMonth(Months[j]), companyID); EmployeesSource = HrmisUtility.RemoteUnAuthEmployee(EmployeesSource, AuthType.HRMIS, loginUser, HrmisPowers.A607); List <Account> accountSource = EmployeeUtility.GetAccountListFromEmployeeList(EmployeesSource); for (int k = 0; k < AllDepartment.Count; k++) { EmployeeSalaryStatisticsItem employeeSalaryStatisticsItem = new EmployeeSalaryStatisticsItem(); employeeSalaryStatisticsItem.ItemName = AllDepartment[k].DepartmentName; employeeSalaryStatisticsItem.ItemID = AllDepartment[k].DepartmentID; //查找这个月,这个部门中的所有人,包括子部门 AllDepartment[k].Members = FindAllEmployeeByDepAndTime(departmentList, AllDepartment[k], Months[j], accountSource, isIncludeChildDeptMember); //循环部门里的员工 foreach (Account account in AllDepartment[k].AllMembers) { //查找某时,某人的薪资历史 EmployeeSalaryHistory employeeSalaryHistory = _GetEmployeeAccountSet.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime (account.Id, Months[j]); if (employeeSalaryHistory == null || employeeSalaryHistory.EmployeeAccountSet == null || employeeSalaryHistory.EmployeeAccountSet.Items == null) { continue; } AccountSetItem accountSetItem = employeeSalaryHistory.EmployeeAccountSet.FindAccountSetItemByParaID(item.AccountSetParaID); if (accountSetItem == null) { continue; } employeeSalaryStatisticsItem.CalculateValue = employeeSalaryStatisticsItem.CalculateValue + accountSetItem.CalculateResult; } employeeSalaryStatistics.EmployeeSalaryStatisticsItemList.Add(employeeSalaryStatisticsItem); } iRet.Add(employeeSalaryStatistics); } return(iRet); }
/// <summary> /// 根据帐套项分组 /// </summary> /// <param name="startDt"></param> /// <param name="endDt"></param> /// <param name="departmentID"></param> /// <param name="companyID"></param> /// <param name="items"></param> /// <returns></returns> /// <param name="loginUser"></param> public List <EmployeeSalaryStatistics> TimeSpanStatisticsGroupByParameter(DateTime startDt, DateTime endDt, int departmentID, List <AccountSetPara> items, int companyID, Account loginUser) { List <EmployeeSalaryStatistics> iRet = new List <EmployeeSalaryStatistics>(); #region 划分月份 List <DateTime> Months = SplitMonth(startDt, endDt); //计算每个月 for (int j = 0; j < Months.Count; j++) { EmployeeSalaryStatistics employeeSalaryStatistics = new EmployeeSalaryStatistics(); employeeSalaryStatistics.SalaryDay = Months[j]; employeeSalaryStatistics.EmployeeSalaryStatisticsItemList = new List <EmployeeSalaryStatisticsItem>(); for (int i = 0; i < items.Count; i++) { EmployeeSalaryStatisticsItem item = new EmployeeSalaryStatisticsItem(); item.ItemID = items[i].AccountSetParaID; item.ItemName = items[i].AccountSetParaName; employeeSalaryStatistics.EmployeeSalaryStatisticsItemList.Add(item); } iRet.Add(employeeSalaryStatistics); } #endregion for (int j = 0; j < Months.Count; j++) { //根据月份、部门获取当时的部门 List <Department> itsSource = _GetDepartmentHistory.GetDepartmentListStructByDepartmentIDAndDateTime(departmentID, Months[j]); itsSource = Tools.RemoteUnAuthDeparetment(itsSource, AuthType.HRMIS, loginUser, HrmisPowers.A607); //根据月份获取当时的员工信息 List <Employee> EmployeesSource = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee( new HrmisUtility().StartMonthByYearMonth(Months[j]), companyID); EmployeesSource = HrmisUtility.RemoteUnAuthEmployee(EmployeesSource, AuthType.HRMIS, loginUser, HrmisPowers.A607); //遍历部门,找到当时该部门的员工,然后分别获取当月的发薪历史 foreach (Department department in itsSource) { List <Employee> employees = FindEmployee(EmployeesSource, department); foreach (Employee employee in employees) { EmployeeSalaryHistory employeeSalaryHistory = _GetEmployeeAccountSet.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime(employee.Account.Id, Months[j]); if (employeeSalaryHistory == null || employeeSalaryHistory.EmployeeAccountSet == null || employeeSalaryHistory.EmployeeAccountSet.Items == null) { continue; } //循环每一个需要统计的项,累加结果 for (int i = 0; i < iRet[j].EmployeeSalaryStatisticsItemList.Count; i++) { AccountSetItem accountSetItem = employeeSalaryHistory.EmployeeAccountSet.FindAccountSetItemByParaID( iRet[j].EmployeeSalaryStatisticsItemList[i].ItemID); if (accountSetItem == null) { continue; } iRet[j].EmployeeSalaryStatisticsItemList[i].CalculateValue += accountSetItem.CalculateResult; } } } } return(iRet); }
///// <summary> ///// 移除离职人员 ///// </summary> ///// <param name="EmployeeList"></param> ///// <param name="dt"></param> ///// <returns></returns> //public List<Employee> RemoveDimissionhAndBorrowed(List<Employee> EmployeeList, DateTime dt) //{ // List<Employee> returnEmployee = new List<Employee>(); // DateTime dtFrom = new DateTime(dt.Year, dt.Month, 1); // DateTime dtTo = dtFrom.AddMonths(1).AddDays(-1); // for (int i = 0; i < EmployeeList.Count; i++) // { // //外借员工 // if (EmployeeList[i].EmployeeType == EmployeeTypeEnum.BorrowedEmployee) // { // continue; // } // //根据入职离职时间 // Employee employee = _GetEmployee.GetEmployeeBasicInfoByAccountID(EmployeeList[i].Account.Id); // if (employee.EmployeeDetails == null || employee.EmployeeDetails.Work == null) // { // continue; // } // DateTime employeeFromDate = DateTime.Compare(employee.EmployeeDetails.Work.ComeDate, dtFrom) > 0 // ? employee.EmployeeDetails.Work.ComeDate // : dtFrom; // DateTime employeeToDate; // if (employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee && // employee.EmployeeDetails.Work.DimissionInfo != null) // { // employeeToDate = // DateTime.Compare(employee.EmployeeDetails.Work.DimissionInfo.DimissionDate, dtTo) < 0 // ? employee.EmployeeDetails.Work.DimissionInfo.DimissionDate // : dtTo; // } // else // { // employeeToDate = dtTo; // } // if (DateTime.Compare(employeeFromDate, employeeToDate) > 0) // { // continue; // } // returnEmployee.Add(EmployeeList[i]); // } // return returnEmployee; //} /// <summary> /// 统计某个时间段内的某个部门以及其所有子部门的员工的薪资情况 /// </summary> /// <param name="startDt">统计的开始时间</param> /// <param name="endDt">统计的结束时间</param> /// <param name="departmentID">统计的部门编号</param> /// <param name="item">统计项--帐套项的List</param> /// <returns></returns> /// <param name="companyID"></param> /// <param name="isIncludeChildDeptMember"></param> /// <param name="loginUser"></param> public List <EmployeeSalaryAverageStatistics> AverageStatistics(DateTime startDt, DateTime endDt, int departmentID, AccountSetPara item, int companyID, bool isIncludeChildDeptMember, Account loginUser) { List <EmployeeSalaryAverageStatistics> iRet = new List <EmployeeSalaryAverageStatistics>(); //划分月份 List <DateTime> Months = SplitMonth(startDt, endDt); //查出每个月份月底这个时间点的,某一部门及其所有子部门(包括改过名字部门) List <Department> AllDepartment = GetAllDepartment(Months, departmentID); AllDepartment = Tools.RemoteUnAuthDeparetment(AllDepartment, AuthType.HRMIS, loginUser, HrmisPowers.A607); //构建返回的List foreach (Department department in AllDepartment) { EmployeeSalaryAverageStatistics employeeSalaryAverageStatistics = new EmployeeSalaryAverageStatistics(); employeeSalaryAverageStatistics.Department = department; EmployeeSalaryStatisticsItem employeeSalaryStatisticsSumItem = new EmployeeSalaryStatisticsItem(); employeeSalaryStatisticsSumItem.ItemID = item.AccountSetParaID; employeeSalaryStatisticsSumItem.ItemName = item.AccountSetParaName; EmployeeSalaryStatisticsItem employeeSalaryStatisticsAverageItem = new EmployeeSalaryStatisticsItem(); employeeSalaryStatisticsAverageItem.ItemName = item.AccountSetParaName + "均值"; EmployeeSalaryStatisticsItem employeeSalaryStatisticsEmployeeCountItem = new EmployeeSalaryStatisticsItem(); employeeSalaryStatisticsEmployeeCountItem.ItemName = "人数"; employeeSalaryAverageStatistics.SumItem = employeeSalaryStatisticsSumItem; employeeSalaryAverageStatistics.AverageItem = employeeSalaryStatisticsAverageItem; employeeSalaryAverageStatistics.EmployeeCountItem = employeeSalaryStatisticsEmployeeCountItem; iRet.Add(employeeSalaryAverageStatistics); } //计算每个月 for (int j = 0; j < Months.Count; j++) { //得到这个月的所有部门 List <Department> departmentList = _GetDepartmentHistory.GetDepartmentNoStructByDateTime(Months[j]); departmentList = Tools.RemoteUnAuthDeparetment(departmentList, AuthType.HRMIS, loginUser, HrmisPowers.A607); List <Employee> EmployeesSourceTemp = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee( new HrmisUtility().StartMonthByYearMonth(Months[j]), companyID); EmployeesSourceTemp = HrmisUtility.RemoteUnAuthEmployee(EmployeesSourceTemp, AuthType.HRMIS, loginUser, HrmisPowers.A607); //List<Employee> EmployeesSource = RemoveDimissionAndBorrowed(EmployeesSourceTemp, Months[j]); List <Account> accountSource = EmployeeUtility.GetAccountListFromEmployeeList(EmployeesSourceTemp); for (int k = 0; k < AllDepartment.Count; k++) { //查找这个月,这个部门中的所有人,包括子部门 AllDepartment[k].Members = FindAllEmployeeByDepAndTime(departmentList, AllDepartment[k], Months[j], accountSource, isIncludeChildDeptMember); //累计计算每月员工个数 iRet[k].EmployeeCountItem.CalculateValue = iRet[k].EmployeeCountItem.CalculateValue + AllDepartment[k].Members.Count; //循环部门里的员工 foreach (Account account in AllDepartment[k].AllMembers) { //查找某时,某人的薪资历史 EmployeeSalaryHistory employeeSalaryHistory = _GetEmployeeAccountSet.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime (account.Id, Months[j]); if (employeeSalaryHistory == null || employeeSalaryHistory.EmployeeAccountSet == null || employeeSalaryHistory.EmployeeAccountSet.Items == null) { continue; } AccountSetItem accountSetItem = employeeSalaryHistory.EmployeeAccountSet.FindAccountSetItemByParaID(item.AccountSetParaID); if (accountSetItem == null) { continue; } iRet[k].SumItem.CalculateValue = iRet[k].SumItem.CalculateValue + accountSetItem.CalculateResult; } } } for (int k = 0; k < AllDepartment.Count; k++) { //计算平均值 if (iRet[k].EmployeeCountItem.CalculateValue == 0) { iRet[k].AverageItem.CalculateValue = 0; } else { iRet[k].AverageItem.CalculateValue = iRet[k].SumItem.CalculateValue / iRet[k].EmployeeCountItem.CalculateValue; } //计算每月平均员工人数 iRet[k].EmployeeCountItem.CalculateValue = iRet[k].EmployeeCountItem.CalculateValue / Months.Count; iRet[k].AverageItem.CalculateValue = Convert.ToDecimal(iRet[k].AverageItem.CalculateValue.ToString("0.00")); iRet[k].EmployeeCountItem.CalculateValue = Convert.ToDecimal(iRet[k].EmployeeCountItem.CalculateValue.ToString("0.00")); iRet[k].SumItem.CalculateValue = Convert.ToDecimal(iRet[k].SumItem.CalculateValue.ToString("0.00")); } return(iRet); }
/// <summary> /// 按照职位,统计某个时间段内的某个部门以及其所有子部门的员工的薪资情况 /// </summary> /// <param name="startDt">统计的开始时间</param> /// <param name="endDt">统计的结束时间</param> /// <param name="departmentID">统计的部门编号</param> /// <param name="items">统计项--帐套项的List</param> /// <returns></returns> /// <param name="companyID"></param> /// <param name="loginUser"></param> public List <EmployeeSalaryStatistics> PositionStatistics(DateTime startDt, DateTime endDt, int departmentID, List <AccountSetPara> items, int companyID, Account loginUser) { List <EmployeeSalaryStatistics> iRet = new List <EmployeeSalaryStatistics>(); List <EmployeeSalary> employeeSalaryList = new List <EmployeeSalary>(); List <Employee> employeeList = new List <Employee>(); if (items != null && items.Count > 0) { //按月拆分 List <DateTime> monthLastDays = SplitMonth(startDt, endDt); foreach (DateTime day in monthLastDays) { //根据月份、部门获取当时的部门 List <Department> itsSource = _GetDepartmentHistory.GetDepartmentListStructByDepartmentIDAndDateTime(departmentID, day); itsSource = Tools.RemoteUnAuthDeparetment(itsSource, AuthType.HRMIS, loginUser, HrmisPowers.A607); //根据月份获取当时的员工信息 List <Employee> EmployeesSource = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee(new HrmisUtility().StartMonthByYearMonth(day), companyID); EmployeesSource = HrmisUtility.RemoteUnAuthEmployee(EmployeesSource, AuthType.HRMIS, loginUser, HrmisPowers.A607); //遍历部门,找到当时该部门的员工,然后分别获取当月的发薪历史 foreach (Department department in itsSource) { List <Employee> employees = FindEmployee(EmployeesSource, department); employeeList.AddRange(employees); foreach (Employee employee in employees) { EmployeeSalary employeeSalary = new EmployeeSalary(employee.Account.Id); employeeSalary.Employee = employee; employeeSalary.EmployeeSalaryHistoryList = new List <EmployeeSalaryHistory>(); employeeSalary.EmployeeSalaryHistoryList.Add( _GetEmployeeAccountSet.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime( employee.Account.Id, day)); employeeSalaryList.Add(employeeSalary); } } } //根据所有员工信息,筛选出当时的所有职位 List <Position> positionList = GetPositionListFromEmployeeList(employeeList); //遍历所有职位,按照帐套项分别计算 foreach (Position position in positionList) { EmployeeSalaryStatistics employeeSalaryStatistics = new EmployeeSalaryStatistics(); employeeSalaryStatistics.Position = position; employeeSalaryStatistics.EmployeeSalaryStatisticsItemList = new List <EmployeeSalaryStatisticsItem>(); for (int i = 0; i < items.Count; i++) { EmployeeSalaryStatisticsItem item = new EmployeeSalaryStatisticsItem(); item.ItemID = items[i].AccountSetParaID; item.ItemName = items[i].AccountSetParaName; item.CalculateValue = CalculateByPosition(position, items[i], employeeSalaryList); employeeSalaryStatistics.EmployeeSalaryStatisticsItemList.Add(item); } iRet.Add(employeeSalaryStatistics); } } CaculateSumPositionStatistics(iRet); return(iRet); }
private void Search(NameValueCollection parameters) { List <ControlError> errors = new List <ControlError>(); List <EmployeeModel> EmployeeModelList = new List <EmployeeModel>(); string EmployeeName = parameters["EmployeeName"]; int employeeType = Convert.ToInt32(parameters["employeeType"]); int positionID = Convert.ToInt32(parameters["positionID"]); int departmentID = Convert.ToInt32(parameters["departmentID"]); int? gradesID = Convert.ToInt32(parameters["gradesID"]); if (gradesID < 0) { gradesID = null; } int EmployeeStatusId = Convert.ToInt32(parameters["EmployeeStatusId"]); string recursionDepartment = parameters["recursionDepartment"]; string ageFrom = parameters["ageFrom"]; string ageTo = parameters["ageTo"]; try { ValidateAge(ageFrom, ageTo); EmployeeTypeEnum _employeeType = EmployeeTypeUtility.GetEmployeeTypeByID(employeeType); List <Employee> _EmployeeList = _IEmployeeFacade.GetEmployeeBasicInfoByBasicConditionWithCompanyAge( EmployeeName, _employeeType, positionID, gradesID, departmentID, intAgeFrom, intAgeTo, recursionDepartment == "true", EmployeeStatusId); _EmployeeList = HrmisUtility.RemoteUnAuthEmployee(_EmployeeList, AuthType.HRMIS, _Operator, HrmisPowers.A401); List <Employee> employees = new List <Employee>(); foreach (Employee emplyee in _EmployeeList) { //根据所属公司id,得到所属公司名称 var temp = emplyee; if (temp.EmployeeDetails == null || temp.EmployeeDetails.Work == null || temp.EmployeeDetails.Work.Company == null) { } else { //todo noted by wsl transfer waiting for modify temp.EmployeeDetails.Work.Company = _IDepartmentBll.GetDepartmentById( temp.EmployeeDetails.Work.Company.Id, new Account()); } temp.EmployeeDetails = temp.EmployeeDetails ?? new EmployeeDetails(); temp.EmployeeDetails.Work = temp.EmployeeDetails.Work ?? new Work(); temp.EmployeeDetails.Work.Company = temp.EmployeeDetails.Work.Company ?? new Department(); employees.Add(temp); } //列表中没有查出当前员工的信息时,满足一下两个条件的任何一个,再次加载当前员工的信息 //1.所选部门是当前员工的部门 //2.所选部门包含当前员工的部门 //如现实数据中王莎莉登录,无任何权限,只可看自己的信息 if (_Operator.Name.Contains(EmployeeName) && !HrmisUtility.IsEmployeeListContainEmployee(employees, _Operator.Id)) { if (departmentID == -1) { GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID); } else if (departmentID != _Operator.Dept.Id) { Department selectedDept = _IDepartmentBll.GetDepartmentById(departmentID, null); if (selectedDept.IsExistDept(_Operator.Dept.Id)) { GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID); } } else { GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID); } } EmployeeModelList = employees.Select(x => new EmployeeModel { PKID = x.Account.Id, EmployeeName = "<div class='info' pkid='" + SecurityUtil.DECEncrypt(x.Account.Id.ToString()) + "'>" + x.Account.Name + "</div>", EmployeeType = EmployeeTypeUtility.EmployeeTypeDisplay(x.EmployeeType), Department = x.Account.Dept.Name, Company = x.EmployeeDetails.Work.Company.Name, Position = x.Account.Position.Name, WorkTime = x.EmployeeDetails.Work.ComeDate.ToString("yyyy-MM-dd") }).ToList(); } catch (Exception ex) { errors.Add(new ControlError("lblMessage", ex.Message)); } _ResponseString = PageUtility.FomartSearchString(EmployeeModelList, errors); }
private List <Employee> LoadAndCompareAllEmployeeInfo(List <Employee> employeeList, List <SearchField> otherSearchFieldList, bool isSearched, string partConst) { if ((otherSearchFieldList.Count > 0 && !isSearched) || (otherSearchFieldList.Count == 0 && isSearched)) { switch (partConst) { //加载员工基本信息,帐号信息 case EmployeeFieldPara.EmployeeBasicInfoPart: foreach (Employee employee in employeeList) { if (employee.EmployeeDetails != null) { employee.EmployeeDetails.Photo = null; } LoadSEPInfo.SetEmployeeAccountInfo(employee.Account.Id, employee, _IAccountBll, _IDepartmentBll, _IPositionBll); if (employee.EmployeeDetails != null && employee.EmployeeDetails.Work != null && employee.EmployeeDetails.Work.Company != null && employee.EmployeeDetails.Work.Company.Name != null && employee.EmployeeDetails.Work.Company.Name == "") { employee.EmployeeDetails.Work.Company = _IDepartmentBll.GetDepartmentById(employee.EmployeeDetails.Work.Company.Id, null); } } employeeList = HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _OperationAccount, HrmisPowers.A401); break; //加载员工福利信息 case EmployeeFieldPara.EmployeeWelfarePart: foreach (Employee employee in employeeList) { employee.EmployeeWelfare = new GetEmployeeWelfare(_IEmployeeWelfareHistory, _IEmployeeWelfare). GetEmployeeWelfareByAccountID( employee.Account.Id); } break; //加载员工国籍信息 case EmployeeFieldPara.CountryNationalityPart: foreach (Employee employee in employeeList) { if (employee.EmployeeDetails != null && employee.EmployeeDetails.CountryNationality != null) { employee.EmployeeDetails.CountryNationality = new GetNationality().GetNationalityByPkid( employee.EmployeeDetails.CountryNationality.ParameterID); } } break; //加载员工自定义流程信息 case EmployeeFieldPara.DiyProcessPart: foreach (Employee employee in employeeList) { employee.DiyProcessList = new GetDiyProcess(_IDiyProcessDal, _IEmployeeDiyProcessDal, _IAccountBll, _IDepartmentBll). GetEmployeeDiyProcesses(employee.Account.Id); } break; //加载员工年假信息 case EmployeeFieldPara.VacationPart: foreach (Employee employee in employeeList) { employee.EmployeeAttendance = employee.EmployeeAttendance ?? new EmployeeAttendance(); employee.EmployeeAttendance.Vacation = new GetVacation().GetLastVacationByAccountID(employee.Account.Id); } break; //加载员工调休信息 case EmployeeFieldPara.AdjustPart: foreach (Employee employee in employeeList) { employee.EmployeeAttendance = employee.EmployeeAttendance ?? new EmployeeAttendance(); employee.EmployeeAttendance.MonthAttendance = employee.EmployeeAttendance.MonthAttendance ?? new MonthAttendance(); employee.EmployeeAttendance.MonthAttendance.HoursofAdjustRestRemained = new GetAdjustRest().GetNowAdjustRestByAccountID(employee.Account.Id).SurplusHours; } break; //加载员工技能信息 case EmployeeFieldPara.SkillPart: foreach (Employee employee in employeeList) { try { employee.EmployeeSkills = _dalEmployeeSkill.GetEmployeeSkillByAccountID(employee.Account.Id , "", -1, SkillLevelEnum.All).EmployeeSkills; } catch { } } break; default: break; } if (!isSearched) { _EmployeeDoSearch = new EmployeeDoSearch(employeeList, otherSearchFieldList); _EmployeeDoSearch.DoSearchExecute(); employeeList = _EmployeeDoSearch.EmployeeList; } } return(employeeList); }