diff --git a/Controllers/RoThree.Controller.cs b/Controllers/RoThree.Controller.cs new file mode 100644 index 0000000..2ce84a4 --- /dev/null +++ b/Controllers/RoThree.Controller.cs @@ -0,0 +1,73 @@ +using System; +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 rmutr_report.Models.RoThree; +using Swashbuckle.AspNetCore.Annotations; + +namespace rmutr_report.Controllers +{ + [SwaggerTag("สำหรับรายงาน ร.3 คำชี้แจงงบดำเนินงาน")] + + public class RoThree : Controller + { + readonly Setting _setting; + + public RoThree(Setting setting) + { + this._setting = setting; + } + + [HttpPost, Route("reports/operating_budget_ro_three/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetRoThreeReport([FromRoute] string type, [FromBody] operating_budget_ro_three three) + { + + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "operating_budget_ro_three.frx"); + report.RegisterData(threes, "operating_budget_ro_three"); + 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; + 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/RoThree/operating_budget_ro_three.cs b/Models/RoThree/operating_budget_ro_three.cs new file mode 100644 index 0000000..1f4ddc7 --- /dev/null +++ b/Models/RoThree/operating_budget_ro_three.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.RoThree +{ + public class operating_budget_ro_three + { + public string budget_year { get; set; } + public string date_range { get; set; } + public string product { get; set; } + public string agency_name_th { get; set; } + public string sector { get; set; } + public string disbursement_result_year { get; set; } + public string set_year { get; set; } + public List data_1 { get; set; } + + + } + + public class operating_budget_ro_three_detail + { + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? quantity_1 { get; set; } + public decimal? quantity_2 { get; set; } + public decimal? rate { get; set; } + public decimal? total_amount { get; set; } + public string remark { get; set; } + public List data_2{ get; set; } + + } + + public class operating_budget_ro_three_detail2 + { + public int? rowno { get; set; } + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? quantity_1 { get; set; } + public decimal? quantity_2 { get; set; } + public decimal? rate { get; set; } + public decimal? total_amount { get; set; } + public string remark { get; set; } + public List data_3{ get; set; } + + } + + public class operating_budget_ro_three_detail3 + { + public int? rowno { get; set; } + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? quantity_1 { get; set; } + public decimal? quantity_2 { get; set; } + public decimal? rate { get; set; } + public decimal? total_amount { get; set; } + public string remark { get; set; } + public List data_4{ get; set; } + + } + + public class operating_budget_ro_three_detail4 + { + public string list { get; set; } + public decimal? amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? quantity_1 { get; set; } + public decimal? quantity_2 { get; set; } + public decimal? rate { get; set; } + public decimal? total_amount { get; set; } + public string remark { 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 7cfb565..6a91f62 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 13c9570..433263b 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 782a048..7a6206c 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -b72e1ee7109b710bd4d78c020e9006ab9f3adfe8 +ee5763df9ddeaf2d8acc3f4615148657d930de4e diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 7cfb565..6a91f62 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 13c9570..433263b 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/operating_budget_ro_three.frx b/wwwroot/reports/operating_budget_ro_three.frx new file mode 100644 index 0000000..3e0381c --- /dev/null +++ b/wwwroot/reports/operating_budget_ro_three.frx @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +