diff --git a/Controllers/GovernmentBudget.Controller.cs b/Controllers/GovernmentBudget.Controller.cs new file mode 100644 index 0000000..ee0ac6d --- /dev/null +++ b/Controllers/GovernmentBudget.Controller.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.IO; +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 GovernmentBudget : Controller + { + readonly Setting _setting; + + public GovernmentBudget(Setting setting) + { + this._setting = setting; + } + [HttpPost, Route("reports/receive_government/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetGovernmentBudgetReport([FromRoute] string type, + [FromBody] receive_government receive_governments) + { + var _receive_governments = new List() { receive_governments }; + + Report report = new Report(); + report.Load(_setting.report_path + "receive_government.frx"); + report.RegisterData(_receive_governments, "receive_government"); + 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": + 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", + "receive_government_"+date + ".xlsx"); + 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 diff --git a/Models/budget/receive_government.cs b/Models/budget/receive_government.cs new file mode 100644 index 0000000..5593938 --- /dev/null +++ b/Models/budget/receive_government.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class receive_government // GovernmentBudget + { + public string government_budget_year { get; set; } + //public string agency_name_th { get; set; } + public string plan { get; set; } + public string product { get; set; } + public string budget_year { 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 decimal? total_budget_1 { get; set; } + public decimal? total_budget_2 { get; set; } + public decimal? total_budget_3 { get; set; } + public decimal? total_budget_4 { get; set; } + public decimal? total_budget_5 { get; set; } + public decimal? total_budget_6 { get; set; } + public decimal? total_budget_7 { get; set; } + public decimal? total_budget_8 { get; set; } + public decimal? total_budget_9 { get; set; } + public decimal? total_budget_10 { get; set; } + public decimal? total_budget_11 { get; set; } + public decimal? total_budget_12 { get; set; } + public decimal? total_budget_13 { get; set; } + public decimal? total_budget_14 { get; set; } + public decimal? total_budget_15 { get; set; } + public decimal? total_budget_16 { get; set; } + public decimal? total_budget_17 { get; set; } + public decimal? total_budget_18 { get; set; } + public List data_1 { get; set; } + } + + public class total_government_1 + { + //public int? is_color { get; set; } + public string list { get; set; } + public decimal? total_budget_1 { get; set; } + public decimal? total_budget_2 { get; set; } + public decimal? total_budget_3 { get; set; } + public decimal? total_budget_4 { get; set; } + public decimal? total_budget_5 { get; set; } + public decimal? total_budget_6 { get; set; } + public decimal? total_budget_7 { get; set; } + public decimal? total_budget_8 { get; set; } + public decimal? total_budget_9 { get; set; } + public decimal? total_budget_10 { get; set; } + public decimal? total_budget_11 { get; set; } + public decimal? total_budget_12 { get; set; } + public decimal? total_budget_13 { get; set; } + public decimal? total_budget_14 { get; set; } + public decimal? total_budget_15 { get; set; } + public decimal? total_budget_16 { get; set; } + public decimal? total_budget_17 { get; set; } + public decimal? total_budget_18 { get; set; } + public List data_2 { get; set; } + + } + + public class total_government_2 + { + public int? is_color { get; set; } // 1 สีฟ้า 2 สีส้ม + public string list { get; set; } + public decimal? total_budget_1 { get; set; } + public decimal? total_budget_2 { get; set; } + public decimal? total_budget_3 { get; set; } + public decimal? total_budget_4 { get; set; } + public decimal? total_budget_5 { get; set; } + public decimal? total_budget_6 { get; set; } + public decimal? total_budget_7 { get; set; } + public decimal? total_budget_8 { get; set; } + public decimal? total_budget_9 { get; set; } + public decimal? total_budget_10 { get; set; } + public decimal? total_budget_11 { get; set; } + public decimal? total_budget_12 { get; set; } + public decimal? total_budget_13 { get; set; } + public decimal? total_budget_14 { get; set; } + public decimal? total_budget_15 { get; set; } + public decimal? total_budget_16 { get; set; } + public decimal? total_budget_17 { get; set; } + public decimal? total_budget_18 { get; set; } + public List data_3 { get; set; } + + } + + public class total_government_3 + { + public string list { get; set; } + public decimal? total_budget_1 { get; set; } + public decimal? total_budget_2 { get; set; } + public decimal? total_budget_3 { get; set; } + public decimal? total_budget_4 { get; set; } + public decimal? total_budget_5 { get; set; } + public decimal? total_budget_6 { get; set; } + public decimal? total_budget_7 { get; set; } + public decimal? total_budget_8 { get; set; } + public decimal? total_budget_9 { get; set; } + public decimal? total_budget_10 { get; set; } + public decimal? total_budget_11 { get; set; } + public decimal? total_budget_12 { get; set; } + public decimal? total_budget_13 { get; set; } + public decimal? total_budget_14 { get; set; } + public decimal? total_budget_15 { get; set; } + public decimal? total_budget_16 { get; set; } + public decimal? total_budget_17 { get; set; } + public decimal? total_budget_18 { get; set; } + } +} \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index 3e858b3..a1ad4af 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 e0842ea..c36f937 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.csproj.CoreCompileInputs.cache b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache index 3d71ee0..164c84f 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -159b9fce7386fddadb57d3e23712e888757a9066 +f2347ed1bcc09b6148623823522308b3e2a73432 diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 3e858b3..a1ad4af 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 e0842ea..c36f937 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/wwwroot/reports/receive_government.frx b/wwwroot/reports/receive_government.frx new file mode 100644 index 0000000..606bbcd --- /dev/null +++ b/wwwroot/reports/receive_government.frx @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +