From 45037a9a80b694c214d31c76b6d94238e5a330b6 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Tue, 15 Nov 2022 13:35:24 +0700 Subject: [PATCH] add reports --- Controllers/HrDevelopment.Controller.cs | 164 +++++++++++++++ .../HrDevelopment/academic_position_leave.cs | 29 +++ Models/HrDevelopment/company_database.cs | 21 ++ Models/HrDevelopment/progress_report.cs | 14 ++ .../summary_academic_position_leave.cs | 51 +++++ wwwroot/reports/academic_position_leave.frx | 113 +++++++++++ wwwroot/reports/company_database.frx | 64 ++++++ wwwroot/reports/progress_report.frx | 77 ++++++++ .../summary_academic_position_leave.frx | 187 ++++++++++++++++++ 9 files changed, 720 insertions(+) create mode 100644 Models/HrDevelopment/academic_position_leave.cs create mode 100644 Models/HrDevelopment/company_database.cs create mode 100644 Models/HrDevelopment/progress_report.cs create mode 100644 Models/HrDevelopment/summary_academic_position_leave.cs create mode 100644 wwwroot/reports/academic_position_leave.frx create mode 100644 wwwroot/reports/company_database.frx create mode 100644 wwwroot/reports/progress_report.frx create mode 100644 wwwroot/reports/summary_academic_position_leave.frx diff --git a/Controllers/HrDevelopment.Controller.cs b/Controllers/HrDevelopment.Controller.cs index 7078999..66cbaf6 100644 --- a/Controllers/HrDevelopment.Controller.cs +++ b/Controllers/HrDevelopment.Controller.cs @@ -494,6 +494,170 @@ namespace rmutr_report.Controllers break; } + return Ok(); + } + [HttpPost, Route("reports/summary_not_graduation/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult Gethr12Report([FromRoute] string type, [FromBody] List _hr) + { + //var hr = new List(){_hr}; + Report report = new Report(); + report.Load(_setting.report_path + "progress_report.frx"); + report.RegisterData(_hr, "progress_report"); + 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": 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/academic_position_leave/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult Gethr13Report([FromRoute] string type, [FromBody] academic_position_leave _hr) + { + var hr = new List(){_hr}; + Report report = new Report(); + report.Load(_setting.report_path + "academic_position_leave.frx"); + report.RegisterData(hr, "academic_position_leave"); + 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": 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/company_database/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult Gethr14Report([FromRoute] string type, [FromBody] company_database _hr) + { + var hr = new List(){_hr}; + Report report = new Report(); + report.Load(_setting.report_path + "company_database.frx"); + report.RegisterData(hr, "company_database"); + 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": 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/summary_academic_position_leave/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult Gethr15Report([FromRoute] string type, [FromBody] summary_academic_position_leave _hr) + { + var hr = new List(){_hr}; + Report report = new Report(); + report.Load(_setting.report_path + "summary_academic_position_leave.frx"); + report.RegisterData(hr, "summary_academic_position_leave"); + 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": 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/HrDevelopment/academic_position_leave.cs b/Models/HrDevelopment/academic_position_leave.cs new file mode 100644 index 0000000..8d35202 --- /dev/null +++ b/Models/HrDevelopment/academic_position_leave.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.HrDevelopment +{ + public class academic_position_leave + { + public string year { get; set; } + public List data { get; set; } + } + + public class academic_position_leave_detail + { + public string display_name_th { get; set; } + public string position_name { get; set; } + public string faculty_name { get; set; } + public string research { get; set; } + public string treatise { get; set; } + public string increase_academic_knowledge { get; set; } + public string title { get; set; } + public string location { get; set; } + public string period { get; set; } + public string expenses { get; set; } + public string directive_go { get; set; } + public string directive_back { get; set; } + public string return_date { get; set; } + public string contract_number { get; set; } + public string note { get; set; } + } +} \ No newline at end of file diff --git a/Models/HrDevelopment/company_database.cs b/Models/HrDevelopment/company_database.cs new file mode 100644 index 0000000..eff39d3 --- /dev/null +++ b/Models/HrDevelopment/company_database.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.HrDevelopment +{ + public class company_database + { + public string faculty_name { get; set; } + public List data { get; set; } + } + + public class company_database_detail + { + public string company_name { get; set; } + public string address { get; set; } + public string company_type { get; set; } + public string mou { get; set; } + public string phone_no { get; set; } + public string note { get; set; } + + } +} \ No newline at end of file diff --git a/Models/HrDevelopment/progress_report.cs b/Models/HrDevelopment/progress_report.cs new file mode 100644 index 0000000..b65f210 --- /dev/null +++ b/Models/HrDevelopment/progress_report.cs @@ -0,0 +1,14 @@ +namespace rmutr_report.Models.HrDevelopment +{ + public class progress_report + { + public string display_name_th { get; set; } + public string faculty_name { get; set; } + public string research { get; set; } + public string collection_academic_text { get; set; } + public string start_end_date1 { get; set; } + public string start_end_date2 { get; set; } + public string start_end_date3 { get; set; } + public string note { get; set; } + } +} \ No newline at end of file diff --git a/Models/HrDevelopment/summary_academic_position_leave.cs b/Models/HrDevelopment/summary_academic_position_leave.cs new file mode 100644 index 0000000..86db0f2 --- /dev/null +++ b/Models/HrDevelopment/summary_academic_position_leave.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.HrDevelopment +{ + public class summary_academic_position_leave + { + public string faculty_name { get; set; } + public string budget_year1 { get; set; } + public string budget_year2 { get; set; } + public string budget_year3 { get; set; } + public string budget_year4 { get; set; } + public string budget_year5 { get; set; } + public string budget_year6 { get; set; } + public string budget_year7 { get; set; } + public string budget_year8 { get; set; } + public string budget_year9 { get; set; } + public string budget_year10 { get; set; } + public string budget_year11 { get; set; } + public decimal? total_1 { get; set; } + public decimal? total_2 { get; set; } + public decimal? total_3 { get; set; } + public decimal? total_4 { get; set; } + public decimal? total_5 { get; set; } + public decimal? total_6 { get; set; } + public decimal? total_7 { get; set; } + public decimal? total_8 { get; set; } + public decimal? total_9 { get; set; } + public decimal? total_10 { get; set; } + public decimal? total_11 { get; set; } + public List data { get; set; } + } + public class summary_academic_position_leave_detail{ + public string major_name_th { get; set; } + public decimal? quantity_teacher_major { get; set; } + public decimal? quantity_teacher_increase { get; set; } + public string research { get; set; } + public string treatise { get; set; } + public string increase_academic_knowledge { get; set; } + public decimal? budget_year1 { get; set; } + public decimal? budget_year2 { get; set; } + public decimal? budget_year3 { get; set; } + public decimal? budget_year4 { get; set; } + public decimal? budget_year5 { get; set; } + public decimal? budget_year6 { get; set; } + public decimal? budget_year7 { get; set; } + public decimal? budget_year8 { get; set; } + public decimal? budget_year9 { get; set; } + public decimal? budget_year10 { get; set; } + public decimal? budget_year11 { get; set; } + } +} \ No newline at end of file diff --git a/wwwroot/reports/academic_position_leave.frx b/wwwroot/reports/academic_position_leave.frx new file mode 100644 index 0000000..ac9c0b8 --- /dev/null +++ b/wwwroot/reports/academic_position_leave.frx @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/company_database.frx b/wwwroot/reports/company_database.frx new file mode 100644 index 0000000..2057f15 --- /dev/null +++ b/wwwroot/reports/company_database.frx @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/progress_report.frx b/wwwroot/reports/progress_report.frx new file mode 100644 index 0000000..6762651 --- /dev/null +++ b/wwwroot/reports/progress_report.frx @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/summary_academic_position_leave.frx b/wwwroot/reports/summary_academic_position_leave.frx new file mode 100644 index 0000000..d8b0a08 --- /dev/null +++ b/wwwroot/reports/summary_academic_position_leave.frx @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +