diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index a16eb90..e1b42af 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2482,166 +2482,166 @@ namespace rmutr_report.Controllers return Ok(); } - // [SwaggerOperation("แผนงานบุคลากรภาครัฐ")] - // [HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")] - // [ApiExplorerSettings(GroupName = "reports")] - // public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type, - // [FromBody] budget_expenditure_report_from_revenue budget) - // { - // int no = 1; - // - // var b = budget.budgets.ToArray(); - // foreach (var bb in b) - // { - // bb.personnel_list_s = new List { bb.personnel_lists }; - // foreach (var detail in bb.personnel_list_s) - // { - // foreach (var detail2 in detail.budget_personnel_lists) - // { - // if (detail2.rate != null) - // { - // detail2.text1 = "อัตรา"; - // } - // - // var cperson = detail.budget_personnel_lists.Count(); - // - // if (cperson == 1) - // { - // detail.budget_personnel_lists[0].topic = "งบบุคลากร"; - // } - // - // foreach (var detail3 in detail2.budget_personnel_lists_2) - // { - // if (detail3.rate != null) - // { - // detail3.text1 = "อัตรา"; - // } - // - // int no2 = 1; - // - // if (detail3.topic != null) - // { - // detail3.row_no = no; - // no++; - // } - // - // foreach (var detail4 in detail3.budget_rates) - // { - // if (detail4.rate != null) - // { - // detail4.text1 = "อัตรา"; - // } - // - // int no3 = 1; - // if (detail4.topic != null) - // { - // detail4.row_no = no2; - // no2++; - // } - // - // foreach (var detail5 in detail4.details) - // { - // int no4 = 1; - // if (detail5.rate != null) - // { - // detail5.text1 = "อัตรา"; - // } - // - // if (detail5.position_level != null) - // { - // detail5.row_no = no3; - // no3++; - // } - // - // if (detail5.details2 != null) - // { - // foreach (var detail6 in detail5.details2) - // { - // if (detail6.topic != null) - // { - // detail6.row_no = no4; - // no4++; - // detail6.text1 = "บาท"; - // } - // } - // } - // - // if (detail5.details2.Any()) - // { - // if (detail5.details2==null) - // { - // foreach (var detail6 in detail5.details2) - // { - // detail6.topic = null; - // detail6.total = null; - // detail6.row_no = null; - // detail6.text1 = null; - // } - // } - // } - // else - // { - // detail5.details2.Add(new details2() - // { - // topic = "", total = 999999999 - // }); - // } - // } - // } - // } - // - // - // if (cperson == 2) - // { - // detail.budget_personnel_lists[0].topic = "งบบุคลากร"; - // detail.budget_personnel_lists[1].topic = "งบดําเนินงาน"; - // detail.budget_personnel_lists[1].text1 = null; - // detail.budget_personnel_lists[1].budget_personnel_lists_2[0].text1 = null; - // detail.budget_personnel_lists[1].budget_personnel_lists_2[0].row_no = null; - // detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] - // .row_no = null; - // detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] - // .text1 = null; - // detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] - // .details[0].text1 = null; - // } - // } - // } - // } - // - // - // var budgetExpenditure = new List() { budget }; - // - // Report report = new Report(); - // report.Load(_setting.report_path + "budget_expenditure_report_from_revenue.frx"); - // report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue"); - // 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", - // "budgetExpenditure_" + date + ".xlsx"); - // } - // - // return Ok(); - // } - [SwaggerOperation("แบบฟอร์มสรุปรายจ่าย")] + [SwaggerOperation("แบบฟอร์มสรุปรายจ่าย v1")] + [HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type, + [FromBody] budget_expenditure_report_from_revenue budget) + { + int no = 1; + + var b = budget.budgets.ToArray(); + foreach (var bb in b) + { + bb.personnel_list_s = new List { bb.personnel_lists }; + foreach (var detail in bb.personnel_list_s) + { + foreach (var detail2 in detail.budget_personnel_lists) + { + if (detail2.rate != null) + { + detail2.text1 = "อัตรา"; + } + + var cperson = detail.budget_personnel_lists.Count(); + + if (cperson == 1) + { + detail.budget_personnel_lists[0].topic = "งบบุคลากร"; + } + + foreach (var detail3 in detail2.budget_personnel_lists_2) + { + if (detail3.rate != null) + { + detail3.text1 = "อัตรา"; + } + + int no2 = 1; + + if (detail3.topic != null) + { + detail3.row_no = no; + no++; + } + + foreach (var detail4 in detail3.budget_rates) + { + if (detail4.rate != null) + { + detail4.text1 = "อัตรา"; + } + + int no3 = 1; + if (detail4.topic != null) + { + detail4.row_no = no2; + no2++; + } + + foreach (var detail5 in detail4.details) + { + int no4 = 1; + if (detail5.rate != null) + { + detail5.text1 = "อัตรา"; + } + + if (detail5.position_level != null) + { + detail5.row_no = no3; + no3++; + } + + if (detail5.details2 != null) + { + foreach (var detail6 in detail5.details2) + { + if (detail6.topic != null) + { + detail6.row_no = no4; + no4++; + detail6.text1 = "บาท"; + } + } + } + + if (detail5.details2.Any()) + { + if (detail5.details2==null) + { + foreach (var detail6 in detail5.details2) + { + detail6.topic = null; + detail6.total = null; + detail6.row_no = null; + detail6.text1 = null; + } + } + } + else + { + detail5.details2.Add(new details2() + { + topic = "", total = 999999999 + }); + } + } + } + } + + + if (cperson == 2) + { + detail.budget_personnel_lists[0].topic = "งบบุคลากร"; + detail.budget_personnel_lists[1].topic = "งบดําเนินงาน"; + detail.budget_personnel_lists[1].text1 = null; + detail.budget_personnel_lists[1].budget_personnel_lists_2[0].text1 = null; + detail.budget_personnel_lists[1].budget_personnel_lists_2[0].row_no = null; + detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] + .row_no = null; + detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] + .text1 = null; + detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0] + .details[0].text1 = null; + } + } + } + } + + + var budgetExpenditure = new List() { budget }; + + Report report = new Report(); + report.Load(_setting.report_path + "budget_expenditure_report_from_revenue.frx"); + report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue"); + 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", + "budgetExpenditure_" + date + ".xlsx"); + } + + return Ok(); + } + [SwaggerOperation("แบบฟอร์มสรุปรายจ่าย v2")] [HttpPost, Route("reports/budget_expenditure_report_from_revenue_v2/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type, diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index 4e78ec1..e69671c 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index f4af2b0..cf0ac3a 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index afc7f19..3508ec4 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 844d9f6..b148c61 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/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index f08eb50..a088871 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index f08eb50..a088871 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 4e78ec1..e69671c 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index f4af2b0..cf0ac3a 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index afc7f19..3508ec4 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 844d9f6..b148c61 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/rider.project.restore.info b/obj/rider.project.restore.info index 79a4037..a89fe91 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -16932907245525519 \ No newline at end of file +16932956257079832 \ No newline at end of file