From f4a7c9c81426f6cc663fb491b86ee1ef934e116b Mon Sep 17 00:00:00 2001 From: Nakorn Rientrakrunchai Date: Mon, 24 Aug 2020 09:19:47 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=20ui=20=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99=20=E0=B9=80=E0=B8=87?= =?UTF-8?q?=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rpt_payroll_summaryControllers.cs | 120 ++++++++++++++++++ .../eva_level_score@rpt_payroll_summary.xlsx | Bin 0 -> 10052 bytes .../Iexternal_linkageService.cs | 2 + .../external_linkageService.cs | 41 ++++++ .../Irpt_payroll_summaryService.cs | 20 +++ .../rpt_payroll_summaryInputModel.cs | 28 ++++ .../rpt_payroll_summaryReportRequestModel.cs | 21 +++ .../rpt_payroll_summarySearchModel.cs | 27 ++++ .../rpt_payroll_summaryService.cs | 42 ++++++ .../rpt_payroll_summaryViewModel.cs | 28 ++++ ...t_payroll_summaryWithSelectionViewModel.cs | 15 +++ Startup.cs | 6 + .../rpt_payroll_summaryViewControllers.cs | 66 ++++++++++ Views/home/index.cshtml | 3 + .../rpt_payroll_summary_report.cshtml | 66 ++++++++++ tb320eva.xml | 36 ++++++ .../rpt_payroll_summary_report.js | 62 +++++++++ 17 files changed, 583 insertions(+) create mode 100644 ApiControllers/rpt_payroll_summaryControllers.cs create mode 100644 EXCEL/eva_level_score@rpt_payroll_summary.xlsx create mode 100644 Models/rpt_payroll_summary/Irpt_payroll_summaryService.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summaryInputModel.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summarySearchModel.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summaryService.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summaryViewModel.cs create mode 100644 Models/rpt_payroll_summary/rpt_payroll_summaryWithSelectionViewModel.cs create mode 100644 ViewControllers/rpt_payroll_summaryViewControllers.cs create mode 100644 Views/rpt_payroll_summaryView/rpt_payroll_summary_report.cshtml create mode 100644 wwwroot/js/rpt_payroll_summary/rpt_payroll_summary_report.js diff --git a/ApiControllers/rpt_payroll_summaryControllers.cs b/ApiControllers/rpt_payroll_summaryControllers.cs new file mode 100644 index 0000000..604e6e1 --- /dev/null +++ b/ApiControllers/rpt_payroll_summaryControllers.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Logging; +using TTSW.Controllers; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.Data; +using Microsoft.Extensions.Configuration; +using System.IO; +using System.Net; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/rpt_payroll_summary")] + public class rpt_payroll_summaryController : BaseController + { + #region Private Variables + private ILogger _logger; + private Irpt_payroll_summaryService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public rpt_payroll_summaryController(ILogger logger, Irpt_payroll_summaryService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(rpt_payroll_summaryWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetBlankItem() + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetBlankItem(); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("rpt_payroll_summary_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult rpt_payroll_summary_report(rpt_payroll_summaryReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = new WebClient(); + + string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); + string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite"); + string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username"); + string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password"); + + string url = $"{mainurl}{reportsite}/rpt_payroll_summary.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + + var data = httpclient.DownloadData(url); + var stream = new MemoryStream(data); + + return File(stream, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + } +} diff --git a/EXCEL/eva_level_score@rpt_payroll_summary.xlsx b/EXCEL/eva_level_score@rpt_payroll_summary.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..5bd01f937a2eddd251aef3943959990c8902bf9d GIT binary patch literal 10052 zcmeHN1y>x|wr<>=Ai;ura0nXQ-8Hzo1eY}K79_a41b26Lf`_2N3GVPZGxxsCFnR9} z+*`d?)v8sszpiu6{R-LSF3zzENi_%0vr4qK2T)}Ewi{gw2r)-fzLy&*N>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%ZU zn4X+Qyv#oUi&h_~M@|=0iT;Ni-|k=KN`<>G5y-zi*(wR5kdjY8Gg=C1N-9Td!iAv} zkHAP7mHG!j(E>>s==pXSDt>-2Y8m8E|Mpa1yxDvOdhc%Sb+zevN1KA%H}j(&E0iVA z{s18$U1UlAXJHdjpd&42s&Gj?skR8t!8HLkUuP?7u{-eG@~dgSY|_Wc@Ili@2pfPM z7kX@WUiUJaU@Tk_*;eQqF`Osj4%BfLWK+0?1yrvBMIH;pL8hROP1=W^j)fN|(RlSbG6|q=2&`$H0yp)WGw}@u8*7 zHTza!mGo`%R1fyxTAxI(Kc0*%PylMpo;EHoGe~LDH z&9@aUFM&D=*~7@!l>Xt>I3pz#jV2!VBjEDip5SK)VD|nnMT!_F@196V?3IniMXH%Jc!>lT@;L@0b zxv09y8FP=th)oaITVV+uA}-zY=*eFBkgaS?C`dd@?92Fu)rW>_8hA1ciw(mMlK5b~ zwU5^V)(+CqgJ4+rXcg%63Yrojbpd1Fe78CzF&s^Ums%1l%~JzX%rdxO$ry%D!~7ux z3bWe83;3DH%iV8RC%6`YC`8WvJsp}}QiI%XJTQ+0%68SNHQ_kjCNa7D? zo6k2X^%5Mqbs3482S=qD3^ad};CS5PoN?j6YG-eQ4^DxKHHPLA$@A^Ai6L{VP)jOC z6e7m4e>K5%KFfE{jrf~fwT1n8a*Rm2)Z&cSJnLSIy?8=DTE@<@7V9X4Mj7lhugo)T z+&(U#5buBS=baf(ukZSCjWUfgH(VleQ?%)lHX7%7Gki+~T8TgNKrnE6Q1jsTJAwYa zUjM%SW?zuJ)ZYRAzDMETf GetAllChildInDep(int? dep_id); List GetChildInDep(int? dep_id); List GetSortingDep(); + List GetFiscalYear2(); + List GetThaiMonth(); } } diff --git a/Models/external_linkage/external_linkageService.cs b/Models/external_linkage/external_linkageService.cs index 6a0588b..1d7272b 100644 --- a/Models/external_linkage/external_linkageService.cs +++ b/Models/external_linkage/external_linkageService.cs @@ -14,6 +14,7 @@ using System.Net; using TTSW.Configure; using Microsoft.Extensions.Options; using System.Data; +using System.Globalization; namespace TodoAPI2.Models { @@ -354,6 +355,26 @@ namespace TodoAPI2.Models return result; } + public List GetFiscalYear2() + { + int start_year = DateTime.Now.Year - 10; + if (start_year < 2400) start_year += 543; + int end_year = DateTime.Now.Year + 3; + if (end_year < 2400) end_year += 543; + + var result = new List(); + for (int x = start_year; x <= end_year; x++) + { + var i = new external_linkageViewModel(); + i.external_id = x - 543; + i.external_code = x.ToString(); + i.external_name = x.ToString(); + result.Add(i); + } + + return result; + } + //public List GetEvaRound() //{ // var sql = string.Format("select distinct eva_performance_plan.id,eva_performance_plan.{0}theTime{0} , eva_performance_plan.fiscal_year from eva_performance_plan order by eva_performance_plan.fiscal_year,eva_performance_plan.{0}theTime{0}", '"'.ToString()); @@ -426,6 +447,26 @@ where detail.parent_department_id={1} or data1.id={1};", '"'.ToString(), dep_id. return result; } + public List GetThaiMonth() + { + var result = new List(); + + for (int monthNo = 1; monthNo <= 12; monthNo++) + { + var bar = new DateTime(DateTime.Now.Year, monthNo, 1); + string month = bar.ToString("MMMM", new CultureInfo("th-TH")); + + var i = new external_linkageViewModel(); + //i.external_guid = null; + i.external_id = monthNo; + i.external_code = monthNo.ToString(); + i.external_name = month; + result.Add(i); + } + + return result; + } + public List GetSortingDep() { var sql = string.Format(@" diff --git a/Models/rpt_payroll_summary/Irpt_payroll_summaryService.cs b/Models/rpt_payroll_summary/Irpt_payroll_summaryService.cs new file mode 100644 index 0000000..1e90dcd --- /dev/null +++ b/Models/rpt_payroll_summary/Irpt_payroll_summaryService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; + +namespace TodoAPI2.Models +{ + public interface Irpt_payroll_summaryService + { + rpt_payroll_summaryWithSelectionViewModel GetBlankItem(); + + + } +} + diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryInputModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryInputModel.cs new file mode 100644 index 0000000..895fd27 --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryInputModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summaryInputModel + { + + public Guid? id { get; set; } + + public int? rpt_year { get; set; } + + public int? rpt_month { get; set; } + + public int? department_id { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs new file mode 100644 index 0000000..805683b --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summaryReportRequestModel : rpt_payroll_summarySearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/rpt_payroll_summary/rpt_payroll_summarySearchModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summarySearchModel.cs new file mode 100644 index 0000000..d45ec22 --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summarySearchModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summarySearchModel + { + + public Guid id { get; set; } + + public int? rpt_year { get; set; } + + public int? rpt_month { get; set; } + + public int? department_id { get; set; } + + } +} + diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryService.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryService.cs new file mode 100644 index 0000000..621e50f --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryService.cs @@ -0,0 +1,42 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.IO; +using System.Web; +using System.Net; +using TTSW.Configure; +using Microsoft.Extensions.Options; +using System.Data; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summaryService : Irpt_payroll_summaryService + { + private IMyDatabase db; + private Iexternal_linkageService ext; + + public rpt_payroll_summaryService(IMyDatabase mydb, Iexternal_linkageService inext) + { + db = mydb; + ext = inext; + } + + public rpt_payroll_summaryWithSelectionViewModel GetBlankItem() + { + var i = new rpt_payroll_summaryWithSelectionViewModel(); + i.item_rpt_year = (from x in ext.GetFiscalYear2() orderby x.external_id descending select x).ToList(); + i.item_rpt_month = (from x in ext.GetThaiMonth() select x).ToList(); + i.item_department_id = (from x in ext.GetSortingDep() select x).ToList(); + + + return i; + } + } +} \ No newline at end of file diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryViewModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryViewModel.cs new file mode 100644 index 0000000..1334fdd --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryViewModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summaryViewModel : BaseViewModel2 + { + + public int? rpt_year { get; set; } + + public int? rpt_month { get; set; } + + public int? department_id { get; set; } + + public string rpt_year_external_linkage_external_name { get; set; } + public string rpt_month_external_linkage_external_name { get; set; } + public string department_id_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryWithSelectionViewModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryWithSelectionViewModel.cs new file mode 100644 index 0000000..acd9f1e --- /dev/null +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryWithSelectionViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class rpt_payroll_summaryWithSelectionViewModel: rpt_payroll_summaryViewModel + { + public List item_rpt_year { get; set; } + public List item_rpt_month { get; set; } + public List item_department_id { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index afe543d..3fca47b 100644 --- a/Startup.cs +++ b/Startup.cs @@ -287,6 +287,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -502,6 +504,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/ViewControllers/rpt_payroll_summaryViewControllers.cs b/ViewControllers/rpt_payroll_summaryViewControllers.cs new file mode 100644 index 0000000..197b827 --- /dev/null +++ b/ViewControllers/rpt_payroll_summaryViewControllers.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using TodoAPI2.Models; +using STAFF_API.Models; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; +using TodoAPI2.Controllers; + +namespace TodoAPI2.Controllers +{ + public class rpt_payroll_summaryViewController : Controller + { + private ILogger _logger; + private Irpt_payroll_summaryService _repository; + private IConfiguration Configuration { get; set; } + + ///

