diff --git a/Controllers/PlantGeneticConservationProject.Controller.cs b/Controllers/PlantGeneticConservationProject.Controller.cs index 2a23df3..07ba98b 100644 --- a/Controllers/PlantGeneticConservationProject.Controller.cs +++ b/Controllers/PlantGeneticConservationProject.Controller.cs @@ -14,17 +14,19 @@ using Swashbuckle.AspNetCore.Annotations; namespace rmutr_report.Controllers { [SwaggerTag("สำหรับรายงานคำขอโครงการพันธุกรรมพืช ง.5-2.1")] - public class plant_genetic_conservation_project: Controller + public class plant_genetic_conservation_project : Controller { - readonly Setting _setting; + readonly Setting _setting; public plant_genetic_conservation_project(Setting setting) { this._setting = setting; } - [HttpPost, Route("reports/plant_genetic_conservation_project/{type}")] + + [HttpPost, Route("reports/plant_genetic_conservation_project/{type}")] [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetConservationProjectReport([FromRoute] string type, [FromBody] project_principle_rationale project) + public IActionResult GetConservationProjectReport([FromRoute] string type, + [FromBody] project_principle_rationale project) { if (project != null) { @@ -44,7 +46,7 @@ namespace rmutr_report.Controllers // } // } // } - if (project.ninth!=null) + if (project.ninth != null) { foreach (var vv in project.ninth) { @@ -52,10 +54,29 @@ namespace rmutr_report.Controllers { vv.clause = "12.1 ตัวชี้วัดผลสัมฤทธิ์"; } + if (vv.clause == "9.2 ตัวชี้วัดเชิงนโยบาย") { vv.clause = "12.2 ตัวชี้วัดเชิงนโยบาย"; } + + if (vv.ninths.Any()) + { + if (vv.ninths == null) + { + foreach (var detail6 in vv.ninths) + { + detail6.detail = null; + } + } + } + else + { + vv.ninths.Add(new ninth_data_detail() + { + detail = "" + }); + } } } @@ -74,6 +95,42 @@ namespace rmutr_report.Controllers } } + if (project.seventeenth != null) + { + foreach (var v in project.seventeenth) + { + int t = 1; + string a = "กิจกรรมที่ "; + v.activity = a + v.activity; + foreach (var vv in v.seventeenths) + { + string na = "ครั้งที่ "; + vv.the_time = na + t; + t++; + foreach (var detail in vv.seventeenths2) + { + string in1 = "พื้นที่ (ภายในมหาวิทยาลัย) "; + string in2 = "ระบุสถานที่ "; + string out1 = "จังหวัด (ภายนอกมหาวิทยาลัย) "; + + if (detail.internal_external1 == "ภายในมหาวิทยาลัย") + { + detail.text1 = "ภายในมหาวิทยาลัย"; + detail.area_province1 = in1 + detail.area_province1; + detail.location1 = in2 + detail.location1; + } + + if (detail.internal_external2 == "ภายนอกมหาวิทยาลัย") + { + detail.text2 = "ภายนอกมหาวิทยาลัย"; + detail.area_province2 = out1 + detail.area_province2; + detail.location2 = in2 + detail.location2; + } + } + } + } + } + if (project.eighteenth != null) { foreach (var v in project.eighteenth) @@ -134,7 +191,6 @@ namespace rmutr_report.Controllers // } if (vv.count_quantitative != null) { - string na = " หน่วยนับ"; vv.khrang1 = na; } @@ -206,7 +262,8 @@ namespace rmutr_report.Controllers } } } - var _project = new List() {project}; + + var _project = new List() { project }; Report report = new Report(); report.Load(_setting.report_path + "plant_genetic_conservation_project.frx"); @@ -241,7 +298,8 @@ namespace rmutr_report.Controllers stream.Seek(0, SeekOrigin.Begin); return File(stream, "text/csv"); break; - case "doc": case "docx": + case "doc": + case "docx": Word2007Export word = new Word2007Export(); report.Export(word, stream); stream.Seek(0, SeekOrigin.Begin); @@ -251,6 +309,5 @@ namespace rmutr_report.Controllers return Ok(); } - } } \ No newline at end of file diff --git a/Controllers/project_principle_rationale.Controller.cs b/Controllers/project_principle_rationale.Controller.cs index 5536481..33ad913 100644 --- a/Controllers/project_principle_rationale.Controller.cs +++ b/Controllers/project_principle_rationale.Controller.cs @@ -29,27 +29,29 @@ namespace rmutr_report.Controllers { if (project != null) { - // var total = project.activity.Count; - // if (project.activity != null) - // { - // foreach (var v in project.activity) - // { - // if (v.activity != null) - // { - // //var total = project.activity.Select(r => r.count).Sum(t => t.Value); - // project.together_with = "ประกอบด้วยกิจกรรมหรือโครงการย่อย " + total + " โครงการดังนี้คือ"; - // } - // else - // { - // project.together_with = null; - // } - // } - // } - - - - - + if (project.ninth != null) + { + foreach (var vv in project.ninth) + { + if (vv.ninths.Any()) + { + if (vv.ninths == null) + { + foreach (var detail6 in vv.ninths) + { + detail6.detail = null; + } + } + } + else + { + vv.ninths.Add(new ninth_data_detail() + { + detail = "" + }); + } + } + } if (project.sixteenths != null) { @@ -66,6 +68,42 @@ namespace rmutr_report.Controllers } } + if (project.seventeenth != null) + { + foreach (var v in project.seventeenth) + { + int t = 1; + string a = "กิจกรรมที่ "; + v.activity = a + v.activity; + foreach (var vv in v.seventeenths) + { + string na = "ครั้งที่ "; + vv.the_time = na + t; + t++; + foreach (var detail in vv.seventeenths2) + { + string in1 = "พื้นที่ (ภายในมหาวิทยาลัย) "; + string in2 = "ระบุสถานที่ "; + string out1 = "จังหวัด (ภายนอกมหาวิทยาลัย) "; + + if (detail.internal_external1 == "ภายในมหาวิทยาลัย") + { + detail.text1 = "ภายในมหาวิทยาลัย"; + detail.area_province1 = in1 + detail.area_province1; + detail.location1 = in2 + detail.location1; + } + + if (detail.internal_external2 == "ภายนอกมหาวิทยาลัย") + { + detail.text2 = "ภายนอกมหาวิทยาลัย"; + detail.area_province2 = out1 + detail.area_province2; + detail.location2 = in2 + detail.location2; + } + } + } + } + } + if (project.eighteenth != null) { foreach (var v in project.eighteenth) @@ -124,13 +162,13 @@ namespace rmutr_report.Controllers // { // vv.clause4 = vv.clause4; // } - if (vv.count_quantitative != null ) + if (vv.count_quantitative != null) { - string na = " หน่วยนับ"; vv.khrang1 = na; } - if (vv.count_unit != null ) + + if (vv.count_unit != null) { string na = "ผู้เข้าร่วมโครงการ "; string na1 = " จำนวน "; @@ -140,17 +178,17 @@ namespace rmutr_report.Controllers vv.nuai_nap = na2; } - if (vv.count_project != null ) + if (vv.count_project != null) { vv.clause1 = "21.1 เชิงปริมาณ"; string na = "จำนวนครั้งที่ดำเนินโครงการ "; string na2 = " ครั้ง"; - vv.text2 = na ; - vv.khrang2 = na2 ; + vv.text2 = na; + vv.khrang2 = na2; vv.text12 = "หน่วยนับ"; } - if (vv.count_training != null ) + if (vv.count_training != null) { string na = "จำนวนการจัดอบรมและสัมมนา "; string na2 = " เรื่อง"; @@ -166,18 +204,18 @@ namespace rmutr_report.Controllers vv.khrang3 = na2; } - if (vv.project_start_date!=null ) + if (vv.project_start_date != null) { vv.clause2 = "21.2 เชิงเวลา"; string na3 = "วัน/เดือน/ปี ที่จะดำเนินโครงการ "; string na4 = " ถึง "; - vv.range = na4 ; - vv.text5 = na3 ; + vv.range = na4; + vv.text5 = na3; string na5 = "โครงการแล้วเสร็จตามเวลาที่กำหนด (ร้อยละ) "; - vv.text6 = na5 ; + vv.text6 = na5; } - - if (vv.percentage1!=null || vv.percentage2!=null) + + if (vv.percentage1 != null || vv.percentage2 != null) { vv.clause3 = "21.3 เชิงคุณภาพ"; string na = "ผู้เข้าร่วมโครงการมีความรู้ความเข้าใจเพิ่มขึ้น (ร้อยละ) "; @@ -185,18 +223,17 @@ namespace rmutr_report.Controllers vv.text7 = na; vv.text8 = na1; vv.text9 = "ผู้เข้าร่วมโครงการสามารถนำความรู้ที่ได้รับไปบูรณาการอย่างไรบ้าง"; - //vv.text10 = "รายละเอียด"; + vv.text10 = "รายละเอียด"; } - if (vv.expenses!=null) + + if (vv.expenses != null) { vv.clause4 = "21.4 เชิงค่าใช้จ่าย"; vv.bath = " บาท"; } } } - - - } + } if (project.twenty_four != null) { diff --git a/Controllers/project_request_thailand.Controller.cs b/Controllers/project_request_thailand.Controller.cs index 9a13605..9ef128e 100644 --- a/Controllers/project_request_thailand.Controller.cs +++ b/Controllers/project_request_thailand.Controller.cs @@ -14,9 +14,9 @@ using Swashbuckle.AspNetCore.Annotations; namespace rmutr_report.Controllers { [SwaggerTag("สำหรับรายงานคำขอโครงการ Thailand 4.0 (ง.5-2.2)")] - public class project_request_thailand: Controller + public class project_request_thailand : Controller { - readonly Setting _setting; + readonly Setting _setting; public project_request_thailand(Setting setting) { @@ -28,7 +28,6 @@ namespace rmutr_report.Controllers public IActionResult GetRequestProjectReport([FromRoute] string type, [FromBody] project_principle_rationale project) { - // foreach (var v in project.five) // { // string na = "ประเด็นยุทธศาสตร์ที่ " ; @@ -47,7 +46,7 @@ namespace rmutr_report.Controllers // } if (project != null) { - // var total = project.activity.Count; + // var total = project.activity.Count; // if (project.activity != null) // { // foreach (var v in project.activity) @@ -64,7 +63,7 @@ namespace rmutr_report.Controllers // } // } - if (project.ninth!=null) + if (project.ninth != null) { foreach (var vv in project.ninth) { @@ -72,25 +71,32 @@ namespace rmutr_report.Controllers { vv.clause = "11.1 ตัวชี้วัดผลสัมฤทธิ์"; } + if (vv.clause == "9.2 ตัวชี้วัดเชิงนโยบาย") { vv.clause = "11.2 ตัวชี้วัดเชิงนโยบาย"; } - if (vv.ninths==null) - { - vv.ninths.Add(new ninth_data_detail() - { - detail = "" - }); - - } - + if (vv.ninths.Any()) + { + if (vv.ninths == null) + { + foreach (var detail6 in vv.ninths) + { + detail6.detail = null; + } + } + } + else + { + vv.ninths.Add(new ninth_data_detail() + { + detail = "" + }); + } } } - - if (project.sixteenths != null) { @@ -106,16 +112,19 @@ namespace rmutr_report.Controllers sixteenthData.klai_kangwon_total = sum4; } } + if (project.seventeenth != null) { foreach (var v in project.seventeenth) { + int t = 1; string a = "กิจกรรมที่ "; v.activity = a + v.activity; foreach (var vv in v.seventeenths) { string na = "ครั้งที่ "; - vv.the_time = na + vv.the_time; + vv.the_time = na + t; + t++; foreach (var detail in vv.seventeenths2) { string in1 = "พื้นที่ (ภายในมหาวิทยาลัย) "; @@ -128,9 +137,10 @@ namespace rmutr_report.Controllers detail.area_province1 = in1 + detail.area_province1; detail.location1 = in2 + detail.location1; } + if (detail.internal_external2 == "ภายนอกมหาวิทยาลัย") { - detail.text2 = "ภายนอกมหาวิทยาลัย"; + detail.text2 = "ภายนอกมหาวิทยาลัย"; detail.area_province2 = out1 + detail.area_province2; detail.location2 = in2 + detail.location2; } @@ -138,6 +148,7 @@ namespace rmutr_report.Controllers } } } + if (project.eighteenth != null) { foreach (var v in project.eighteenth) @@ -179,7 +190,6 @@ namespace rmutr_report.Controllers { if (vv.count_quantitative != null) { - string na = " หน่วยนับ"; vv.khrang1 = na; } @@ -253,47 +263,44 @@ namespace rmutr_report.Controllers } - - var _project = new List() { project }; - Report report = new Report(); - report.Load(_setting.report_path + "project_request_thailands.frx"); - report.RegisterData(_project, "project_principle_rationale"); - report.Prepare(); + Report report = new Report(); + report.Load(_setting.report_path + "project_request_thailands.frx"); + report.RegisterData(_project, "project_principle_rationale"); + 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": - Excel2007Export excel = new Excel2007Export(); - report.Export(excel, stream); - stream.Seek(0, SeekOrigin.Begin); - return File(stream, "application/vnd.ms-excel"); - break; - case "xlsx": - Excel2007Export excel1 = new Excel2007Export(); - report.Export(excel1, stream); - stream.Seek(0, SeekOrigin.Begin); - return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - break; - case "doc": - case "docx": - Word2007Export word = new Word2007Export(); - report.Export(word, stream); - stream.Seek(0, SeekOrigin.Begin); - return File(stream, "appllication/vnd.ms-word"); - break; - } - - return Ok(); + 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": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.ms-excel"); + break; + case "xlsx": + Excel2007Export excel1 = new Excel2007Export(); + report.Export(excel1, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + break; + case "doc": + case "docx": + Word2007Export word = new Word2007Export(); + report.Export(word, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "appllication/vnd.ms-word"); + break; } + return Ok(); } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/Models/budget/project_principle_rationale.cs b/Models/budget/project_principle_rationale.cs index f56bd7d..7f7d615 100644 --- a/Models/budget/project_principle_rationale.cs +++ b/Models/budget/project_principle_rationale.cs @@ -436,6 +436,8 @@ namespace rmutr_report.Models public string percentage1 { get; set; } public string percentage2 { get; set; } public string acquired_knowledge { get; set; } + public string detail { get; set; } + //public string detail2 { get; set; } public string clause4 { get; set; } public decimal? expenses { get; set; } diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index 9e18704..944c439 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.dll and b/bin/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.pdb b/bin/Debug/netcoreapp3.1/rmutr_report.pdb index 87e75a6..b4ec2f5 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.pdb and b/bin/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 9e18704..944c439 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.dll and b/obj/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.pdb b/obj/Debug/netcoreapp3.1/rmutr_report.pdb index 87e75a6..b4ec2f5 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/obj/rider.project.restore.info b/obj/rider.project.restore.info index 0c5c185..25aad06 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -17001217270031729 \ No newline at end of file +17001321833144528 \ No newline at end of file diff --git a/wwwroot/reports/plant_genetic_conservation_project.frx b/wwwroot/reports/plant_genetic_conservation_project.frx index 03a2669..b71c533 100644 --- a/wwwroot/reports/plant_genetic_conservation_project.frx +++ b/wwwroot/reports/plant_genetic_conservation_project.frx @@ -1,5 +1,5 @@  - + @@ -81,6 +81,7 @@ + @@ -98,10 +99,10 @@ - + - + @@ -462,12 +463,12 @@ - - - - - - + + + + + + @@ -487,9 +488,9 @@ - - - + + + @@ -503,8 +504,10 @@ - - + + + + @@ -519,7 +522,7 @@ - + @@ -542,14 +545,14 @@ - + - - + + @@ -567,7 +570,7 @@ - + @@ -637,7 +640,7 @@ - + @@ -698,7 +701,7 @@ - + @@ -727,19 +730,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -752,7 +755,7 @@ - + @@ -781,7 +784,7 @@ - + @@ -789,11 +792,11 @@ - - - - - + + + + + @@ -806,7 +809,7 @@ - + @@ -835,19 +838,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -868,7 +871,7 @@ - + @@ -946,7 +949,7 @@ - + @@ -982,19 +985,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1005,7 +1008,7 @@ - + @@ -1024,23 +1027,24 @@ - - + + - + + - + - + - + diff --git a/wwwroot/reports/project_principle_rationale_1.frx b/wwwroot/reports/project_principle_rationale_1.frx index 18a4482..88c1abb 100644 --- a/wwwroot/reports/project_principle_rationale_1.frx +++ b/wwwroot/reports/project_principle_rationale_1.frx @@ -1,5 +1,5 @@  - + @@ -199,8 +199,7 @@ - - + @@ -236,6 +235,7 @@ + @@ -344,8 +344,8 @@ - - + + @@ -492,10 +492,10 @@ - + - - + + @@ -512,13 +512,13 @@ - - - + + + - + - + @@ -528,7 +528,7 @@ - + @@ -536,13 +536,13 @@ - - - + + + - + @@ -557,14 +557,14 @@ - + - + - + @@ -574,7 +574,7 @@ - + @@ -588,7 +588,7 @@ - + @@ -605,9 +605,9 @@ - - - + + + @@ -615,7 +615,7 @@ - + @@ -623,32 +623,32 @@ - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + @@ -656,7 +656,7 @@ - + @@ -664,13 +664,13 @@ - - - + + + - + @@ -678,18 +678,18 @@ - - - - - + + + + + - - - + + + @@ -697,7 +697,7 @@ - + @@ -711,53 +711,53 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - + - + - - - + + + - + - + - + - - - - + + + + @@ -840,42 +840,36 @@ - + - - + - - - - - - - + + + + + + + - - - - - - - + - + + - + - + @@ -884,9 +878,9 @@ - + - + @@ -895,11 +889,11 @@ - + - + - + @@ -949,14 +943,12 @@ - - + - diff --git a/wwwroot/reports/project_request_thailands.frx b/wwwroot/reports/project_request_thailands.frx index da33310..8206562 100644 --- a/wwwroot/reports/project_request_thailands.frx +++ b/wwwroot/reports/project_request_thailands.frx @@ -1,5 +1,5 @@  - + @@ -535,13 +535,13 @@ - + - + @@ -560,7 +560,7 @@ - + @@ -630,7 +630,7 @@ - + @@ -691,7 +691,7 @@ - + @@ -720,19 +720,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -745,7 +745,7 @@ - + @@ -774,7 +774,7 @@ - + @@ -782,11 +782,11 @@ - - - - - + + + + + @@ -799,7 +799,7 @@ - + @@ -828,19 +828,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -861,7 +861,7 @@ - + @@ -940,8 +940,8 @@ - - + + @@ -975,19 +975,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + +