protected override void Validation() { _EmployeeSalaryList = new List <EmployeeSalary>(); //获取所有员工 _EmployeeList = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee(_SalaryTime, _CompanyId, _DepartmentID); foreach (Employee employee in _EmployeeList) { //获取员工当月工资 EmployeeSalaryHistory salaryHistory = _DalEmployeeSalary.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime(employee.Account.Id, _SalaryTime); //判断当月工资是否存在 if (salaryHistory == null) { throw new ApplicationException(employee.Account.Name + BllUtility.GetResourceMessage( BllExceptionConst._Employee_Salary_NotExist)); } //当月工资是否已封帐 if (Equals(salaryHistory.EmployeeSalaryStatus, EmployeeSalaryStatusEnum.AccountClosed)) { throw new ApplicationException(employee.Account.Name + BllUtility.GetResourceMessage( BllExceptionConst._Employee_Salary_Closed)); } var employeeSalary = new EmployeeSalary(employee.Account.Id); employeeSalary.Employee = employee; employeeSalary.EmployeeSalaryHistoryList = new List <EmployeeSalaryHistory>(); employeeSalary.EmployeeSalaryHistoryList.Add(salaryHistory); _EmployeeSalaryList.Add(employeeSalary); } }
protected override void Validation() { _EmployeeSalaryList = new List <EmployeeSalary>(); //获取所有员工 _EmployeeList = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee(_SalaryTime, _CompanyId, _DepartmentId); foreach (Employee employee in _EmployeeList) { EmployeeSalaryHistory salaryHistory = _DalEmployeeSalary.GetEmployeeSalaryHistoryByEmployeeIdAndDateTime(employee.Account.Id, _SalaryTime); //判断当月工资是否存在 if (salaryHistory == null) { BllUtility.ThrowException(BllExceptionConst._Employee_Salary_NotExist); } //判断当月工资状态是否没有封帐 else if (salaryHistory.EmployeeSalaryStatus != EmployeeSalaryStatusEnum.AccountClosed) { BllUtility.ThrowException(BllExceptionConst._Employee_Salary_Not_Closed); } var employeeSalary = new EmployeeSalary(employee.Account.Id); employeeSalary.Employee = employee; employeeSalary.EmployeeSalaryHistoryList = new List <EmployeeSalaryHistory>(); employeeSalary.EmployeeSalaryHistoryList.Add(salaryHistory); _EmployeeSalaryList.Add(employeeSalary); } }
protected override void ExcuteSelf() { //获取所有员工 List <Employee> employeeList = _GetEmployee.GetEmployeeWithCurrentMonthDimissionEmployee(_SalaryTime, _CompanyId, _DepartmentId); foreach (Employee employee in employeeList) { //using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) //{ //新增 CreateEmployeeSalary create = new CreateEmployeeSalary(employee.Account.Id, _SalaryTime, _BackAccountsName, _Description); try { create.Excute(); } catch { } // ts.Complete(); //} } }
/// <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="isIncludeChildDeptMember"></param> /// <param name="loginUser"></param> public List <EmployeeSalaryStatistics> DepartmentStatistics(DateTime startDt, DateTime endDt, int departmentID, List <AccountSetPara> items, 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); //构建返回的List foreach (Department department in AllDepartment) { EmployeeSalaryStatistics employeeSalaryStatistics = new EmployeeSalaryStatistics(); employeeSalaryStatistics.Department = department; employeeSalaryStatistics.EmployeeSalaryStatisticsItemList = new List <EmployeeSalaryStatisticsItem>(); //将List<AccountSetPara>转化为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); } //计算每个月 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> 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++) { //查找这个月,这个部门中的所有人,包括子部门 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) { continue; } //循环每一个需要统计的项,累加结果 for (int i = 0; i < items.Count; i++) { if (employeeSalaryHistory.EmployeeAccountSet.Items == null) { continue; } AccountSetItem accountSetItem = employeeSalaryHistory.EmployeeAccountSet.FindAccountSetItemByParaID(items[i].AccountSetParaID); if (accountSetItem == null) { continue; } iRet[k].EmployeeSalaryStatisticsItemList[i].CalculateValue = iRet[k].EmployeeSalaryStatisticsItemList[i].CalculateValue + accountSetItem.CalculateResult; } } } } CaculateSumDepartmentStatistics(iRet, isIncludeChildDeptMember); return(iRet); }