+ /// Default constructure for dependency injection + /// + /// + /// + /// + public rpt_payroll_summaryViewController(ILogger logger, Irpt_payroll_summaryService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + // public IActionResult rpt_payroll_summary() + // { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + // } + + // public IActionResult rpt_payroll_summary_d() + // { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + // } + + public IActionResult rpt_payroll_summary_report() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + //public IActionResult rpt_payroll_summary_inline() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} + + diff --git a/Views/home/index.cshtml b/Views/home/index.cshtml index 3d53db9..c5d4f72 100644 --- a/Views/home/index.cshtml +++ b/Views/home/index.cshtml @@ -71,6 +71,9 @@ + diff --git a/Views/rpt_payroll_summaryView/rpt_payroll_summary_report.cshtml b/Views/rpt_payroll_summaryView/rpt_payroll_summary_report.cshtml new file mode 100644 index 0000000..448f01b --- /dev/null +++ b/Views/rpt_payroll_summaryView/rpt_payroll_summary_report.cshtml @@ -0,0 +1,66 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "rpt_payroll_summary"; +} + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
รายงานเงินเดือน
+
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ + +
+
+
+
+
+ + +@section FooterPlaceHolder{ + + +} + diff --git a/tb320eva.xml b/tb320eva.xml index 353655e..97749ca 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -3572,6 +3572,34 @@ Returns the item Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + Default constructure for dependency injection @@ -3884,6 +3912,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/rpt_payroll_summary/rpt_payroll_summary_report.js b/wwwroot/js/rpt_payroll_summary/rpt_payroll_summary_report.js new file mode 100644 index 0000000..c6424d3 --- /dev/null +++ b/wwwroot/js/rpt_payroll_summary/rpt_payroll_summary_report.js @@ -0,0 +1,62 @@ +var rpt_payroll_summary_API = "/api/rpt_payroll_summary/"; + +//================= Search Customizaiton ========================================= + +function rpt_payroll_summary_GetSearchParameter(fileType) { + var rpt_payroll_summarySearchObject = new Object(); +rpt_payroll_summarySearchObject.rpt_year = $("#s_rpt_payroll_summary_rpt_year").val(); +rpt_payroll_summarySearchObject.rpt_month = $("#s_rpt_payroll_summary_rpt_month").val(); +rpt_payroll_summarySearchObject.department_id = $("#s_rpt_payroll_summary_department_id").val(); + + + rpt_payroll_summarySearchObject.fileType = fileType; + + console.log(rpt_payroll_summarySearchObject); + + return rpt_payroll_summarySearchObject; +} + +function rpt_payroll_summary_FeedDataToSearchForm(data) { +DropDownClearFormAndFeedWithData($("#s_rpt_payroll_summary_rpt_year"), data, "id", "external_name", "item_rpt_year", data.rpt_year); +DropDownClearFormAndFeedWithData($("#s_rpt_payroll_summary_rpt_month"), data, "id", "external_name", "item_rpt_month", data.rpt_month); +DropDownClearFormAndFeedWithData($("#s_rpt_payroll_summary_department_id"), data, "id", "external_name", "item_department_id", data.department_id); + +} + +//================= Form Data Customizaiton ========================================= + +function rpt_payroll_summary_InitialForm(s) { + var successFunc = function (result) { + rpt_payroll_summary_FeedDataToSearchForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + rpt_payroll_summary_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Data Table ========================================= + +var s_rpt_payroll_summary_customValidation = function (group) { + return ""; +}; + + +function rpt_payroll_summary_DoSearch(fileType) { + if (!ValidateForm('s_rpt_payroll_summary', s_rpt_payroll_summary_customValidation)) { + return; + } + + var p = $.param(rpt_payroll_summary_GetSearchParameter(fileType)); + + var report_url = apisite + "/api/rpt_payroll_summary/rpt_payroll_summary_report?" + p; + + if (fileType === "pdf") { + $("#report_result").attr("src", report_url); + $("#report_result").show(); + //window.open(report_url); + } else { + $("#report_result").hide(); + window.open(report_url); + } +} +