public ActionResult ExportIns_ReportInsuranceTrackingMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTrackingMonthlySearchModel model) { var services = new Ins_InsuranceReportServices(); var result = services.Ins_ReportInsuranceTrackingMonthlyLoadData(model.OrgStructureID, model.MonthYearFrom, model.MonthYearTo, model.IsProfileQuit, model.CodeEmp, model.WorkPlaceIDs,UserLogin); var lstModel = new List<Ins_ReportInsuranceTrackingMonthlySearchModel>(); if (result != null) { lstModel = result.Translate<Ins_ReportInsuranceTrackingMonthlySearchModel>(); // return Json(lstModel, JsonRequestBehavior.AllowGet); } var isDataTable = false; object obj = new Ins_ReportInsuranceTrackingMonthlySearchModel(); if (model.IsCreateTemplateForDynamicGrid) { obj = result; isDataTable = true; } if (model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportInsuranceTrackingMonthly", OutPutPath = path, DownloadPath = "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId.HasValue && model.ExportId.Value != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId.Value, result, null, ExportFileType.Excel); return Json(fullPath); } return Json(lstModel.ToDataSourceResult(request)); }
/// <summary> BC Đủ Điều Kiện Tham Gia Bảo Hiểm Theo Tháng </summary> /// <param name="request"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult ReportJoinInsuranceMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportJoinInsuranceMonthlyModel model) { var services = new Ins_InsuranceReportServices(); List<HeaderInfo> listHeaderInfo = null; var result = services.ReportJoinInsuranceMonthly(model.OrgStructureID, model.MonthYear.Value, model.CodeEmp, model.SocialInsPlaceIDs,UserLogin); var lstModel = new List<Ins_ReportJoinInsuranceMonthlyModel>(); if (result != null) { lstModel = result.Translate<Ins_ReportJoinInsuranceMonthlyModel>(); lstModel = lstModel.OrderBy(p => p.STT).ToList(); } var isDataTable = false; object obj = new Ins_ReportJoinInsuranceMonthlyModel(); #region Header Info var codeEmp = string.Empty; if (model != null && model.UserID != Guid.Empty) { Hre_ProfileServices profileService = new Hre_ProfileServices(); var profile = profileService.GetProfileInfo(model.UserID,UserLogin); if (profile != null && !string.IsNullOrEmpty(profile.CodeEmp)) { codeEmp = profile.CodeEmp; } } HeaderInfo headerInfoMonthYear = new HeaderInfo() { Name = "MonthYear", Value = model.MonthYear }; HeaderInfo headerInfoCurrentDate = new HeaderInfo() { Name = "CurrentDate", Value = DateTime.Now }; HeaderInfo headerInfoCodeEmp = new HeaderInfo() { Name = "CodeEmp", Value = codeEmp }; listHeaderInfo = new List<HeaderInfo>() { headerInfoMonthYear, headerInfoCurrentDate, headerInfoCodeEmp }; #endregion if (model.IsCreateTemplateForDynamicGrid) { obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportJoinInsuranceMonthlySearchModel", OutPutPath = path, HeaderInfo = listHeaderInfo, DownloadPath = "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, lstModel, listHeaderInfo, model.ExportType); return Json(fullPath.ToString().Replace("Success,", "").ToString()); } return Json(lstModel.ToDataSourceResult(request)); }
/// <summary> BC Dữ Liệu HDTJob Lần 2 </summary> /// <param name="request"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult Ins_ReportEmpHardJob2nd([DataSourceRequest] DataSourceRequest request, Ins_ReportEmpHardJob2ndModel model) { var services = new Ins_InsuranceReportServices(); // var result = services.LoadDataD03(model.All, model.Increase, model.Descrease, model.MonthYear, model.OrgStructureID, model.SearchNoteType, model.SearchStatus, model.CodeEmp, model.WorkPlaceIDs); var result = services.ReportEmpHardJob2nd(model.OrgStructureID, model.MonthYear.Value,UserLogin).Translate<Ins_ReportEmpHardJob2ndModel>(); result = result.OrderBy(m => m.Stt).ToList(); var lstModel = new List<Ins_ReportEmpHardJob2ndModel>(); if (result != null) { foreach (var item in result) { var rptD02Model = new Ins_ReportEmpHardJob2ndModel(); rptD02Model = item.Copy<Ins_ReportEmpHardJob2ndModel>(); lstModel.Add(rptD02Model); } } var isDataTable = false; object obj = new Ins_ReportEmpHardJob2ndModel(); if (model.IsCreateTemplateForDynamicGrid) { obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportEmpHardJob2ndSearchModel", OutPutPath = path, DownloadPath = "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, lstModel, null, model.ExportType); return Json(fullPath.ToString().Replace("Success,", "").ToString()); } return Json(lstModel.ToDataSourceResult(request)); }
public JsonResult GetIns_ReportInsuranceTrackingMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTrackingMonthlySearchModel model) { try { if (!string.IsNullOrEmpty(model.StrSocialInsPlaceIDs)) { var socialInsPlaceIDs = model.StrSocialInsPlaceIDs.Split(','); List<Guid> socailInsPlaceIDsTemp = new List<Guid>(); if (socialInsPlaceIDs.Length > 0) { foreach (var item in socialInsPlaceIDs) { Guid gTemp = new Guid(); gTemp = Guid.Empty; Guid.TryParse(item, out gTemp); if (gTemp != Guid.Empty) { socailInsPlaceIDsTemp.Add(gTemp); } } if (socailInsPlaceIDsTemp.Any()) { model.SocialInsPlaceIDs = socailInsPlaceIDsTemp; } } } var service = new Ins_InsuranceReportServices(); var result = service.Ins_ReportInsuranceTrackingMonthlyLoadData(model.OrgStructureID, model.MonthYearFrom, model.MonthYearTo, model.IsProfileQuit, model.CodeEmp, model.SocialInsPlaceIDs,UserLogin); return Json(result.ToDataSourceResult(request)); } catch { return Json(null); } }
/// <summary>Lấy ngày chốt BH (từ cấu hình )</summary> /// <returns></returns> public ActionResult GetPeriodInsuranceDay() { var service = new Ins_InsuranceReportServices(); var periodInsDayCurrentMonth = service.PeriodInsuranceDayCurrentMonth; return Json(periodInsDayCurrentMonth, JsonRequestBehavior.AllowGet); }
public ActionResult GetReportEmpHardJobList([DataSourceRequest] DataSourceRequest request, Ins_ReportEmpHardJobSearchModel model) { string status = string.Empty; var ReportServices = new Ins_InsuranceReportServices(); DateTime _DateFrom = DateTime.MinValue; DateTime _DateTo = DateTime.MaxValue; if (model != null && model.DateFrom != null) { _DateFrom = model.DateFrom.Value; } if (model != null && model.DateTo != null) { _DateTo = model.DateTo.Value; } var result = ReportServices.BC_EmpHardJob(_DateFrom, _DateTo, model.OrgStructureID); var isDataTable = false; object obj = new DataTable(); if (model.IsCreateTemplateForDynamicGrid) { var col = result.Columns.Count; result.Columns.RemoveAt(col - 1); obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportEmpHardJoblEntity", OutPutPath = path, DownloadPath = Hrm_Main_Web + "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType); return Json(fullPath); } return new JsonResult() { Data = result.ToDataSourceResult(request), MaxJsonLength = int.MaxValue }; }
public ActionResult GetReportInsuranceList([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTotalSearchModel model) { string status = string.Empty; //var isDataTable = false; var service = new BaseService(); //object obj = new Hre_ProfileModel(); ListQueryModel lstModel = new ListQueryModel { PageSize = int.MaxValue - 1, PageIndex = 1, Filters = ExtractFilterAttributes(request), Sorts = ExtractSortAttributes(request), AdvanceFilters = ExtractAdvanceFilterAttributes(model) }; // List<Hre_ProfileEntity> listProfile = service.GetData<Hre_ProfileEntity>(lstModel, ConstantSql.hrm_sal_sp_getdata_Profile, ref status); var ReportServices = new Ins_InsuranceReportServices(); DateTime _DateFrom = DateTime.MinValue; DateTime _DateTo = DateTime.MaxValue; if (model != null && model.DateFrom != null) { _DateFrom = model.DateFrom.Value; } if (model != null && model.DateTo != null) { _DateTo = model.DateTo.Value; } var result = ReportServices.BC_INSURANCETOTAL(_DateFrom, _DateTo, model.OrgStructureIDs, model.SocialInsPlaceIDs, UserLogin); var isDataTable = false; object obj = new DataTable(); if (model.IsCreateTemplateForDynamicGrid) { var col = result.Columns.Count; result.Columns.RemoveAt(col - 1); obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportInsuranceTotalEntity", OutPutPath = path, DownloadPath = Hrm_Main_Web + "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType); return Json(fullPath); } //return new JsonResult() { Data = result.ToDataSourceResult(request), MaxJsonLength = int.MaxValue }; #region mapping dataTable to dataList List<Ins_ReportInsuranceTotalModel> dataList = new List<Ins_ReportInsuranceTotalModel>(); Ins_ReportInsuranceTotalModel aTSource = null; if (result.Rows.Count > 0) { const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic; var objFieldNames = (from PropertyInfo aProp in typeof(Ins_ReportInsuranceTotalModel).GetProperties(flags) select new { Name = aProp.Name, Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType }).ToList(); var dataTblFieldNames = (from DataColumn aHeader in result.Columns select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList(); var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList(); foreach (DataRow dataRow in result.AsEnumerable().ToList()) { aTSource = new Ins_ReportInsuranceTotalModel(); foreach (var aField in commonFields) { PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name); if (dataRow[aField.Name] == DBNull.Value) continue; propertyInfos.SetValue(aTSource, dataRow[aField.Name], null); } dataList.Add(aTSource); } } #endregion return Json(dataList.ToDataSourceResult(request)); }
public ActionResult GetReportC70A([DataSourceRequest] DataSourceRequest request, Ins_SearchC70AReportModel model) { var isDataTable = false; object obj = new Ins_C70aReportEntity(); var service = new Ins_InsuranceReportServices(); ListQueryModel lstModel = new ListQueryModel { PageIndex = request.Page, PageSize = request.PageSize, Filters = ExtractFilterAttributes(request), Sorts = ExtractSortAttributes(request) }; var result = service.GetReportC70A(model.DateMonth, model.DateStart, model.DateEnd, model.OrgStructureID, model.CutOffDurationName, model.IsCreateTemplate); if (model.IsCreateTemplateForDynamicGrid) { obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_C70aReportModel", OutPutPath = path, DownloadPath = Hrm_Main_Web + "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { if (result.Rows.Count > 0) { foreach (DataRow row in result.Rows) { if (Enum.IsDefined(typeof(InsuranceRecordType), row[Ins_C70aReportModel.FieldNames.Status].ToString())) { row[Ins_C70aReportModel.FieldNames.Status] = row[Ins_C70aReportModel.FieldNames.Status].ToString().TranslateString(); } if (Enum.IsDefined(typeof(InsuranceRecordType), row[Ins_C70aReportModel.FieldNames.CodeEmp].ToString())) { row[Ins_C70aReportModel.FieldNames.CodeEmp] = row[Ins_C70aReportModel.FieldNames.CodeEmp].ToString().TranslateString(); } if (Enum.IsDefined(typeof(InsuranceRecordType), row[Ins_C70aReportModel.FieldNames.GroupName].ToString())) { row[Ins_C70aReportModel.FieldNames.GroupName] = row[Ins_C70aReportModel.FieldNames.GroupName].ToString().TranslateString(); } } } var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType); return Json(fullPath); } #region mapping dataTable to dataList //List<Ins_C70aReportModel> dataList = new List<Ins_C70aReportModel>(); //Ins_C70aReportModel aTSource = null; //if (result.Rows.Count > 0) //{ // const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic; // var objFieldNames = (from PropertyInfo aProp in typeof(Ins_C70aReportModel).GetProperties(flags) // select new // { // Name = aProp.Name, // Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType // }).ToList(); // var dataTblFieldNames = (from DataColumn aHeader in result.Columns // select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList(); // var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList(); // foreach (DataRow dataRow in result.AsEnumerable().ToList()) // { // aTSource = new Ins_C70aReportModel(); // foreach (var aField in commonFields) // { // PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name); // if (dataRow[aField.Name] == DBNull.Value) // continue; // propertyInfos.SetValue(aTSource, dataRow[aField.Name], null); // } // dataList.Add(aTSource); // } //} #endregion return Json(result.ToDataSourceResult(request)); }
/// <summary> BC Dữ Liệu BH NV Theo Tháng (Group Theo CostCenter) (form kế toán) </summary> /// <param name="request"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult ReportInsCostCenterMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportInsCostCenterMonthlyModel model) { var services = new Ins_InsuranceReportServices(); var result = services.ReportInsCostCenterMonthly(model.OrgStructureID, model.MonthYear.Value, model.CostCentreName, model.SocialInsPlaceIDs,UserLogin); var lstModel = new List<Ins_ReportInsCostCenterMonthlyModel>(); if (result != null) { lstModel = result.Translate<Ins_ReportInsCostCenterMonthlyModel>(); } var isDataTable = false; object obj = new Ins_ReportInsCostCenterMonthlyModel(); if (model.IsCreateTemplateForDynamicGrid) { obj = result; isDataTable = true; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "Ins_ReportInsCostCenterMonthlySearchModel", OutPutPath = path, DownloadPath = "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, lstModel, null, model.ExportType); return Json(fullPath.ToString().Replace("Success,", "").ToString()); } return Json(lstModel.ToDataSourceResult(request)); }