diff --git a/Controllers/RoThree.Controller.cs b/Controllers/RoThree.Controller.cs index c0b2d29..2e983e5 100644 --- a/Controllers/RoThree.Controller.cs +++ b/Controllers/RoThree.Controller.cs @@ -1344,7 +1344,7 @@ namespace rmutr_report.Controllers // return Ok(); // } - [SwaggerOperation("ค่าใช้จ่ายดำเนินงาน รายละเอียดการคำนวณค่าใช้จ่ายในการประชุม")] + [SwaggerOperation("1 ค่าอาหารว่าง 2 ค่าเบี้ยประชุมคณะกรรมการ")] [HttpPost, Route("reports/calculate_meeting_expenses/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetCalReport([FromRoute] string type, @@ -1367,50 +1367,37 @@ namespace rmutr_report.Controllers calculate.text4 = "รวมค่าเบี้ยประชุม"; } - //var newlist = new List() { }; - //var newlist2 = newlist.SelectMany(newlist => newlist.data); + //var newList = new List() { }; + //var newList2 = newList.SelectMany(f => f.data).Where(d => d.topic_type == 2).Sum(g => g.disbursement_result); int n = 1; - foreach (var data in calculate.data) + foreach (var data in calculate.data) { + int r = 1; if (data.topic_type == 1) { data.row_no = null; data.no = n.ToString(); n++; - - } + } + if (data.topic_type == 2) { data.total = data.expense_rate * data.count_person * data.count_meetings; } } + calculate.disbursement_result = c.Where(e => e.topic_type == 1).Sum(d => d.disbursement_result); calculate.expense_rate = c.Where(e => e.topic_type == 1).Sum(d => d.expense_rate); calculate.count_person = c.Where(e => e.topic_type == 1).Sum(d => d.count_person); calculate.count_meetings = c.Where(e => e.topic_type == 1).Sum(d => d.count_meetings); calculate.total = c.Where(e => e.topic_type == 1).Sum(d => d.total); + var calculateMeeting = new List() { calculate }; - // calculate.data.Add(new calculate_meeting_expenses_data_datail() - // { - // topic_type = 1, - // disbursement_result = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2) - // .Sum(c => c.disbursement_result), - // count_person = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2) - // .Sum(c => c.count_person) - // }); - // foreach (var cc in c) - // { - // if (cc.topic_type==1) - // { - // cc.disbursement_result = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2) - // .Sum(c => c.disbursement_result); - // cc.count_person = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2) - // .Sum(c => c.count_person); - // } - // - // } + + + Report report = new Report(); report.Load(_setting.report_path + "calculate_meeting_expenses.frx"); report.RegisterData(calculateMeeting, "calculate_meeting_expenses"); @@ -1438,5 +1425,48 @@ namespace rmutr_report.Controllers return Ok(); } + [SwaggerOperation("ค่าตอบแทนผู้ปฏิบัติงานให้ราชการ (ค่าควบคุมงานก่อสร้าง)")] + [HttpPost, Route("reports/control_cost_construction_wages/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetConstructionReport([FromRoute] string type, + [FromBody] control_cost_construction_wages _expense) + { + var wages = _expense.data.ToList(); + + foreach (var detail in _expense.data) + { + detail.total_amount = (detail.quantity_work*detail.quantity_day * detail.quantity_person * detail.amount); + } + _expense.total_amount = wages.Sum(f => f.total_amount); + + var expenses = new List() { _expense }; + Report report = new Report(); + report.Load(_setting.report_path + "control_cost_construction_wages.frx"); + report.RegisterData(expenses, "control_cost_construction_wages"); + 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", + "control_cost_construction_wages" + ".xlsx"); + } + + return Ok(); + } + } } \ No newline at end of file diff --git a/Models/RoReport/calculate_meeting_expenses.cs b/Models/RoReport/calculate_meeting_expenses.cs index e8ca5d1..ef2b297 100644 --- a/Models/RoReport/calculate_meeting_expenses.cs +++ b/Models/RoReport/calculate_meeting_expenses.cs @@ -24,7 +24,7 @@ namespace rmutr_report.Models.RoThree public class calculate_meeting_expenses_data_datail { - public int? topic_type { get; set; } //1 2 + public int? topic_type { get; set; } //1 สีเหลือง 2 ข้อย่อย public string no { get; set; } public string row_no { get; set; } public string topic_name { get; set; } diff --git a/Models/budget/control_cost_construction.cs b/Models/budget/control_cost_construction.cs index 6114877..47de675 100644 --- a/Models/budget/control_cost_construction.cs +++ b/Models/budget/control_cost_construction.cs @@ -17,4 +17,18 @@ namespace rmutr_report.Models public decimal? quantity_work { get; set; } public decimal? total_amount { get; set; } } + public class control_cost_construction_wages + { + + public decimal? total_amount { get; set; } + public List data { get; set; } + } + public class control_cost_construction_wages_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 1f49ea1..dbb8066 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 87410ac..65caa6e 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.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 1f49ea1..dbb8066 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 87410ac..65caa6e 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 f8bd721..9aec172 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 @@ -384,6 +384,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\control_cost_construction.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\control_cost_construction_wages.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\control_cost_construction_wages.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 fb24454..f204b69 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 @@ -9f07dd534e278fa2dd7afca679d31a5d182378cc +dea208d6dcf8aff820dcbc6409c4fd9e41c662bb diff --git a/obj/rider.project.model.nuget.info b/obj/rider.project.model.nuget.info index 71f686f..624f633 100644 --- a/obj/rider.project.model.nuget.info +++ b/obj/rider.project.model.nuget.info @@ -1 +1 @@ -17007343045432872 \ No newline at end of file +17007993899443636 \ No newline at end of file diff --git a/obj/rider.project.restore.info b/obj/rider.project.restore.info index 71f686f..1a98769 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -17007343045432872 \ No newline at end of file +17008168824080162 \ No newline at end of file diff --git a/wwwroot/reports/calculate_meeting_expenses.frx b/wwwroot/reports/calculate_meeting_expenses.frx index d848bc1..5374a5e 100644 --- a/wwwroot/reports/calculate_meeting_expenses.frx +++ b/wwwroot/reports/calculate_meeting_expenses.frx @@ -1,5 +1,5 @@ - - + + @@ -96,56 +96,31 @@ - - - - - - + - - - - - - + - - - - - - + - - - - - - + - - - - - @@ -176,4 +151,4 @@ - + \ No newline at end of file diff --git a/wwwroot/reports/control_cost_construction_wages.frx b/wwwroot/reports/control_cost_construction_wages.frx new file mode 100644 index 0000000..9d388b1 --- /dev/null +++ b/wwwroot/reports/control_cost_construction_wages.frx @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +