From 4e7c486817b86876b674fa1c002693c0b9c2a246 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Wed, 9 Nov 2022 17:27:48 +0700 Subject: [PATCH] add reports --- Controllers/HrRecruit.Controller.cs | 358 ++++++++++++++++++ Models/Hrrecruit/appoint_higher_position.cs | 18 + Models/Hrrecruit/directive_employment.cs | 16 + Models/Hrrecruit/faculty_council.cs | 14 + .../offer_position_assistant_professor.cs | 16 + Models/Hrrecruit/personnel_retire.cs | 34 ++ .../registration_management_position.cs | 14 + Models/Hrrecruit/request_salary_document.cs | 17 + .../support_personnel_qualification.cs | 18 + wwwroot/reports/appoint_higher_position.frx | 88 +++++ wwwroot/reports/directive_employment.frx | 78 ++++ wwwroot/reports/faculty_council.frx | 68 ++++ wwwroot/reports/personnel_retire.frx | 124 ++++++ .../registration_management_position.frx | 63 +++ ...tration_management_position_department.frx | 63 +++ wwwroot/reports/request_salary_document.frx | 83 ++++ .../support_personnel_qualification.frx | 88 +++++ 17 files changed, 1160 insertions(+) create mode 100644 Controllers/HrRecruit.Controller.cs create mode 100644 Models/Hrrecruit/appoint_higher_position.cs create mode 100644 Models/Hrrecruit/directive_employment.cs create mode 100644 Models/Hrrecruit/faculty_council.cs create mode 100644 Models/Hrrecruit/offer_position_assistant_professor.cs create mode 100644 Models/Hrrecruit/personnel_retire.cs create mode 100644 Models/Hrrecruit/registration_management_position.cs create mode 100644 Models/Hrrecruit/request_salary_document.cs create mode 100644 Models/Hrrecruit/support_personnel_qualification.cs create mode 100644 wwwroot/reports/appoint_higher_position.frx create mode 100644 wwwroot/reports/directive_employment.frx create mode 100644 wwwroot/reports/faculty_council.frx create mode 100644 wwwroot/reports/personnel_retire.frx create mode 100644 wwwroot/reports/registration_management_position.frx create mode 100644 wwwroot/reports/registration_management_position_department.frx create mode 100644 wwwroot/reports/request_salary_document.frx create mode 100644 wwwroot/reports/support_personnel_qualification.frx diff --git a/Controllers/HrRecruit.Controller.cs b/Controllers/HrRecruit.Controller.cs new file mode 100644 index 0000000..23a0f0a --- /dev/null +++ b/Controllers/HrRecruit.Controller.cs @@ -0,0 +1,358 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using FastReport; +using FastReport.Export.Csv; +using FastReport.Export.Mht; +using FastReport.Export.OoXML; +using FastReport.Export.Pdf; +using Microsoft.AspNetCore.Mvc; +using rmutr_report.Models; +using rmutr_report.Models.Hr; +using rmutr_report.Models.Hrrecruit; +using Swashbuckle.AspNetCore.Annotations; + +namespace rmutr_report.Controllers +{ + [SwaggerTag("สำหรับรายงาน งานสรรหา")] + public class HrRecruit: Controller + { + readonly Setting _setting; + + public HrRecruit(Setting setting) + { + this._setting = setting; + } + + [HttpPost, Route("reports/registration_management_position/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr1Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "registration_management_position.frx"); + report.RegisterData(_hr, "registration_management_position"); + 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"); + + case "xls": + 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/registration_management_position_department/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr2Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "registration_management_position_department.frx"); + report.RegisterData(_hr, "registration_management_position"); + 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"); + + case "xls": + 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/faculty_council/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr3Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "faculty_council.frx"); + report.RegisterData(_hr, "faculty_council"); + 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"); + + case "xls": + 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/support_personnel_qualification/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr4Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "support_personnel_qualification.frx"); + report.RegisterData(_hr, "support_personnel_qualification"); + 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"); + + case "xls": + 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/appoint_higher_position/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr5Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "appoint_higher_position.frx"); + report.RegisterData(_hr, "appoint_higher_position"); + 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"); + + case "xls": + 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/directive_employment/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr6Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "directive_employment.frx"); + report.RegisterData(_hr, "directive_employment"); + 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"); + + case "xls": + 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/personnel_retire/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr7Report([FromRoute] string type, [FromBody] personnel_retire _hr) + { + var hr1 = new List() {_hr}; + + Report report = new Report(); + report.Load(_setting.report_path + "personnel_retire.frx"); + report.RegisterData(hr1, "personnel_retire"); + 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"); + + case "xls": + 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/request_salary_document/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHr8Report([FromRoute] string type, [FromBody] List _hr) + { + + Report report = new Report(); + report.Load(_setting.report_path + "request_salary_document.frx"); + report.RegisterData(_hr, "request_salary_document"); + 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"); + + case "xls": + 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(); + } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/appoint_higher_position.cs b/Models/Hrrecruit/appoint_higher_position.cs new file mode 100644 index 0000000..c667b21 --- /dev/null +++ b/Models/Hrrecruit/appoint_higher_position.cs @@ -0,0 +1,18 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class appoint_higher_position + { + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string previous_position_level { get; set; } + public string department { get; set; } + public string agency_name_th { get; set; } + public string area { get; set; } + public string appointment_date { get; set; } + public string position_appointment_level { get; set; } + public string appointment_receive_date { get; set; } + public string directive_number { get; set; } + public string performance { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/directive_employment.cs b/Models/Hrrecruit/directive_employment.cs new file mode 100644 index 0000000..1f9267b --- /dev/null +++ b/Models/Hrrecruit/directive_employment.cs @@ -0,0 +1,16 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class directive_employment + { + public string pertype { get; set; } + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string qualification { get; set; } + public string agency_name_th { get; set; } + public string area { get; set; } + public string period_employment { get; set; } + public string year { get; set; } + public string directive_number { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/faculty_council.cs b/Models/Hrrecruit/faculty_council.cs new file mode 100644 index 0000000..0036703 --- /dev/null +++ b/Models/Hrrecruit/faculty_council.cs @@ -0,0 +1,14 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class faculty_council + { + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string position_level { get; set; } + public string agency_name_th { get; set; } + public string work_agency_name_th { get; set; } + public string area { get; set; } + public string working_age { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/offer_position_assistant_professor.cs b/Models/Hrrecruit/offer_position_assistant_professor.cs new file mode 100644 index 0000000..1fe698e --- /dev/null +++ b/Models/Hrrecruit/offer_position_assistant_professor.cs @@ -0,0 +1,16 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class offer_position_assistant_professor + { + public string display_name_th { get; set; } + public string position_name { get; set; } + public string major_name_th { get; set; } + public string agency_name_th { get; set; } + public string packing_date { get; set; } + public string first_qualification_pack { get; set; } + public string qualification_end_date { get; set; } + public string working_age { get; set; } + public string note { get; set; } + + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/personnel_retire.cs b/Models/Hrrecruit/personnel_retire.cs new file mode 100644 index 0000000..b4da938 --- /dev/null +++ b/Models/Hrrecruit/personnel_retire.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.Hrrecruit +{ + public class personnel_retire + { + public string directive_number { get; set; } + public string directive_date { get; set; } + public string year { get; set; } + public List data { get; set; } + + } + + public class personnel_retire_detail + { + public string pertype { get; set; } + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string agency_name_th { get; set; } + public string area { get; set; } + public string expiration_date { get; set; } + public string cause_dead { get; set; } + public string cause_resign { get; set; } + public string cause_retire { get; set; } + public string cause_end_contract { get; set; } + public string cause_dismissal { get; set; } + public string cause_disengage { get; set; } + public string cause_sack { get; set; } + public string cause_other { get; set; } + public string reason_extinction { get; set; } + public string directive_number { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/registration_management_position.cs b/Models/Hrrecruit/registration_management_position.cs new file mode 100644 index 0000000..d6cb468 --- /dev/null +++ b/Models/Hrrecruit/registration_management_position.cs @@ -0,0 +1,14 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class registration_management_position + { + public string position_name { get; set; } + public string rate_number { get; set; } + public string display_name_th { get; set; } + public string directive_number { get; set; } + public string appointment_date { get; set; } + public string tenure_expiration_date { get; set; } + public string note { get; set; } + + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/request_salary_document.cs b/Models/Hrrecruit/request_salary_document.cs new file mode 100644 index 0000000..e324df8 --- /dev/null +++ b/Models/Hrrecruit/request_salary_document.cs @@ -0,0 +1,17 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class request_salary_document + { + public string pertype { get; set; } + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string qualification { get; set; } + public string agency_name_th { get; set; } + public string area { get; set; } + public decimal? salary { get; set; } + public string request_document_date { get; set; } + public string document_type { get; set; } + public int? number { get; set; } + } +} \ No newline at end of file diff --git a/Models/Hrrecruit/support_personnel_qualification.cs b/Models/Hrrecruit/support_personnel_qualification.cs new file mode 100644 index 0000000..d452c2b --- /dev/null +++ b/Models/Hrrecruit/support_personnel_qualification.cs @@ -0,0 +1,18 @@ +namespace rmutr_report.Models.Hrrecruit +{ + public class support_personnel_qualification + { + public string position_number { get; set; } + public string display_name_th { get; set; } + public string position_name { get; set; } + public string position_level { get; set; } + public string agency_name_th { get; set; } + public string area { get; set; } + public decimal? salary { get; set; } + public string education_level { get; set; } + public string official_start_date { get; set; } + public string department { get; set; } + public string appointment_date { get; set; } + public string working_age { get; set; } + } +} \ No newline at end of file diff --git a/wwwroot/reports/appoint_higher_position.frx b/wwwroot/reports/appoint_higher_position.frx new file mode 100644 index 0000000..241fe70 --- /dev/null +++ b/wwwroot/reports/appoint_higher_position.frx @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/directive_employment.frx b/wwwroot/reports/directive_employment.frx new file mode 100644 index 0000000..60ff909 --- /dev/null +++ b/wwwroot/reports/directive_employment.frx @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/faculty_council.frx b/wwwroot/reports/faculty_council.frx new file mode 100644 index 0000000..70156cb --- /dev/null +++ b/wwwroot/reports/faculty_council.frx @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/personnel_retire.frx b/wwwroot/reports/personnel_retire.frx new file mode 100644 index 0000000..2d6c5da --- /dev/null +++ b/wwwroot/reports/personnel_retire.frx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/registration_management_position.frx b/wwwroot/reports/registration_management_position.frx new file mode 100644 index 0000000..1098968 --- /dev/null +++ b/wwwroot/reports/registration_management_position.frx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/registration_management_position_department.frx b/wwwroot/reports/registration_management_position_department.frx new file mode 100644 index 0000000..bd67a2c --- /dev/null +++ b/wwwroot/reports/registration_management_position_department.frx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/request_salary_document.frx b/wwwroot/reports/request_salary_document.frx new file mode 100644 index 0000000..7971171 --- /dev/null +++ b/wwwroot/reports/request_salary_document.frx @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/support_personnel_qualification.frx b/wwwroot/reports/support_personnel_qualification.frx new file mode 100644 index 0000000..a538449 --- /dev/null +++ b/wwwroot/reports/support_personnel_qualification.frx @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +