From 3ba45fb90a948b8d520c650b0ee9ce25d5febd24 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Fri, 17 Mar 2023 17:57:20 +0700 Subject: [PATCH] =?UTF-8?q?add=20=E0=B8=87.5-2.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project_request_thailand.Controller.cs | 92 ++ Models/budget/project_request_thai.cs | 131 +++ Models/budget/teaching_fee_extra.cs | 6 +- .../plant_genetic_conservation_project.frx | 146 +-- wwwroot/reports/project_request_thailands.frx | 1022 +++++++++++++++++ 5 files changed, 1327 insertions(+), 70 deletions(-) create mode 100644 Controllers/project_request_thailand.Controller.cs create mode 100644 Models/budget/project_request_thai.cs create mode 100644 wwwroot/reports/project_request_thailands.frx diff --git a/Controllers/project_request_thailand.Controller.cs b/Controllers/project_request_thailand.Controller.cs new file mode 100644 index 0000000..eae0335 --- /dev/null +++ b/Controllers/project_request_thailand.Controller.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.IO; +using ClosedXML.Excel; +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 Swashbuckle.AspNetCore.Annotations; + +namespace rmutr_report.Controllers +{ + [SwaggerTag("สำหรับรายงานคำขอโครงการ Thailand 4.0 (ง.5-2.2)")] + public class project_request_thailand: Controller + { + readonly Setting _setting; + + public project_request_thailand(Setting setting) + { + this._setting = setting; + } + [HttpPost, Route("reports/project_request_thailand/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetRequestProjectReport([FromRoute] string type, [FromBody] project_request_thai project) + { + + foreach (var v in project.five) + { + string na = "ประเด็นยุทธศาสตร์ที่ " ; + v.strategic_issues = na + v.strategic_issues; + string na2 = "กลยุทธ์ที่ " ; + v.measure = na2 + v.measure; + } + foreach (var v in project.eleventh) + { + foreach (var vv in v.elevenths) + { + string na = "ครั้งที่ "; + vv.the_time = na + vv.the_time; + // string na2 = " จำนวน "; + // // vv.count_day = na2 + vv.count_day + " วัน"; + // // if (project.count_day != null) + // // { + // // project.text3 = "จำนวน " + project.count_day + " วัน"; + // // } + } + } + + var _project = new List() {project}; + + Report report = new Report(); + report.Load(_setting.report_path + "project_request_thailands.frx"); + report.RegisterData(_project, "project_request_thai"); + 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(); + } + + } +} \ No newline at end of file diff --git a/Models/budget/project_request_thai.cs b/Models/budget/project_request_thai.cs new file mode 100644 index 0000000..097125c --- /dev/null +++ b/Models/budget/project_request_thai.cs @@ -0,0 +1,131 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class project_request_thai + { + public string project_name { get; set; } + public string faculty { get; set; } + public List activity { get; set; } + public string project_activitie { get; set; } //ข้อ 2 + public string principles_reasons { get; set; } //ข้อ 3 + public string objective { get; set; } //ข้อ 4 + public List five { get; set; } //ข้อ 5 + public string strategic_issues { get; set; } //ข้อ 6 + public string subject { get; set; } //ข้อ 6 + public string strategy { get; set; } //ข้อ 6 + public string consistency_ministry { get; set; } //ข้อ 7 + public string consistency_agency { get; set; } //ข้อ 8 + public List ninth { get; set; } //ข้อ 9 + public List tenth { get; set; } //ข้อ 10 + public List eleventh { get; set; } //ข้อ 11 + public string count_activity { get; set; } //ข้อ 12 + //public List twelfth { get; set; } //ข้อ 12 + public List twelfths { get; set; } //ข้อ 12 detail ตาราง + public List thirteenth { get; set; } //ข้อ 13 + //public List thirteenth1 { get; set; } //ข้อ 13 + public decimal? durable_articles { get; set; } //งบลงทุน + public decimal? land_building { get; set; } //งบลงทุน + public string url_file1 { get; set; } //งบลงทุน + public string url_file2 { get; set; } //งบลงทุน + public List fourteenth { get; set; }//ข้อ 14 + public decimal? budget_amount { get; set; } //ข้อ 15 + public List fifteen { get; set; } //ข้อ 15 + public List sixteen { get; set; } //ข้อ 16 + public List seventeenth{ get; set; } //ข้อ 17 + public List eighteenth { get; set; } //ข้อ 18 + public List nineteenth { get; set; } //ข้อ 19 + public List twentieth { get; set; } //ข้อ 20 + public string url_file3 { get; set; } //ข้อ 21 + } + + public class fourteenths_data_thai + { + public string list { get; set; } + + } + + public class fifteen_data + { + public string action_plan { get; set; } + public string month_1 { get; set; } + public string month_2 { get; set; } + public string month_3 { get; set; } + public string month_4 { get; set; } + public string month_5 { get; set; } + public string month_6 { get; set; } + public string month_7 { get; set; } + public string month_8 { get; set; } + public string month_9 { get; set; } + public string month_10 { get; set; } + public string month_11 { get; set; } + public string month_12 { get; set; } + } + + public class sixteen_data + { + public string text1 { get; set; } + public string text2 { get; set; } + public string text3 { get; set; } + public string text4 { get; set; } + public string text5 { get; set; } + public string text6 { get; set; } + public string text7 { get; set; } + public string text8 { get; set; } + // public string text9 { get; set; } + // public string text10 { get; set; } + public string bath { get; set; } + public string nuai_nap { get; set; } + public string khrang1 { get; set; } + public string khrang2 { get; set; } + public string khrang3 { get; set; } + public string rueang { get; set; } + public string activity { get; set; } + public string clause1 { get; set; } + public string count_quantitative { get; set; } + public string count_unit { get; set; } + public string count_project { get; set; } + public string count_training { get; set; } + public string count_knowledge { get; set; } + public string clause2 { get; set; } + public string project_start_date { get; set; } + public string project_end_date { get; set; } + public string percentage_finish { get; set; } + public string clause3 { get; set; } + public string percentage1 { get; set; } + public string percentage2 { get; set; } + public string target { get; set; } + public string results { get; set; } + public string clause4 { get; set; } + public decimal? expenses { get; set; } + } + + public class seventeenth_datas + { + public string type_project { get; set; } + } + + public class eighteenths_datas + { + public string target { get; set; } + public string positive { get; set; } + public string negative { get; set; } + } + + public class twentieths_datas + { + public string activity { get; set; } + public string activity_display_name { get; set; } + public string dates { get; set; } + public string location { get; set; } + public List twentieths_data_detail { get; set; } + } + + public class twentieths_datas_details + { + public string dates { get; set; } + public string times { get; set; } + public string detail { get; set; } + public string lecturer { get; set; } + } +} \ No newline at end of file diff --git a/Models/budget/teaching_fee_extra.cs b/Models/budget/teaching_fee_extra.cs index fc5c281..e54de6b 100644 --- a/Models/budget/teaching_fee_extra.cs +++ b/Models/budget/teaching_fee_extra.cs @@ -7,10 +7,10 @@ namespace rmutr_report.Models public string agency_name_th { get; set; } public string area { get; set; } public string product { get; set; } - public string term_1_year { get; set; } - public string term_2_year { get; set; } + public string term_1_year { get; set; } + public string term_2_year { get; set; } - public List data { get; set; } + public List data { get; set; } } public class teaching_fee_extra_detail diff --git a/wwwroot/reports/plant_genetic_conservation_project.frx b/wwwroot/reports/plant_genetic_conservation_project.frx index 5138fb2..f595ac9 100644 --- a/wwwroot/reports/plant_genetic_conservation_project.frx +++ b/wwwroot/reports/plant_genetic_conservation_project.frx @@ -1,5 +1,5 @@  - + @@ -273,8 +273,8 @@ - - + + @@ -347,13 +347,15 @@ - - - + + + + + - + - + @@ -364,11 +366,11 @@ - + - + - + @@ -378,12 +380,12 @@ - + - + - + @@ -399,7 +401,7 @@ - + @@ -489,15 +491,17 @@ - - + + + + - - + + - + @@ -512,7 +516,7 @@ - + @@ -550,7 +554,7 @@ - + @@ -567,7 +571,7 @@ - + @@ -582,7 +586,7 @@ - + @@ -619,7 +623,7 @@ - + @@ -636,7 +640,7 @@ - + @@ -651,7 +655,7 @@ - + @@ -673,7 +677,7 @@ - + @@ -690,7 +694,7 @@ - + @@ -705,7 +709,7 @@ - + @@ -727,7 +731,7 @@ - + @@ -744,7 +748,7 @@ - + @@ -759,7 +763,7 @@ - + @@ -776,7 +780,7 @@ - + @@ -797,20 +801,22 @@ - - - - - - - - - - + + + + + + + + + + + + - + @@ -818,10 +824,10 @@ - - - - + + + + @@ -854,7 +860,9 @@ - + + + @@ -887,10 +895,10 @@ - + - + @@ -913,17 +921,17 @@ - + - + - - - + + + @@ -931,7 +939,7 @@ - + @@ -939,7 +947,9 @@ - + + + @@ -952,7 +962,7 @@ - + @@ -970,7 +980,7 @@ - + @@ -985,14 +995,16 @@ - - - + + + + + - + @@ -1005,7 +1017,7 @@ - + @@ -1022,7 +1034,7 @@ - + diff --git a/wwwroot/reports/project_request_thailands.frx b/wwwroot/reports/project_request_thailands.frx new file mode 100644 index 0000000..a89370c --- /dev/null +++ b/wwwroot/reports/project_request_thailands.frx @@ -0,0 +1,1022 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +