From eb9d120c11c39016b468b21831cac10711a87585 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Mon, 7 Nov 2022 17:43:51 +0700 Subject: [PATCH] update --- Controllers/HrRegister.Controller.cs | 216 +++++++++++++++++++++++ Models/Hrregister/hr_attend.cs | 26 +++ Models/Hrregister/hr_contract_history.cs | 12 ++ Models/Hrregister/hr_discipline.cs | 22 +++ Models/Hrregister/hr_insignia.cs | 19 ++ wwwroot/reports/discipline.frx | 66 +++++++ wwwroot/reports/hr_attend.frx | 68 +++++++ wwwroot/reports/hr_contract_history.frx | 58 ++++++ wwwroot/reports/hr_insignia.frx | 94 ++++++++++ wwwroot/reports/hr_retire.frx | 68 +++++++ 10 files changed, 649 insertions(+) create mode 100644 Models/Hrregister/hr_attend.cs create mode 100644 Models/Hrregister/hr_contract_history.cs create mode 100644 Models/Hrregister/hr_discipline.cs create mode 100644 Models/Hrregister/hr_insignia.cs create mode 100644 wwwroot/reports/discipline.frx create mode 100644 wwwroot/reports/hr_attend.frx create mode 100644 wwwroot/reports/hr_contract_history.frx create mode 100644 wwwroot/reports/hr_insignia.frx create mode 100644 wwwroot/reports/hr_retire.frx diff --git a/Controllers/HrRegister.Controller.cs b/Controllers/HrRegister.Controller.cs index ad52a0d..978f2ef 100644 --- a/Controllers/HrRegister.Controller.cs +++ b/Controllers/HrRegister.Controller.cs @@ -499,6 +499,222 @@ namespace rmutr_report.Controllers break; } + return Ok(); + } + [HttpPost, Route("reports/hr_discipline/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr4Report([FromRoute] string type, [FromBody] hr_discipline _hr) + { + + var hr1 = new List() {_hr}; + + Report report = new Report(); + report.Load(_setting.report_path + "discipline.frx"); + report.RegisterData(hr1, "hr_discipline"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + break; + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + break; + case "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + break; + } + + return Ok(); + } + [HttpPost, Route("reports/hr_attend/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr5Report([FromRoute] string type, [FromBody] hr_attend _hr) + { + + var hr1 = new List() {_hr}; + + Report report = new Report(); + report.Load(_setting.report_path + "hr_attend.frx"); + report.RegisterData(hr1, "hr_attend"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + break; + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + break; + case "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + break; + } + + return Ok(); + } + [HttpPost, Route("reports/hr_retire/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr6Report([FromRoute] string type, [FromBody] hr_attend _hr) + { + + var hr1 = new List() {_hr}; + + Report report = new Report(); + report.Load(_setting.report_path + "hr_retire.frx"); + report.RegisterData(hr1, "hr_attend"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + break; + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + break; + case "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + break; + } + + return Ok(); + } + [HttpPost, Route("reports/hr_contract_history/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr7Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "hr_contract_history.frx"); + report.RegisterData(_hr, "hr_contract_history"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + break; + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + break; + case "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + break; + } + + return Ok(); + } + [HttpPost, Route("reports/hr_insignia/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr8Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "hr_insignia.frx"); + report.RegisterData(_hr, "hr_insignia"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + break; + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + break; + case "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + break; + } + return Ok(); } } diff --git a/Models/Hrregister/hr_attend.cs b/Models/Hrregister/hr_attend.cs new file mode 100644 index 0000000..b7e723b --- /dev/null +++ b/Models/Hrregister/hr_attend.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.Hrregister +{ + public class hr_attend + { + public string year_name_th { get; set; } + public string budget_year_name_th { get; set; } + public string month_name_th { get; set; } + public List data { get; set; } + } + + public class hr_attend_detail + { + public string display_name_th { get; set; } + public string agency_name_th { get; set; } + public string rate_number { get; set; } + public string directive_number { get; set; } + public string attend_date { get; set; } + public string retire_date { get; set; } + public string signing_date { get; set; } + public string attend_by { get; set; } + public string cause { get; set; } + + } +} \ No newline at end of file diff --git a/Models/Hrregister/hr_contract_history.cs b/Models/Hrregister/hr_contract_history.cs new file mode 100644 index 0000000..e62da40 --- /dev/null +++ b/Models/Hrregister/hr_contract_history.cs @@ -0,0 +1,12 @@ +namespace rmutr_report.Models.Hrregister +{ + public class hr_contract_history + { + public string display_name_th { get; set; } + public string agency_name_th { get; set; } + public string rate_number { get; set; } + public string timeline { get; set; } + public string directive_number { get; set; } + public string signing_date { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrregister/hr_discipline.cs b/Models/Hrregister/hr_discipline.cs new file mode 100644 index 0000000..6efbe8b --- /dev/null +++ b/Models/Hrregister/hr_discipline.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.Hrregister +{ + public class hr_discipline + { + public string year_name_th { get; set; } + public List data { get; set; } + } + + public class hr_discipline_detail + { + public string display_name_th { get; set; } + public string agency_name_th { get; set; } + public string rate_number { get; set; } + public string directive_number { get; set; } + public string signing_date { get; set; } + public string punishment_date { get; set; } + public string punishment_type { get; set; } + + } +} \ No newline at end of file diff --git a/Models/Hrregister/hr_insignia.cs b/Models/Hrregister/hr_insignia.cs new file mode 100644 index 0000000..8499ce5 --- /dev/null +++ b/Models/Hrregister/hr_insignia.cs @@ -0,0 +1,19 @@ +namespace rmutr_report.Models.Hrregister +{ + public class hr_insignia + { + public string display_name_th { get; set; } + public string position_name { get; set; } + public string agency_name_th { get; set; } + public string area_name_th { get; set; } + public string year { get; set; } + public string insignia_class { get; set; } + public string book { get; set; } + public string when { get; set; } + public string insignia_date { get; set; } + public string insignia_return { get; set; } + public string insignia_return_date { get; set; } + public string note { get; set; } + + } +} \ No newline at end of file diff --git a/wwwroot/reports/discipline.frx b/wwwroot/reports/discipline.frx new file mode 100644 index 0000000..ed0f681 --- /dev/null +++ b/wwwroot/reports/discipline.frx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/hr_attend.frx b/wwwroot/reports/hr_attend.frx new file mode 100644 index 0000000..f366aac --- /dev/null +++ b/wwwroot/reports/hr_attend.frx @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/hr_contract_history.frx b/wwwroot/reports/hr_contract_history.frx new file mode 100644 index 0000000..a4fa96c --- /dev/null +++ b/wwwroot/reports/hr_contract_history.frx @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/hr_insignia.frx b/wwwroot/reports/hr_insignia.frx new file mode 100644 index 0000000..b79d25c --- /dev/null +++ b/wwwroot/reports/hr_insignia.frx @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/hr_retire.frx b/wwwroot/reports/hr_retire.frx new file mode 100644 index 0000000..def3f98 --- /dev/null +++ b/wwwroot/reports/hr_retire.frx @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +