From a1f853b870cf793fdddc51a308f6926db5c5bbbe Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Wed, 7 Aug 2024 17:30:09 +0700 Subject: [PATCH] Update --- Controllers/Budget.Controller.cs | 71 ++++++++++ Models/budget/estimate_income_expenses.cs | 56 ++++++++ bin/Debug/netcoreapp3.1/font2021.3.0.list | 1 + wwwroot/reports/estimate_income_expenses.frx | 129 ++++++++++++++++++ wwwroot/reports/summary_income_allocation.frx | 119 ++++++++++++++++ 5 files changed, 376 insertions(+) create mode 100644 Models/budget/estimate_income_expenses.cs create mode 100644 wwwroot/reports/estimate_income_expenses.frx create mode 100644 wwwroot/reports/summary_income_allocation.frx diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 65a85a7..b85b777 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -3512,6 +3512,77 @@ namespace rmutr_report.Controllers "summary_budget_expense" + ".xlsx"); } + return Ok(); + } + [SwaggerOperation("ประมาณการรายรับ รายจ่าย")] + [HttpPost, Route("reports/estimate_income_expenses/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBudgetEstimateReport([FromRoute] string type, + [FromBody] estimate_income_expenses budget) + { + var summaryBudget = new List() { budget }; + + Report report = new Report(); + report.Load(_setting.report_path + "estimate_income_expenses.frx"); + report.RegisterData(summaryBudget, "estimate_income_expenses"); + 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", + "estimate_income_expenses" + ".xlsx"); + } + + return Ok(); + } + [SwaggerOperation("สรุปรายรับ และการจัดสรร")] + [HttpPost, Route("reports/summary_income_allocation/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBudgetAllocationReport([FromRoute] string type, + [FromBody] estimate_income_expenses budget) + { + + var summaryBudget = new List() { budget }; + + Report report = new Report(); + report.Load(_setting.report_path + "summary_income_allocation.frx"); + report.RegisterData(summaryBudget, "estimate_income_expenses"); + 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_income_allocation" + ".xlsx"); + } + return Ok(); } } diff --git a/Models/budget/estimate_income_expenses.cs b/Models/budget/estimate_income_expenses.cs new file mode 100644 index 0000000..1142f6b --- /dev/null +++ b/Models/budget/estimate_income_expenses.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class estimate_income_expenses + { + public string budget_year { get; set; } + public string date_range { get; set; } + public string faculty { get; set; } + public List data_1 { get; set; } + } + + public class estimate_income_expenses_detail + { + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? amount_3 { get; set; } + public decimal? amount_4 { get; set; } + public decimal? amount_5 { get; set; } + public decimal? amount_6 { get; set; } + public decimal? amount_7 { get; set; } + public decimal? amount_8 { get; set; } + public decimal? total_amount { get; set; } + public List data_2 { get; set; } + } + public class estimate_income_expenses_detail2 + { + public int? row { get; set; } + public string type { get; set; } + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? amount_3 { get; set; } + public decimal? amount_4 { get; set; } + public decimal? amount_5 { get; set; } + public decimal? amount_6 { get; set; } + public decimal? amount_7 { get; set; } + public decimal? amount_8 { get; set; } + public decimal? total_amount { get; set; } + //public List data_3 { get; set; } + } + // public class estimate_income_expenses_detail3 + // { + // public string list { get; set; } + // public decimal? amount_1 { get; set; } + // public decimal? amount_2 { get; set; } + // public decimal? amount_3 { get; set; } + // public decimal? amount_4 { get; set; } + // public decimal? amount_5 { get; set; } + // public decimal? amount_6 { get; set; } + // public decimal? amount_7 { get; set; } + // public decimal? amount_8 { get; set; } + // public decimal? total_amount { get; set; } + // } +} \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/font2021.3.0.list b/bin/Debug/netcoreapp3.1/font2021.3.0.list index 2017386..5dce5f5 100644 --- a/bin/Debug/netcoreapp3.1/font2021.3.0.list +++ b/bin/Debug/netcoreapp3.1/font2021.3.0.list @@ -494,3 +494,4 @@ Yu Gothic C:\WINDOWS\Fonts\YuGothR.ttc Yu Gothic UI Semilight C:\WINDOWS\Fonts\YuGothR.ttc Microsoft Uighur-B C:\WINDOWS\Fonts\MSUIGHUB.TTF Microsoft Uighur C:\WINDOWS\Fonts\MSUIGHUR.TTF +JS Wansika C:\Users\USER\AppData\Local\Microsoft\Windows\Fonts\JS-Wansika-Italic.ttf diff --git a/wwwroot/reports/estimate_income_expenses.frx b/wwwroot/reports/estimate_income_expenses.frx new file mode 100644 index 0000000..207a12d --- /dev/null +++ b/wwwroot/reports/estimate_income_expenses.frx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/summary_income_allocation.frx b/wwwroot/reports/summary_income_allocation.frx new file mode 100644 index 0000000..9a7c59c --- /dev/null +++ b/wwwroot/reports/summary_income_allocation.frx @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +