diff --git a/Controllers/Summary.Controller.cs b/Controllers/Summary.Controller.cs index 80c0189..2a1f7e1 100644 --- a/Controllers/Summary.Controller.cs +++ b/Controllers/Summary.Controller.cs @@ -12,6 +12,7 @@ using FastReport.Export.Pdf; using Microsoft.AspNetCore.Mvc; using rmutr_report.Models; using rmutr_report.Models.Hr; +using rmutr_report.Models.Personnel; using Swashbuckle.AspNetCore.Annotations; namespace rmutr_report.Controllers @@ -1627,6 +1628,93 @@ namespace rmutr_report.Controllers "investment_budget_summary" + ".xlsx"); } + return Ok(); + } + [SwaggerOperation("สรุป MTEF")] + [HttpPost, Route("reports/summary_mtef/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetMtefSumReport([FromRoute] string type, + [FromBody] summary_mtef mtef) + { + var sum1 = mtef.data.Sum(f => f.budget_1); + var sum2 = mtef.data.Sum(f => f.budget_2); + var sum3 = mtef.data.Sum(f => f.budget_3); + var sum4 = mtef.data.Sum(f => f.budget_4); + var sum5 = mtef.data.Sum(f => f.budget_5); + var sum6 = mtef.data.Sum(f => f.budget_6); + var sum7 = mtef.data.Sum(f => f.budget_7); + var sum8 = mtef.data.Sum(f => f.budget_8); + var sum9 = mtef.data.Sum(f => f.budget_9); + mtef.budget_1 = sum1; + mtef.budget_2 = sum2; + mtef.budget_3 = sum3; + mtef.budget_4 = sum4; + mtef.budget_5 = sum5; + mtef.budget_6 = sum6; + mtef.budget_7 = sum7; + mtef.budget_8 = sum8; + mtef.budget_9 = sum9; + var mtefs = new List() { mtef }; + Report report = new Report(); + report.Load(_setting.report_path + "summary_mtef.frx"); + report.RegisterData(mtefs, "summary_mtef"); + 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", + "summary_mtef" + ".xlsx"); + } + + return Ok(); + } + [SwaggerOperation("MTEF แผนงาน ผลผลิต")] + [HttpPost, Route("reports/mtef_plan/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetMtefPlanReport([FromRoute] string type, + [FromBody] mtef_plan mtef) + { + + var mtefs = new List() { mtef }; + Report report = new Report(); + report.Load(_setting.report_path + "mtef_plan.frx"); + report.RegisterData(mtefs, "mtef_plan"); + 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", + "mtef_plan" + ".xlsx"); + } + return Ok(); } } diff --git a/Models/Personnel/summary_mtef.cs b/Models/Personnel/summary_mtef.cs new file mode 100644 index 0000000..736ad56 --- /dev/null +++ b/Models/Personnel/summary_mtef.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.Personnel +{ + public class summary_mtef + { + public string budget_year { get; set; } + public string year1 { get; set; } + public string year2 { get; set; } + public string year3 { get; set; } + public string year4 { get; set; } + public string year5 { get; set; } + public string year6 { get; set; } + public string year7 { get; set; } + public string year8 { get; set; } + public Listdata { get; set; } + public decimal? budget_1 { get; set; } + public decimal? budget_2 { get; set; } + public decimal? budget_3 { get; set; } + public decimal? budget_4 { get; set; } + public decimal? budget_5 { get; set; } + public decimal? budget_6 { get; set; } + public decimal? budget_7 { get; set; } + public decimal? budget_8 { get; set; } + public decimal? budget_9 { get; set; } + } + public class summary_mtef_detail { + + public string list { get; set; } + public decimal? budget_1 { get; set; } + public decimal? budget_2 { get; set; } + public decimal? budget_3 { get; set; } + public decimal? budget_4 { get; set; } + public decimal? budget_5 { get; set; } + public decimal? budget_6 { get; set; } + public decimal? budget_7 { get; set; } + public decimal? budget_8 { get; set; } + public decimal? budget_9 { get; set; } + } + + public class mtef_plan + { + public string budget_project_name_th { get; set; } + public string year1 { get; set; } + public string year2 { get; set; } + public string year3 { get; set; } + public string year4 { get; set; } + public string year5 { get; set; } + public string year6 { get; set; } + public string year7 { get; set; } + public string year8 { get; set; } + public Listdata { get; set; } + public decimal? budget_1 { get; set; } + public decimal? budget_2 { get; set; } + public decimal? budget_3 { get; set; } + public decimal? budget_4 { get; set; } + public decimal? budget_5 { get; set; } + public decimal? budget_6 { get; set; } + public decimal? budget_7 { get; set; } + public decimal? budget_8 { get; set; } + public decimal? budget_9 { get; set; } + } + + public class mtef_plan_detail + { + public int? topic_type { get; set; } + public string list { get; set; } + public decimal? budget_1 { get; set; } + public decimal? budget_2 { get; set; } + public decimal? budget_3 { get; set; } + public decimal? budget_4 { get; set; } + public decimal? budget_5 { get; set; } + public decimal? budget_6 { get; set; } + public decimal? budget_7 { get; set; } + public decimal? budget_8 { get; set; } + public decimal? budget_9 { 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 3bcdf81..e6af801 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 a2dca01..eee2827 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 2849bbe..ef82cf0 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 75b945f..644472d 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 2b3ed1a..fe68a1a 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 2b3ed1a..fe68a1a 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 3d7201c..3476fdc 100644 --- a/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -99ef312a48329e42fc9ff666e8db622340dcdeb7 +6782220b5753377ab086a66662743b009c9fc879 diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 3bcdf81..e6af801 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 a2dca01..eee2827 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 37aa4be..9d245f8 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -51192c87ebcc0d859fc33a38799a58739bd69342 +497911b108703c18cc136c48e11db02dfbbd4c5b diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 2849bbe..ef82cf0 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 75b945f..644472d 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 6e28b58..78d59ae 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -16921620219163155 \ No newline at end of file +16921693241770036 \ No newline at end of file diff --git a/wwwroot/reports/mtef_plan.frx b/wwwroot/reports/mtef_plan.frx new file mode 100644 index 0000000..868951f --- /dev/null +++ b/wwwroot/reports/mtef_plan.frx @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/summary_mtef.frx b/wwwroot/reports/summary_mtef.frx new file mode 100644 index 0000000..4f204f1 --- /dev/null +++ b/wwwroot/reports/summary_mtef.frx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +