/// <summary> /// 社保计算 /// </summary> public void InsuranceStatistics() { CityInsuranceCount = 0; TownInsuranceCount = 0; ComprehensiveInsuranceCount = 0; for (int i = 0; i < _EmployeeList.Count; i++) { DateTime monthFirstDay = new DateTime(_EmployeeList[i].EmployeeDetails.StatisticsTime.Date.Year, _EmployeeList[i].EmployeeDetails.StatisticsTime.Date.Month, 1); EmployeeWelfareHistory history = GetEmployeeWelfareHistory(_EmployeeList[i].EmployeeWelfareHistory, monthFirstDay); if (history != null && history.EmployeeWelfare != null) { EmployeeSocialSecurity s = history.EmployeeWelfare.SocialSecurity; if (s != null && s.Type.Id != SocialSecurityTypeEnum.Null.Id) { if (s.Type.Id == SocialSecurityTypeEnum.CityInsurance.Id) { CityInsuranceCount++; } else if (s.Type.Id == SocialSecurityTypeEnum.ComprehensiveInsurance.Id) { ComprehensiveInsuranceCount++; } else if (s.Type.Id == SocialSecurityTypeEnum.TownInsurance.Id) { TownInsuranceCount++; } } } } }
private EmployeeWelfareHistory GetEmployeeWelfareHistory(List <EmployeeWelfareHistory> history, DateTime dt) { EmployeeWelfareHistory ret = null; for (int i = 0; i < history.Count; i++) { if (new DateTime(history[i].OperationTime.Year, history[i].OperationTime.Month, 1) > dt) { break; } else { ret = history[i]; } } return(ret); }