diff --git a/Controllers/GovernmentBudget.Controller.cs b/Controllers/GovernmentBudget.Controller.cs index ee48f67..09df75e 100644 --- a/Controllers/GovernmentBudget.Controller.cs +++ b/Controllers/GovernmentBudget.Controller.cs @@ -1022,10 +1022,11 @@ namespace rmutr_report.Controllers { detail.total_amount = (detail.amount + detail.car_act); } + switch (detail.month) { case 1: - detail.month_th = "มกราคม"; + detail.month_th = "มกราคม"; break; case 2: detail.month_th = "กุมภาพันธ์"; @@ -1061,7 +1062,6 @@ namespace rmutr_report.Controllers detail.month_th = "ธันวาคม"; break; } - } var _insurances = new List() { insurances }; @@ -1382,5 +1382,55 @@ namespace rmutr_report.Controllers return Ok(); } + + [SwaggerOperation("ค่าควบคุมงานก่อสร้าง")] + [HttpPost, Route("reports/control_cost_construction/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetConstructionReport([FromRoute] string type, + [FromBody] control_cost_construction _expense) + { + if (_expense.topic_type == 1) + { + _expense.topic = "ค่าควบคุมงานก่อสร้าง (หัวหน้าควบคุมงานก่อสร้าง)"; + } + + if (_expense.topic_type == 2) + { + _expense.topic = "ค่าควบคุมงานก่อสร้าง (ผู้ปฏิบัติการ)"; + } + + foreach (var detail in _expense.data) + { + detail.total_amount = (detail.quantity_day * detail.quantity_person * detail.amount); + } + + var expenses = new List() { _expense }; + Report report = new Report(); + report.Load(_setting.report_path + "control_cost_construction.frx"); + report.RegisterData(expenses, "control_cost_construction"); + 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", + "ค่าควบคุมงานก่อสร้าง" + ".xlsx"); + } + + return Ok(); + } } } \ No newline at end of file diff --git a/Models/budget/control_cost_construction.cs b/Models/budget/control_cost_construction.cs new file mode 100644 index 0000000..6114877 --- /dev/null +++ b/Models/budget/control_cost_construction.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class control_cost_construction + { + public int? topic_type { get; set; } + public string topic { get; set; } + public List data { get; set; } + } + + public class control_cost_construction_detail + { + public decimal? quantity_day { get; set; } + public decimal? quantity_person { get; set; } + public decimal? amount { get; set; } + public decimal? quantity_work { get; set; } + public decimal? total_amount { 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 944c439..f8dd30a 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 b4ec2f5..6684f70 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 45746e9..6bf3b69 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -04ffabe9d09db3eaf66c7e59e1b69ef6220d980e +9cfeedd89b72b1f5267ec4e7959ae277c719f5c6 diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 944c439..f8dd30a 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 b4ec2f5..6684f70 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/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props b/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props index 3af2419..b646d34 100644 --- a/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props +++ b/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props @@ -336,6 +336,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\contributions.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\control_cost_construction.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\control_cost_construction.frx)) + Package rmutr_report diff --git a/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache b/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache index 0ccbae9..8784ff1 100644 --- a/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache +++ b/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache @@ -1 +1 @@ -9fdb36bdc21e43e3de61118b3e5b09a1b8490e9e +29054d1f7148e9432a37c4b95d7e6c92af540091 diff --git a/obj/rider.project.model.nuget.info b/obj/rider.project.model.nuget.info index 0c5c185..25aad06 100644 --- a/obj/rider.project.model.nuget.info +++ b/obj/rider.project.model.nuget.info @@ -1 +1 @@ -17001217270031729 \ No newline at end of file +17001321833144528 \ No newline at end of file diff --git a/obj/rider.project.restore.info b/obj/rider.project.restore.info index 25aad06..8c10d1e 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -17001321833144528 \ No newline at end of file +17001930966561955 \ No newline at end of file diff --git a/wwwroot/reports/control_cost_construction.frx b/wwwroot/reports/control_cost_construction.frx new file mode 100644 index 0000000..fa51435 --- /dev/null +++ b/wwwroot/reports/control_cost_construction.frx @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +