public DataTable GetReportEvalutionData(int year, Guid? _TimesGetDataID, string orgStructureID, bool _IsCreateTemplate, DateTime? _dateStart, DateTime? _dateEnd, DateTime? _dateFrom, DateTime? _dateTo, Guid? _JobTitleID, Guid? _PositionID, Guid? _WorkPlaceID, Guid? _RankID,string userLogin) { using (var context = new VnrHrmDataContext()) { var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); DataTable table = CreateReportEvalutionSchema(_dateFrom, _dateTo, userLogin); if (_IsCreateTemplate) return table; string status = string.Empty; List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>(); DateTime _datetime = new DateTime(year, 01, 01); //Ngay goc DateTime datetimeNode = _dateEnd.Value; List<object> paraEvalutionData = new List<object>(); paraEvalutionData.AddRange(new object[17]); paraEvalutionData[0] = orgStructureID; paraEvalutionData[1] = year; paraEvalutionData[2] = _datetime; //paraEvalutionData[3] = time; paraEvalutionData[10] = _TimesGetDataID; paraEvalutionData[11] = _JobTitleID; paraEvalutionData[12] = _PositionID; paraEvalutionData[13] = _WorkPlaceID; paraEvalutionData[14] = _RankID; paraEvalutionData[15] = 1; paraEvalutionData[16] = int.MaxValue - 1; var evaServiceEvalutionData = new Eva_EvalutionDataServices(); //chi danh gia nhung nv ngay vao lam <= ngay goc var lstEvalutionData = evaServiceEvalutionData.GetData<Eva_EvalutionDataEntity>(paraEvalutionData, ConstantSql.hrm_eva_getdata_EvalutionData, userLogin, ref status); Guid[] lstSalaryClassIDs = null; Guid[] lstProfielIds = null; if (lstEvalutionData != null) { lstSalaryClassIDs = lstEvalutionData.Where(s => s.SalaryClassID != null).Select(s => s.SalaryClassID.Value).Distinct().ToArray(); lstProfielIds = lstEvalutionData.Where(s => s.ProfileID != null).Select(s => s.ProfileID.Value).Distinct().ToArray(); } #region luong co ban List<object> paraBasicSalary = new List<object>(); paraBasicSalary.AddRange(new object[10]); DateTime _dateMin = DateTime.MinValue; paraBasicSalary[2] = orgStructureID; paraBasicSalary[3] = _dateMin; paraBasicSalary[4] = datetimeNode; paraBasicSalary[5] = _dateMin; paraBasicSalary[6] = datetimeNode; paraBasicSalary[8] = 1; paraBasicSalary[9] = int.MaxValue - 1; var salServiceBasicSalary = new Sal_BasicSalaryServices(); var lstBasicSalary = salServiceBasicSalary.GetData<Sal_BasicSalaryEntity>(paraBasicSalary, ConstantSql.hrm_sal_sp_get_BasicPayroll, userLogin, ref status); if (lstBasicSalary != null && lstProfielIds != null) lstBasicSalary = lstBasicSalary.Where(s => lstProfielIds.Contains(s.ProfileID)).ToList(); List<object> paraSalaryRank = new List<object>(); paraSalaryRank.AddRange(new object[4]); paraSalaryRank[2] = 1; paraSalaryRank[3] = int.MaxValue; var catServiceSalaryRank = new Cat_SalaryRankServices(); var lstSalaryRank = catServiceSalaryRank.GetData<Cat_SalaryRankEntity>(paraSalaryRank, ConstantSql.hrm_cat_sp_get_SalaryRank, userLogin, ref status); if (lstSalaryRank != null && lstSalaryClassIDs != null) lstSalaryRank = lstSalaryRank.Where(s => s.DateOfEffect <= datetimeNode && lstSalaryClassIDs.Contains(s.SalaryClassID.Value)).ToList(); #endregion #region phu cap List<object> paraUnusualAllowance = new List<object>(); paraUnusualAllowance.AddRange(new object[9]); paraBasicSalary[3] = _dateMin; paraBasicSalary[4] = datetimeNode; paraUnusualAllowance[7] = 1; paraUnusualAllowance[8] = int.MaxValue - 1; var salServiceUnusualAllowance = new Sal_UnusualAllowanceServices(); var lstUnusualAllowance = salServiceUnusualAllowance.GetData<Sal_UnusualAllowanceEntity>(paraUnusualAllowance, ConstantSql.hrm_sal_sp_get_UnusualED, userLogin, ref status); List<Guid> lstUnusualAllowanceIDs = null; if (lstUnusualAllowance != null) { //lstUnusualAllowance = lstUnusualAllowance.Where(s => s.MonthEnd <= datetimeNode || (s.MonthStart <= datetimeNode && s.MonthEnd == null)).ToList(); lstUnusualAllowanceIDs = lstUnusualAllowance.Where(s => s.UnusualEDTypeID != null).Select(s => s.UnusualEDTypeID.Value).Distinct().ToList(); } #endregion #region loai phu cap List<object> paraUnusualAllowanceCfg = new List<object>(); paraUnusualAllowanceCfg.AddRange(new object[6]); paraUnusualAllowanceCfg[4] = 1; paraUnusualAllowanceCfg[5] = int.MaxValue - 1; var catServiceUnusualAllowanceCfg = new Cat_UnusualAllowanceCfgServices(); var lstUnusualAllowanceCfg = catServiceUnusualAllowanceCfg.GetData<Cat_UnusualAllowanceCfgEntity>(paraUnusualAllowanceCfg, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfg, userLogin, ref status); if (lstUnusualAllowanceCfg != null && lstUnusualAllowanceIDs != null) lstUnusualAllowanceCfg = lstUnusualAllowanceCfg.Where(s => lstUnusualAllowanceIDs.Contains(s.ID)).ToList(); #endregion #region lay lich su danh gia List<Eva_PerformanceEntity> lstPerformance = null; int _yearFrom = DateTime.MinValue.Year; int _yearTo = DateTime.MinValue.Year; if (_dateFrom != null && _dateTo != null) { _yearFrom = _dateFrom.Value.Year; _yearTo = _dateTo.Value.Year; var evaServicePerformance = new Eva_PerformanceServices(); List<object> paraPerformance = new List<object>(); paraPerformance.AddRange(new object[20]); paraPerformance[2] = orgStructureID; paraPerformance[18] = 1; paraPerformance[19] = int.MaxValue - 1; lstPerformance = evaServicePerformance.GetData<Eva_PerformanceEntity>(paraPerformance, ConstantSql.hrm_eva_sp_get_PerformanceGeneral, userLogin, ref status); if (lstPerformance != null) lstPerformance = lstPerformance.Where(s => s.YearEvaluation != null).ToList(); if (lstPerformance.Count != 0) lstPerformance = lstPerformance.Where(s => s.YearEvaluation.Value.Year >= _yearFrom && s.YearEvaluation.Value.Year <= _yearTo).ToList(); } #endregion DateTime dateFirstKi = _dateStart.Value; foreach (var item in lstEvalutionData) { DataRow row = table.NewRow(); #region thong tin nhan vien row[Eva_ReportEvalutionDataEntity.FieldNames.CodeEmp] = item.CodeEmp; row[Eva_ReportEvalutionDataEntity.FieldNames.ProfileName] = item.ProfileName; row[Eva_ReportEvalutionDataEntity.FieldNames.E_DEPARTMENT] = item.E_DEPARTMENT; row[Eva_ReportEvalutionDataEntity.FieldNames.E_DIVISION] = item.E_DIVISION; row[Eva_ReportEvalutionDataEntity.FieldNames.E_SECTION] = item.E_SECTION; row[Eva_ReportEvalutionDataEntity.FieldNames.E_TEAM] = item.E_TEAM; row[Eva_ReportEvalutionDataEntity.FieldNames.E_UNIT] = item.E_UNIT; row[Eva_ReportEvalutionDataEntity.FieldNames.GroupCode] = item.CostCentreCode; row[Eva_ReportEvalutionDataEntity.FieldNames.LocationByGroupCode] = item.WorkPlaceCode; row[Eva_ReportEvalutionDataEntity.FieldNames.ReportEvalutionDataNode] = datetimeNode; #endregion #region tham nien if (item.DateOfBirth != null) row[Eva_ReportEvalutionDataEntity.FieldNames.Age] = DateTime.Today.Year - item.DateOfBirth.Value.Year; if (item.DateHire != null) { row[Eva_ReportEvalutionDataEntity.FieldNames.Entering] = item.DateHire; double dayServiceYear; dayServiceYear = datetimeNode.Subtract(item.DateHire.Value).TotalDays; double _TotalYear = dayServiceYear / 360; double _tempYear = 0; if (_TotalYear > 0) { string[] parts = _TotalYear.ToString().Split('.'); double _intMonth = double.Parse(parts[0]); if (parts.Length > 1) { double _modMonth = double.Parse("0." + parts[1]) * 12; if (_modMonth >= 10) { _tempYear = _intMonth + (_modMonth / 100); } else { _tempYear = _intMonth + (_modMonth / 10); } } row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYear] = String.Format("{0:0.0}", _tempYear); ; } if (item.DateHire.Value > dateFirstKi) { if (_TotalYear > 0) row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYearKi] = String.Format("{0:0.0}", _tempYear); } else { row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYearKi] = 1.0; } } #endregion var objBasicSalary = lstBasicSalary.Where(s => s.ProfileID == item.ProfileID).FirstOrDefault(); if (objBasicSalary != null) row[Eva_ReportEvalutionDataEntity.FieldNames.BasicSalary] = double.Parse(objBasicSalary.GrossAmount); row[Eva_ReportEvalutionDataEntity.FieldNames.Rank] = item.SalaryClassName; row[Eva_ReportEvalutionDataEntity.FieldNames.QualificationAbilitytitle] = item.AbilityTitleVNI; if (item.SalaryClassID != null) { var objSalaryRank = lstSalaryRank.Where(s => s.SalaryClassID == item.SalaryClassID).FirstOrDefault(); if (objSalaryRank != null) row[Eva_ReportEvalutionDataEntity.FieldNames.RankZone] = objSalaryRank.SalaryRankName; } row[Eva_ReportEvalutionDataEntity.FieldNames.JobTitle] = item.JobTitleName; Guid[] lstUnusualAllowanceProfileCfgIds = null; if (lstUnusualAllowance != null) { lstUnusualAllowance = lstUnusualAllowance.Where(s => s.ProfileID == item.ProfileID && s.UnusualEDTypeID != null).ToList(); lstUnusualAllowanceProfileCfgIds = lstUnusualAllowance.Select(s => s.UnusualEDTypeID.Value).ToArray(); } if (lstUnusualAllowanceCfg != null && lstUnusualAllowanceProfileCfgIds != null) lstUnusualAllowanceCfg = lstUnusualAllowanceCfg.Where(s => lstUnusualAllowanceProfileCfgIds.Contains(s.ID)).ToList(); double? totalUnusualAllowance = 0; if (lstUnusualAllowanceCfg != null) { foreach (var itemUnusualAllowanceCfg in lstUnusualAllowanceCfg) { var objUnusualAllowance = lstUnusualAllowance.Where(s => s.UnusualEDTypeID == itemUnusualAllowanceCfg.ID).OrderByDescending(s => s.MonthEnd).FirstOrDefault(); if (objUnusualAllowance != null) { row[itemUnusualAllowanceCfg.Code] = objUnusualAllowance.Amount; totalUnusualAllowance += objUnusualAllowance.Amount; } } } #region lich su danh gia if (_dateFrom != null && _dateTo != null && lstPerformance != null) { _yearFrom = _dateFrom.Value.Year; _yearTo = _dateTo.Value.Year; var lstPerformanceProfile = lstPerformance.Where(s => s.ProfileID == item.ProfileID).OrderByDescending(s => s.YearEvaluation).ToList(); if (lstPerformanceProfile.Count != 0) { while (_yearTo >= _yearFrom) { var objPerformanceFirst = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); _yearTo -= 1; var objPerformance = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); int _yeartemp = _yearTo + 1; if (objPerformanceFirst != null && objPerformanceFirst.Level1Name != null) { if (objPerformanceFirst.RankID != null && objPerformance != null && objPerformance.Level1Name != null && objPerformance.RankID != null) { if (objPerformanceFirst.RankID != objPerformance.RankID) { row["Year" + _yeartemp] = "(" + objPerformanceFirst.Level1Name + ")"; row["Year" + _yearTo] = "(" + objPerformance.Level1Name + ")"; _yearTo -= 1; while (_yearTo >= _yearFrom) { var objPerformanceYear = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); if (objPerformanceYear != null && objPerformanceYear.Level1Name != null) row["Year" + _yearTo] = "(" + objPerformanceYear.Level1Name + ")"; _yearTo -= 1; } } else { row["Year" + _yeartemp] = objPerformanceFirst.Level1Name; } } else { row["Year" + _yeartemp] = objPerformanceFirst.Level1Name; } } } } row[Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom] = _dateFrom.Value.ToShortDateString(); } #endregion if (totalUnusualAllowance > 0) row[Eva_ReportEvalutionDataEntity.FieldNames.TotalSalaryAllowance] = totalUnusualAllowance; if (item.Year != null) row[Eva_ReportEvalutionDataEntity.FieldNames.Year] = item.Year; //if (item.Time !=null) // row[Eva_ReportEvalutionDataEntity.FieldNames.Time] = item.Time; #region lan danh gia if (item.TimeEvalutionData != null) row[Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionData] = item.TimeEvalutionData; if (item.TimeEvalutionDataCode != null) row[Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionDataCode] = item.TimeEvalutionDataCode; #endregion #region C1->C32 if (item.C1 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C1] = item.C1; if (item.C2 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C2] = item.C2; if (item.C3 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C3] = item.C3; if (item.C4 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C4] = item.C4; if (item.C5 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C5] = item.C5; if (item.C6 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C6] = item.C6; if (item.C7 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C7] = item.C7; if (item.C8 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C8] = item.C8; if (item.C9 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C9] = item.C9; if (item.C10 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C10] = item.C10; if (item.C11 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C11] = item.C11; if (item.C12 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C12] = item.C12; if (item.C13 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C13] = item.C13; if (item.C14 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C14] = item.C14; if (item.C15 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C15] = item.C15; if (item.C16 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C16] = item.C16; if (item.C17 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C17] = item.C17; if (item.C18 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C18] = item.C18; if (item.C19 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C19] = item.C19; if (item.C20 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C20] = item.C20; if (item.C21 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C21] = item.C21; if (item.C22 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C22] = item.C22; if (item.C23 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C23] = item.C23; if (item.C24 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C24] = item.C24; if (item.C25 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C25] = item.C25; if (item.C26 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C26] = item.C26; if (item.C27 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C27] = item.C27; if (item.C28 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C28] = item.C28; if (item.C29 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C29] = item.C29; if (item.C30 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C30] = item.C30; if (item.C31 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C31] = item.C31; if (item.C32 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C32] = item.C32; #endregion #region Bo sung //int _tempC1 = 0; //int _TempC2 = 0; //int _tempC3 = 0; //int _tempC4 = 0; //int _tempC5 = 0; //int _tempC6 = 0; //int _tempC7 = 0; //int _tempC8 = 0; //int _tempC9 = 0; //#region TotalC1C2 //if (item.C1 != null) // _tempC1 = item.C1.Value; //if (item.C2 != null) // _TempC2 = item.C2.Value; //if (item.C1 != null || item.C2 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2] = _tempC1 + _TempC2; //#endregion //#region TotalC3C4C5C6C7 //if (item.C3 != null) // _tempC3 = item.C3.Value; //if (item.C4 != null) // _tempC4 = item.C4.Value; //if (item.C5 != null) // _tempC5 = item.C5.Value; //if (item.C6 != null) // _tempC6 = item.C6.Value; //if (item.C7 != null) // _tempC7 = item.C7.Value; //if (item.C3 != null || item.C4 != null || item.C5 != null || item.C6 != null || item.C7 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC3C4C5C6C7] = _tempC3 + _tempC4 + _tempC5 + _tempC6 + _tempC7; //#endregion //#region TotalC1C2C3C4C5C6C7 //if (item.C1 != null || item.C2 != null || item.C3 != null || item.C4 != null || item.C5 != null || item.C6 != null || item.C7 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2C3C4C5C6C7] = _tempC1 + _TempC2 + _tempC3 + _tempC4 + _tempC5 + _tempC6 + _tempC7; //#endregion //#region TotalC8C9 //if (item.C8 != null) // _tempC8 = item.C8.Value; //if (item.C9 != null) // _tempC9 = item.C9.Value; //if (item.C8 != null || item.C9 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC8C9] = _tempC8 + _tempC9; //#endregion #endregion #region thoi gian danh gia row[Eva_ReportEvalutionDataEntity.FieldNames.DateStart] = _dateStart; row[Eva_ReportEvalutionDataEntity.FieldNames.DateEnd] = _dateEnd; #endregion table.Rows.Add(row); } return table.ConfigTable(); // #endregion } }
public DataTable GetReportProfile(List<Hre_ProfileEntity> lstprofile, Guid _CutOffDurationID, string UserLogin) { using (var context = new VnrHrmDataContext()) { var unitOfWork = (UnitOfWork)(new UnitOfWork(context)); DataTable table = CreateReportProfileScheme(); if (lstprofile == null) return table; //var repoCat_OrgStructure = new Cat_OrgStructureRepository(unitOfWork); //var repoCat_OrgStructureType = new Cat_OrgStructureTypeRepository(unitOfWork); //var orgs = repoCat_OrgStructure.FindBy(s => s.Code != null).ToList(); //var orgTypes = repoCat_OrgStructureType.FindBy(s => s.IsDelete == null).ToList(); //hop dong string status = string.Empty; var hreServiceContract = new Hre_ContractServices(); List<object> paraContract = new List<object>(); paraContract.AddRange(new object[21]); paraContract[19] = 1; paraContract[20] = int.MaxValue; var lstContract = hreServiceContract.GetData<Hre_ContractEntity>(paraContract, ConstantSql.hrm_hr_sp_get_Contract, UserLogin, ref status); //ky cong string cutoff = Common.DotNetToOracle(_CutOffDurationID.ToString()); var baseService = new BaseService(); var objAtt_CutOffDurationEntity = baseService .GetData<Att_CutOffDurationEntity>(cutoff, ConstantSql.hrm_att_sp_get_CutOffDurationById, UserLogin, ref status) .FirstOrDefault(); // DateTime _dateFrom = DateTime.MinValue; DateTime _dateTo = DateTime.MaxValue; if (objAtt_CutOffDurationEntity != null) { if (objAtt_CutOffDurationEntity.DateStart != null) _dateFrom = objAtt_CutOffDurationEntity.DateStart; if (objAtt_CutOffDurationEntity.DateEnd != null) _dateTo = objAtt_CutOffDurationEntity.DateEnd; } var salServiceBasicSalary = new Sal_BasicSalaryServices(); List<object> paraBasicSalary = new List<object>(); paraBasicSalary.AddRange(new object[4]); paraBasicSalary[0] = _dateFrom; paraBasicSalary[1] = _dateTo; paraBasicSalary[2] = 1; paraBasicSalary[3] = int.MaxValue - 1; var lstBasicSalary = salServiceBasicSalary.GetData<Sal_BasicSalaryEntity>(paraBasicSalary, ConstantSql.hrm_sal_sp_getdata_BasicSalaryByCutOff, UserLogin, ref status); //Hre_ProfilePartyUnion var repoHre_ProfilePartyUnion = new Hre_ProfilePartyUnionRepository(unitOfWork); var lstProfilePartyUnion = repoHre_ProfilePartyUnion.FindBy(s => s.IsDelete == null && s.IsTradeUnionist == true && s.YouthUnionEnrolledDate <= _dateTo).ToList(); //Hre_StopWorking List<object> paraStopWorking = new List<object>(); paraStopWorking.AddRange(new object[17]); paraStopWorking[6] = _dateFrom; paraStopWorking[7] = _dateTo; paraStopWorking[15] = 1; paraStopWorking[16] = int.MaxValue - 1; var hreServiceStopWorking = new Hre_StopWorkingServices(); var lstStopWorking = hreServiceStopWorking.GetData<Hre_StopWorkingEntity>(paraStopWorking, ConstantSql.hrm_hr_sp_get_StopWorking, UserLogin, ref status); //Ins_ProfileInsuranceMonthly var repoProfileInsuranceMonthly = new Ins_ProfileInsuranceMonthlyRepository(unitOfWork); var lstProfileInsuranceMonthly = repoProfileInsuranceMonthly.FindBy(s => s.IsDelete == null && s.MonthYear >= _dateFrom && s.MonthYear <= _dateTo).ToList(); foreach (var profile in lstprofile) { if (profile != null) { var objContract = lstContract.Where(s => s.ProfileID == profile.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault(); var objBasicSalary = lstBasicSalary.Where(s => s.ProfileID == profile.ID).OrderByDescending(s => s.DateOfEffect).FirstOrDefault(); var objProfilePartyUnion = lstProfilePartyUnion.Where(s => s.ProfileID == profile.ID).OrderByDescending(s => s.YouthUnionEnrolledDate).FirstOrDefault(); var objStopWorking = lstStopWorking.Where(s => s.ProfileID == profile.ID).OrderByDescending(s => s.DateStop).FirstOrDefault(); var objProfileInsuranceMonthly = lstProfileInsuranceMonthly.Where(s => s.ProfileID == profile.ID).OrderByDescending(s => s.MonthYear).FirstOrDefault(); DataRow row = table.NewRow(); if (profile.CodeEmp != null) row[Sal_ReportProfileEntity.FieldNames.CodeEmp] = profile.CodeEmp; if (profile.ProfileName != null) row[Sal_ReportProfileEntity.FieldNames.ProfileName] = profile.ProfileName; if (profile.UnitNameOrg != null) row[Sal_ReportProfileEntity.FieldNames.UnitNameOrg] = profile.UnitNameOrg; if (profile.DepartmentNameOrg != null) row[Sal_ReportProfileEntity.FieldNames.DepartmentNameOrg] = profile.DepartmentNameOrg; if (profile.SectionNameOrg != null) row[Sal_ReportProfileEntity.FieldNames.SectionNameOrg] = profile.SectionNameOrg; if (profile.TeamNameOrg != null) row[Sal_ReportProfileEntity.FieldNames.TeamNameOrg] = profile.TeamNameOrg; if (profile.WorkPlaceName != null) row[Sal_ReportProfileEntity.FieldNames.WorkPlaceName] = profile.WorkPlaceName; if (profile.StatusSyn != null) row[Sal_ReportProfileEntity.FieldNames.StatusSyn] = profile.StatusSyn; if (objBasicSalary != null && objBasicSalary.SalaryClassName != null) row[Sal_ReportProfileEntity.FieldNames.SalaryClassName] = objBasicSalary.SalaryClassName; if (objBasicSalary != null && objBasicSalary.GrossAmount != null) row[Sal_ReportProfileEntity.FieldNames.BasicSalary] = objBasicSalary.GrossAmount; if (objBasicSalary != null && objBasicSalary.SalaryRankName != null) row[Sal_ReportProfileEntity.FieldNames.SalaryRankName] = objBasicSalary.SalaryRankName; if (profile.CostCentreCode != null) row[Sal_ReportProfileEntity.FieldNames.CostCentreCode] = profile.CostCentreCode; if (profile.IDNo != null) row[Sal_ReportProfileEntity.FieldNames.IDNo] = profile.IDNo; if (profile.DateOfBirth != null) row[Sal_ReportProfileEntity.FieldNames.DateOfBirth] = profile.DateOfBirth; if (profile.DateHire != null) row[Sal_ReportProfileEntity.FieldNames.DateHire] = profile.DateHire; if (objContract != null) { if (objContract.DateStart != null) row[Sal_ReportProfileEntity.FieldNames.DateStart] = objContract.DateStart; if (objContract.DateEnd != null) row[Sal_ReportProfileEntity.FieldNames.DateEnd] = objContract.DateEnd; } //if (profile.WorkingPlace != null) // row[Sal_ReportProfileEntity.FieldNames.WorkingPlace] = profile.WorkingPlace; if (objProfileInsuranceMonthly != null && objProfileInsuranceMonthly.IsUnEmpInsurance != null) row[Sal_ReportProfileEntity.FieldNames.IsUnEmpInsurance] = objProfileInsuranceMonthly.IsUnEmpInsurance; if (objProfileInsuranceMonthly != null && objProfileInsuranceMonthly.IsSocialInsurance != null) row[Sal_ReportProfileEntity.FieldNames.IsSocialInsurance] = objProfileInsuranceMonthly.IsSocialInsurance; if (objProfileInsuranceMonthly != null && objProfileInsuranceMonthly.IsHealthInsurance != null) row[Sal_ReportProfileEntity.FieldNames.IsHealthInsurance] = objProfileInsuranceMonthly.IsHealthInsurance; if (objProfilePartyUnion != null && objProfilePartyUnion.IsTradeUnionist != null) row[Sal_ReportProfileEntity.FieldNames.IsTradeUnionist] = objProfilePartyUnion.IsTradeUnionist; if (objStopWorking != null && objStopWorking.DateStop != null) row[Sal_ReportProfileEntity.FieldNames.DateStop] = objStopWorking.DateStop; if (profile.DateHire != null) row[Sal_ReportProfileEntity.FieldNames.DateHire] = profile.DateHire; table.Rows.Add(row); } } return table.ConfigTable(true); } }