diff --git a/Controllers/GovernmentBudget.Controller.cs b/Controllers/GovernmentBudget.Controller.cs index 8a62286..e974ce2 100644 --- a/Controllers/GovernmentBudget.Controller.cs +++ b/Controllers/GovernmentBudget.Controller.cs @@ -1010,6 +1010,49 @@ namespace rmutr_report.Controllers return Ok(); } + [SwaggerOperation("ค่าประกันภัยรถยนต์ราชการ")] + [HttpPost, Route("reports/budget_progress_insurances/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetInsurancesListReport([FromRoute] string type, + [FromBody] budget_progress_insurances insurances) + { + foreach (var detail in insurances.data) + { + if (detail != null) + { + detail.total_amount = (detail.amount + detail.car_act); + } + } + + var _insurances = new List() { insurances }; + Report report = new Report(); + report.Load(_setting.report_path + "budget_progress_insurances.frx"); + report.RegisterData(_insurances, "budget_progress_insurances"); + 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(); + } + [SwaggerOperation("ค่าคณะกรรมการตรวจสอบพัสดุในงานจ้างก่อสร้าง,ค่าคณะกรรมการอื่น ๆ")] [HttpPost, Route("reports/parcel_inspection_committee/{type}")] [ApiExplorerSettings(GroupName = "reports")] @@ -1064,8 +1107,8 @@ namespace rmutr_report.Controllers return Ok(); } - - [SwaggerOperation("ค่าจ้างให้บริการงานจ้างออกแบบ")] + + [SwaggerOperation("ค่าจ้างให้บริการงานจ้างออกแบบ")] [HttpPost, Route("reports/design_services/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetDesignServicesReport([FromRoute] string type, @@ -1083,7 +1126,7 @@ namespace rmutr_report.Controllers if (detail != null) { detail.unit = detail.quantity_work + per; - detail.amount = (detail.quantity * detail.quantity_person * detail.quantity_work)/100; + detail.amount = (detail.quantity * detail.quantity_person * detail.quantity_work) / 100; } } @@ -1122,6 +1165,7 @@ namespace rmutr_report.Controllers return Ok(); } + [SwaggerOperation("ค่าอาหารทำการนอกเวลา 1 วันทำการปกติ 2 วันหยุดราชการ")] [HttpPost, Route("reports/meal_costs_outside/{type}")] [ApiExplorerSettings(GroupName = "reports")] @@ -1129,23 +1173,26 @@ namespace rmutr_report.Controllers [FromBody] meal_costs_outside mealCostsOutsides) { var meals = mealCostsOutsides.data.ToList(); - if (mealCostsOutsides.topic_type==1) + if (mealCostsOutsides.topic_type == 1) { mealCostsOutsides.topic = "วันทำการปกติ"; } - if (mealCostsOutsides.topic_type==2) + + if (mealCostsOutsides.topic_type == 2) { mealCostsOutsides.topic = "วันหยุดราชการ"; } + foreach (var detail in mealCostsOutsides.data) { - detail.total_amount = (detail.day*detail.person*detail.amount); + detail.total_amount = (detail.day * detail.person * detail.amount); } + mealCostsOutsides.day = mealCostsOutsides.data.Sum(d => d.day); mealCostsOutsides.person = mealCostsOutsides.data.Sum(d => d.person); mealCostsOutsides.amount = mealCostsOutsides.data.Sum(d => d.amount); mealCostsOutsides.total_amount = meals.Sum(f => f.total_amount); - + var meal = new List() { mealCostsOutsides }; Report report = new Report(); report.Load(_setting.report_path + "meal_costs_outside.frx"); @@ -1174,40 +1221,45 @@ namespace rmutr_report.Controllers return Ok(); } - [SwaggerOperation("ค่าเบี้ยเลี้ยง ที่พัก พาหนะ")] + + [SwaggerOperation("ค่าเบี้ยเลี้ยง ที่พัก พาหนะ")] [HttpPost, Route("reports/expense/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetExpenseReport([FromRoute] string type, [FromBody] expense _expense) { var meals = _expense.data.ToList(); - if (_expense.topic_type==1) + if (_expense.topic_type == 1) { _expense.topic = "ค่าเบี้ยเลี้ยง"; _expense.text_1 = "จำนวนเงิน/วัน"; _expense.text_2 = "จำนวน (วัน)"; } - if (_expense.topic_type==2) + + if (_expense.topic_type == 2) { _expense.topic = "ค่าเช่าที่พัก"; _expense.text_1 = "จำนวนเงิน/คน/คืน"; _expense.text_2 = "จำนวนวัน"; } - if (_expense.topic_type==3) + + if (_expense.topic_type == 3) { _expense.topic = "ค่าพาหนะ"; _expense.text_1 = "จำนวนเงิน"; _expense.text_2 = "จำนวนครั้ง"; } + foreach (var detail in _expense.data) { - detail.total_amount = (detail.quantity_1*detail.quantity_2*detail.quantity_3); + detail.total_amount = (detail.quantity_1 * detail.quantity_2 * detail.quantity_3); } + _expense.quantity_1 = _expense.data.Sum(d => d.quantity_1); _expense.quantity_2 = _expense.data.Sum(d => d.quantity_2); _expense.quantity_3 = _expense.data.Sum(d => d.quantity_3); _expense.total_amount = meals.Sum(f => f.total_amount); - + var expenses = new List() { _expense }; Report report = new Report(); report.Load(_setting.report_path + "expense.frx"); @@ -1236,5 +1288,59 @@ namespace rmutr_report.Controllers return Ok(); } + + [SwaggerOperation("แบบคำนวณค่าวัสดุการศึกษา")] + [HttpPost, Route("reports/material_edu_cal_form/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetCalFormReport([FromRoute] string type, + [FromBody] material_edu_cal_form calForm) + { + foreach (var data in calForm.data) + { + int row_no = 1; + var total = data.data_detail.ToList(); + foreach (var detail2 in data.data_detail) + { + if (detail2.topic_type == 2) + { + detail2.no = row_no.ToString(); + row_no++; + // detail2.total_amount_1 = detail2.amount_1*detail2.rate_1; + // detail2.total_amount_2 = detail2.amount_2*detail2.rate_2; + // detail2.total_all_amount = detail2.total_amount_1 + detail2.total_amount_2; + } + + calForm.total_amount = calForm.data.Sum(d => d.amount); + } + } + + var _cal = new List() { calForm }; + Report report = new Report(); + report.Load(_setting.report_path + "material_edu_cal_form.frx"); + report.RegisterData(_cal, "material_edu_cal_form"); + 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/budget_progress_insurances.cs b/Models/budget/budget_progress_insurances.cs new file mode 100644 index 0000000..14254c9 --- /dev/null +++ b/Models/budget/budget_progress_insurances.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class budget_progress_insurances + { + public string budget_year { get; set; } + public List data { get; set; } + } + + public class budget_progress_insurances_detail + { + public string car_number { get; set; } + public decimal? amount { get; set; } + public decimal? car_act { get; set; } + public string month { get; set; } + public decimal? total_amount { get; set; } + } +} \ No newline at end of file diff --git a/Models/budget/material_edu_cal_form.cs b/Models/budget/material_edu_cal_form.cs new file mode 100644 index 0000000..773dadf --- /dev/null +++ b/Models/budget/material_edu_cal_form.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class material_edu_cal_form + { + public string budget_year { get; set; } + public string faculty_name_th { get; set; } + public string area { get; set; } + public List data { get; set; } + public decimal? total_amount { get; set; } + } + + public class material_edu_cal_form_detail + { + public string faculty_name_th { get; set; } + public string area { get; set; } + public string curriculum_name_th { get; set; } + public string semester_1 { get; set; } + public string semester_2 { get; set; } + public string year_1 { get; set; } + public string year_2 { get; set; } + public decimal? amount { get; set; } + public List data_detail { get; set; } + + } + + public class material_edu_cal_form_detail2 + { + public int? topic_type { get; set; } + public string no { get; set; } + public string topic { get; set; } + // public string semester_1 { get; set; } + // public string semester_2 { get; set; } + // public string year_1 { get; set; } + // public string year_2 { get; set; } + public decimal? amount_1 { get; set; } + public decimal? rate_1 { get; set; } + public decimal? total_amount_1 { get; set; } + public decimal? amount_2 { get; set; } + public decimal? rate_2 { get; set; } + public decimal? total_amount_2 { get; set; } + public decimal? total_all_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 8cb4815..fb4c05c 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 9a9298f..98125ac 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 bc84e0c..3a1fd01 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -0389217213dc28262c345e10fcde26c9d129a140 +4fbc03ee83ba8c63e3851e021e2d1fb743067dae diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 8cb4815..fb4c05c 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 9a9298f..98125ac 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 94b3406..860529b 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 @@ -112,6 +112,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\budget_expenditure_report_from_revenue_v2.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\budget_progress_insurances.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\budget_progress_insurances.frx)) + Package rmutr_report @@ -832,6 +848,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\material_education.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\material_edu_cal_form.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\material_edu_cal_form.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 fadb254..db5ebbc 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 @@ -48a23f2aa6cf7fe9461bd4b5281978a6a95e8cb8 +c5f222989e07e2a5023c6ece5f0951ac96f2245c diff --git a/obj/rider.project.restore.info b/obj/rider.project.restore.info index 902563d..89eaa16 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -16982482975361382 \ No newline at end of file +16983176231557303 \ No newline at end of file diff --git a/wwwroot/reports/budget_progress_insurances.frx b/wwwroot/reports/budget_progress_insurances.frx new file mode 100644 index 0000000..1f01013 --- /dev/null +++ b/wwwroot/reports/budget_progress_insurances.frx @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/material_edu_cal_form.frx b/wwwroot/reports/material_edu_cal_form.frx new file mode 100644 index 0000000..b998cf2 --- /dev/null +++ b/wwwroot/reports/material_edu_cal_form.frx @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +