diff --git a/Controllers/ProjectPerformanceReport.Controller.cs b/Controllers/ProjectPerformanceReport.Controller.cs new file mode 100644 index 0000000..066134c --- /dev/null +++ b/Controllers/ProjectPerformanceReport.Controller.cs @@ -0,0 +1,127 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using FastReport; +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("แบบรายงานผลการดำเนินงานโครงการ")] + public class projectPerformanceForm : Controller + { + readonly Setting _setting; + + public projectPerformanceForm(Setting setting) + { + _setting = setting; + } + + [HttpPost, Route("reports/project_performance_report_form/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetProjectPerformanceReport([FromRoute] string type, + [FromBody] project_performance_report_form reportForm) + { + if (reportForm.national_budget_money==true) + { + reportForm.check_box1 = "/"; + } + if (reportForm.income_budget==true) + { + reportForm.check_box2 = "/"; + } + if (reportForm.other==true) + { + reportForm.check_box3 = "/"; + } + if (reportForm.digital_innovation==true) + { + reportForm.check_box4 = "/"; + } + if (reportForm.moral==true) + { + reportForm.check_box5 = "/"; + } + if (reportForm.open_mind==true) + { + reportForm.check_box6 = "/"; + } + if (reportForm.value==true) + { + reportForm.check_box7 = "/"; + } + if (reportForm.entrepreneurship==true) + { + reportForm.check_box8 = "/"; + } + if (reportForm.unity==true) + { + reportForm.check_box9 = "/"; + } + if (reportForm.porfessional==true) + { + reportForm.check_box10 = "/"; + } + if (reportForm.check_twenty_four==true) + { + reportForm.check_twenty_four1 = "/"; + } + if (reportForm.check_twenty_four==false) + { + reportForm.check_twenty_four2 = "/"; + } + if (reportForm.project_style!=null) + { + foreach (var projects in reportForm.project_style) + { + if (projects.check == true) + { + projects.checkbox = "/"; + } + if (projects.check == false) + { + projects.checkbox = null; + } + } + } + if (reportForm.twenty_four_table!=null) + { + var sum1 = reportForm.twenty_four_table.Sum(g => g.amount_1); + var sum2 = reportForm.twenty_four_table.Sum(g => g.amount_2); + reportForm.total_amount_1 = sum1; + reportForm.total_amount_2 = sum2; + } + var projectPerformance = new List() { reportForm }; + + Report report = new Report(); + report.Load(_setting.report_path + "project_performance_report_form.frx"); + report.RegisterData(projectPerformance, "project_performance_report_form"); + 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.openxmlformats-officedocument.spreadsheetml.sheet", + "project_performance_report_form" + ".xlsx"); + } + + return Ok(); + } + } +} \ No newline at end of file diff --git a/Models/budget/project_performance_report_form.cs b/Models/budget/project_performance_report_form.cs new file mode 100644 index 0000000..9107c36 --- /dev/null +++ b/Models/budget/project_performance_report_form.cs @@ -0,0 +1,156 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class project_performance_report_form + { + public string budget_year { get; set; } + public string project_name { get; set; } + public string responsible_person { get; set; } + public string faculty { get; set; } + public string start_date { get; set; } + public string end_date { get; set; } + public string project_location { get; set; } + public List project_style{ get; set; } //ข้อ 6 + + public string strategic_issues { get; set; }//ข้อ 7 + public List project_objective{ get; set; } //ข้อ 8 + public List operations_activitie { get; set; }//ข้อ 9 + public bool? national_budget_money { get; set; }//ข้อ 10 + public bool? income_budget { get; set; }//ข้อ 10 + public bool? other { get; set; }//ข้อ 10 + public string check_box1 { get; set; }//ข้อ 10 + public string check_box2 { get; set; }//ข้อ 10 + public string check_box3 { get; set; }//ข้อ 10 + public string other_remark { get; set; }//ข้อ 10 + public string product { get; set; }//ข้อ 10 + public decimal? amount { get; set; }//ข้อ 10 + public decimal? approval { get; set; }//ข้อ 10 + public decimal? really_pay { get; set; }//ข้อ 10 + public List overall_operating_result { get; set; }//ข้อ 11.1 + public List qualitative { get; set; }//ข้อ 11.2 + public List time { get; set; }//ข้อ 11.3 + public List indicators_project_objective { get; set; }//ข้อ 11.4 + public bool? digital_innovation { get; set; }//ข้อ 12 + public bool? moral { get; set; }//ข้อ 12 + public bool? open_mind { get; set; }//ข้อ 12 + public bool? value { get; set; }//ข้อ 12 + public bool? entrepreneurship { get; set; }//ข้อ 12 + public bool? unity { get; set; }//ข้อ 12 + public bool? porfessional { get; set; }//ข้อ 12 + public string check_box4 { get; set; }//ข้อ 12 + public string check_box5 { get; set; }//ข้อ 12 + public string check_box6 { get; set; }//ข้อ 12 + public string check_box7 { get; set; }//ข้อ 12 + public string check_box8 { get; set; }//ข้อ 12 + public string check_box9 { get; set; }//ข้อ 12 + public string check_box10 { get; set; }//ข้อ 12 + public string developed { get; set; }//ข้อ 12 + public string explain { get; set; }//ข้อ 13 + public string explain_SDG { get; set; }//ข้อ 14 + public string value_analysis { get; set; }//ข้อ 15 + public string output { get; set; }//ข้อ 16 + public string outcome { get; set; }//ข้อ 17 + public string effect { get; set; } //ข้อ 18 + public string obstacle { get; set; } //ข้อ 19 + public string suggestions { get; set; } //ข้อ 20 + public string expected_results_inside { get; set; } //ข้อ 21 + public string expected_results_outside { get; set; } //ข้อ 21 + public string next_action_plan { get; set; } //ข้อ 22 + public string results_continuous_development { get; set; } //ข้อ 23 + public bool? check_twenty_four { get; set; }//ข้อ 24 + public string check_twenty_four1 { get; set; }//ข้อ 24 + public string check_twenty_four2 { get; set; }//ข้อ 24 + public List twenty_four_table { get; set; }//ข้อ 24 + public decimal? total_amount_1 { get; set; } + public decimal? total_amount_2 { get; set; } + } + + public class project_styles + { + public bool? check { get; set; }//ข้อ 6 + public string checkbox { get; set; }//ข้อ 6 + public string project_style { get; set; } + + } + + public class project_objectives + { + public string row { get; set; } + public string project_objective { get; set; }//ข้อ 8 + + } + + public class operations_activities + { + public string row { get; set; } + public string operations_activitie { get; set; }//ข้อ 9 + } + + public class overall_operating_results + { + + public decimal? quantity { get; set; } + public decimal? participants_quantity { get; set; } + public decimal? participants_university { get; set; } + public decimal? board { get; set; } + public decimal? lecturer { get; set; } + public decimal? participants { get; set; } + public decimal? executive_1 { get; set; } + public decimal? teacher_1 { get; set; } + public decimal? student_1 { get; set; } + public decimal? support_personnel_1 { get; set; } + public decimal? government_officer { get; set; } + public decimal? university_staff { get; set; } + public decimal? government_employee { get; set; } + public decimal? temporary_employee { get; set; } + public decimal? external_participants { get; set; } + public decimal? external_lecturer { get; set; } + public decimal? external_participants2 { get; set; } + public decimal? executive_2 { get; set; } + public decimal? teacher_2 { get; set; } + public decimal? student_2 { get; set; } + public decimal? personnel_2 { get; set; } + public decimal? activity { get; set; } + + + } + + public class qualitatives + { + public string topic { get; set; } + public List data { get; set; } + } + + public class data_lists + { + public string list { get; set; } + public decimal? percentage { get; set; } + } + + public class times + { + public decimal? percentage { get; set; } + + } + + public class indicators_project_objectives + { + public string kpi { get; set; } + public decimal? target_value_plan { get; set; } + public decimal? target_value_result { get; set; } + public string remark { get; set; } + } + + public class twenty_four_tables + { + public int? topic_type { get; set; } + public string topic { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + } + + + + +} \ No newline at end of file diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index e8babcb..8050259 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index 1414f45..824ebfc 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index ee103ed..f7dda84 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 2bbb061..131c030 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/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index 691802b..6b17bdf 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index 691802b..6b17bdf 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache b/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache index 8c7b669..82ae9c5 100644 --- a/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -f29f532d408de6504926f35348a4e885e76ac54a +34f6847c55c258dd2ba577a21dc408fdad799519 diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index e8babcb..8050259 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index 1414f45..824ebfc 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache index 97d58cb..ea7b135 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -08426863366ac1cc0305f074194bd81e401f7c35 +19cbe7ca27a40701bf27c16c63d4cc2288aaa77f diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index ee103ed..f7dda84 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 2bbb061..131c030 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 5ad292e..494d60b 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -16939829599595269 \ No newline at end of file +16952815406574131 \ No newline at end of file diff --git a/wwwroot/reports/project_performance_report_form.frx b/wwwroot/reports/project_performance_report_form.frx new file mode 100644 index 0000000..fd3b2a9 --- /dev/null +++ b/wwwroot/reports/project_performance_report_form.frx @@ -0,0 +1,611 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +