diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index c27df88..7593eef 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -242,7 +242,58 @@ namespace rmutr_report.Controllers return Ok(); } + [HttpPost, Route("reports/summary_project_budget_proposals/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetSumPReport([FromRoute] string type, [FromBody] summary_project_budget_proposals eleven) + { + int a = 1; + foreach (var d1 in eleven.data_1) + { + foreach (var d2 in d1.data_2) + { + foreach (var d3 in d2.data_3) + { + foreach (var d4 in d3.data_4) + { + d4.row_no = a; + a++; + } + } + } + } + var ele = new List() { eleven }; + + Report report = new Report(); + report.Load(_setting.report_path + "summary_project_budget_proposals.frx"); + report.RegisterData(ele, "summary_project_budget_proposals"); + 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"); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + stream, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + date + ".xlsx"); + break; + + } + + return Ok(); + } } } \ No newline at end of file diff --git a/Controllers/RoFive.Controller.cs b/Controllers/RoFive.Controller.cs index af78bb7..109ea74 100644 --- a/Controllers/RoFive.Controller.cs +++ b/Controllers/RoFive.Controller.cs @@ -479,11 +479,17 @@ namespace rmutr_report.Controllers stream.Seek(0, SeekOrigin.Begin); return File(stream, "application/pdf"); - case "xls":case "xlsx": + case "xls": + case "xlsx": Excel2007Export excel = new Excel2007Export(); report.Export(excel, stream); stream.Seek(0, SeekOrigin.Begin); - return File(stream, "application/vnd.ms-excel"); + //return File(stream, "application/vnd.ms-excel"); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + stream, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + date + ".xlsx"); break; } @@ -523,11 +529,17 @@ namespace rmutr_report.Controllers stream.Seek(0, SeekOrigin.Begin); return File(stream, "application/pdf"); - case "xls":case "xlsx": + case "xls": + case "xlsx": Excel2007Export excel = new Excel2007Export(); report.Export(excel, stream); stream.Seek(0, SeekOrigin.Begin); - return File(stream, "application/vnd.ms-excel"); + //return File(stream, "application/vnd.ms-excel"); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + stream, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + date + ".xlsx"); break; } diff --git a/Models/budget/summary_project_budget_proposals.cs b/Models/budget/summary_project_budget_proposals.cs new file mode 100644 index 0000000..93e836a --- /dev/null +++ b/Models/budget/summary_project_budget_proposals.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class summary_project_budget_proposals + { public string budget_year { get; set; } + public string faculty_name_th { get; set; } + public string allocate_year { get; set; } + public string request_year { get; set; } + public List data_1 { get; set; } + } + public class summary_project_budget_proposals1{ + //public int? color { get; set; } + public string list { get; set; } + public string project_objectives { get; set; } + public string target_group { get; set; } + public string kpi { get; set; } + public string target_sdg { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_amount { get; set; } + public string period { get; set; } + public decimal? project_amount { get; set; } + public string target_unit { get; set; } + public decimal? target_unit_amount { get; set; } + public string unit { get; set; } + public decimal? unit_amount { get; set; } + public decimal? allocate_amount { get; set; } + public decimal? request_amount { get; set; } + public decimal? online { get; set; } + public decimal? onsite { get; set; } + public string budget_source { get; set; } + public string remark { get; set; } + public List data_2 { get; set; } + + } + + public class summary_project_budget_proposals2 + { + public string list { get; set; } + public string project_objectives { get; set; } + public string target_group { get; set; } + public string kpi { get; set; } + public string target_sdg { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_amount { get; set; } + public string period { get; set; } + public decimal? project_amount { get; set; } + public string target_unit { get; set; } + public decimal? target_unit_amount { get; set; } + public string unit { get; set; } + public decimal? unit_amount { get; set; } + public decimal? allocate_amount { get; set; } + public decimal? request_amount { get; set; } + public decimal? online { get; set; } + public decimal? onsite { get; set; } + public string budget_source { get; set; } + public string remark { get; set; } + public List data_3 { get; set; } + + } + + public class summary_project_budget_proposals3 + { + public string list { get; set; } + public string project_objectives { get; set; } + public string target_group { get; set; } + public string kpi { get; set; } + public string target_sdg { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_amount { get; set; } + public string period { get; set; } + public decimal? project_amount { get; set; } + public string target_unit { get; set; } + public decimal? target_unit_amount { get; set; } + public string unit { get; set; } + public decimal? unit_amount { get; set; } + public decimal? allocate_amount { get; set; } + public decimal? request_amount { get; set; } + public decimal? online { get; set; } + public decimal? onsite { get; set; } + public string budget_source { get; set; } + public string remark { get; set; } + public List data_4 { get; set; } + + } + + public class summary_project_budget_proposals4 + { + public int? row_no { get; set; } + public string list { get; set; } + public string project_objectives { get; set; } + public string target_group { get; set; } + public string kpi { get; set; } + public string target_sdg { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_amount { get; set; } + public string period { get; set; } + public decimal? project_amount { get; set; } + public string target_unit { get; set; } + public decimal? target_unit_amount { get; set; } + public string unit { get; set; } + public decimal? unit_amount { get; set; } + public decimal? allocate_amount { get; set; } + public decimal? request_amount { get; set; } + public decimal? online { get; set; } + public decimal? onsite { get; set; } + public string budget_source { get; set; } + public string remark { get; set; } + public List data_5 { get; set; } + + } + + public class summary_project_budget_proposals5 + { + public string list { get; set; } + public string project_objectives { get; set; } + public string target_group { get; set; } + public string kpi { get; set; } + public string target_sdg { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_amount { get; set; } + public string period { get; set; } + public decimal? project_amount { get; set; } + public string target_unit { get; set; } + public decimal? target_unit_amount { get; set; } + public string unit { get; set; } + public decimal? unit_amount { get; set; } + public decimal? allocate_amount { get; set; } + public decimal? request_amount { get; set; } + public decimal? online { get; set; } + public decimal? onsite { get; set; } + public string budget_source { get; set; } + public string remark { 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 ecda2ef..9a94e8c 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 1ee0592..9906d12 100644 Binary files a/bin/Debug/net5.0/rmutr-report.pdb and b/bin/Debug/net5.0/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 7bfb3b5..4768c16 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 7bfb3b5..4768c16 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 dc57dee..7cd6488 100644 --- a/obj/Debug/net5.0/rmutr-report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net5.0/rmutr-report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -fbfff5b43174e027b575f40fbfe1e939e8a759e3 +b4c0772922c2a82dec0b23493bf45d830195391e diff --git a/obj/Debug/net5.0/rmutr-report.dll b/obj/Debug/net5.0/rmutr-report.dll index ecda2ef..9a94e8c 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 1ee0592..9906d12 100644 Binary files a/obj/Debug/net5.0/rmutr-report.pdb and b/obj/Debug/net5.0/rmutr-report.pdb differ diff --git a/wwwroot/reports/summary_project_budget_proposals.frx b/wwwroot/reports/summary_project_budget_proposals.frx new file mode 100644 index 0000000..d204af7 --- /dev/null +++ b/wwwroot/reports/summary_project_budget_proposals.frx @@ -0,0 +1,521 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +