diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 1538c03..d5189d6 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -1598,11 +1598,76 @@ namespace rmutr_report.Controllers public IActionResult GetBudgetReport([FromRoute] string type, [FromBody] budget_expenditure_from_revenue budget_expenditure_from_revenues) { + var topic2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details.ToArray() + .Where(i => i.topic_type == 2).ToList(); + var topic3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details.ToArray() + .Where(i => i.topic_type == 3).OrderBy(f=>f.couse_uid).ThenBy(m=>m.major_uid) + .ThenBy(r=>r.row).ToList(); + // var sum_1 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.current_students); + // var sum_2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.students_reduced); + // var sum_3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.students_estimates); + // var sum_4 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.price_regis_flat_payment); + // var sum_5 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.library_total); + // var sum_6 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.utilities_total); + // var sum_7 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.student_club_library_total); + // var sum_8 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.accident_insurance_total); + // var sum_9 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.academic_activities_total); + // var sum_10 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.examination_and_x_rays_total); + // var sum_11 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.tuition_fee_total); + // var sum_12 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details + // .Where(h => h.topic_type == 2).Sum(j => + // j.education_fee_less_fee_total); if (budget_expenditure_from_revenues.budget_expenditure_from_revenue_details != null) { + // var _sum1 = topic3.Sum(g => g.current_students); + // var _sum2 = topic3.Sum(j => + // j.students_reduced); + // var _sum3 = topic3.Sum(j => + // j.students_estimates); + // var _sum4 = topic3.Sum(j => + // j.price_regis_flat_payment); + // var _sum5 = topic3.Sum(j => + // j.library_total); + // var _sum6 = topic3.Sum(j => + // j.utilities_total); + // var _sum7 = topic3.Sum(j => + // j.student_club_library_total); + // var _sum8 = topic3.Sum(j => + // j.accident_insurance_total); + // var _sum9 = topic3.Sum(j => + // j.academic_activities_total); + // var _sum10 = topic3.Sum(j => + // j.examination_and_x_rays_total); + // var _sum11 = topic3.Sum(j => + // j.tuition_fee_total); + // var _sum12 = topic3.Sum(j => + // j.education_fee_less_fee_total); + foreach (var detail in budget_expenditure_from_revenues.budget_expenditure_from_revenue_details) { - if (detail.topic_type == 1) + if (detail.topic_type == 1 && detail.topic_type != 2&& detail.topic_type != 3) { detail.topic_1 = detail.topic; detail.topic_2 = null; @@ -1654,15 +1719,65 @@ namespace rmutr_report.Controllers .Where(h => h.topic_type == 1).Sum(j => j.education_fee_less_fee_total); budget_expenditure_from_revenues.sum_12 = sum12; + + detail.current_students = topic2.Sum(d=>d.current_students); + + detail.students_reduced = topic2.Sum(d=>d.students_reduced); + + detail.students_estimates = topic2.Sum(d=>d.students_estimates); + + detail.price_regis_flat_payment = topic2.Sum(d=>d.price_regis_flat_payment); + + detail.library_total = topic2.Sum(d=>d.library_total); + + detail.utilities_total =topic2.Sum(d=>d.utilities_total); + + detail.student_club_library_total = topic2.Sum(d=>d.student_club_library_total); + + detail.accident_insurance_total = topic2.Sum(d=>d.accident_insurance_total); + + detail.academic_activities_total = topic2.Sum(d=>d.academic_activities_total); + + detail.examination_and_x_rays_total = topic2.Sum(d=>d.examination_and_x_rays_total); + + detail.tuition_fee_total = topic2.Sum(d=>d.tuition_fee_total); + + detail.education_fee_less_fee_total = topic2.Sum(d=>d.education_fee_less_fee_total); + } - if (detail.topic_type == 2) + + if (detail.topic_type == 2&& detail.topic_type != 1&& detail.topic_type != 3) { detail.topic_1 = detail.topic; detail.topic_2 = null; + + detail.current_students = topic3.Sum(d=>d.current_students); + + detail.students_reduced = topic3.Sum(d=>d.students_reduced); + + detail.students_estimates = topic3.Sum(d=>d.students_estimates); + + detail.price_regis_flat_payment = topic3.Sum(d=>d.price_regis_flat_payment); + + detail.library_total = topic3.Sum(d=>d.library_total); + + detail.utilities_total =topic3.Sum(d=>d.utilities_total); + + detail.student_club_library_total = topic3.Sum(d=>d.student_club_library_total); + + detail.accident_insurance_total = topic3.Sum(d=>d.accident_insurance_total); + + detail.academic_activities_total = topic3.Sum(d=>d.academic_activities_total); + + detail.examination_and_x_rays_total = topic3.Sum(d=>d.examination_and_x_rays_total); + + detail.tuition_fee_total = topic3.Sum(d=>d.tuition_fee_total); + + detail.education_fee_less_fee_total = topic3.Sum(d=>d.education_fee_less_fee_total); } - if (detail.topic_type == 3) + if (detail.topic_type == 3&& detail.topic_type != 1&& detail.topic_type != 2) { detail.topic_2 = detail.topic; detail.topic_1 = null; @@ -1834,7 +1949,6 @@ namespace rmutr_report.Controllers int r2 = 2; foreach (var detail in revenue_estimate.revenue_estimates_details) { - if (detail.topic_type == 1) { ws.Cell(row, 1).Value = detail.topic; @@ -1899,7 +2013,7 @@ namespace rmutr_report.Controllers ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - + row++; } @@ -2102,15 +2216,15 @@ namespace rmutr_report.Controllers row++; } - if (detail.is_footer== true) + if (detail.is_footer == true) { ws.Cell(row, 14).Value = "ลงชื่อ"; - ws.Cell(row, 15).Value = revenue_estimate.author_name; + ws.Cell(row, 15).Value = revenue_estimate.author_name; ws.Cell(row, 17).Value = "ผู้จัดทำ"; ws.Cell(row + r1, 14).Value = "ตำแหน่ง"; - ws.Cell(row+r1, 15).Value = revenue_estimate.position_name; - ws.Cell(row+r2, 14).Value = "เบอร์โทรติดต่อ"; - ws.Cell(row+r2, 15).Value = "'"+revenue_estimate.phone; + ws.Cell(row + r1, 15).Value = revenue_estimate.position_name; + ws.Cell(row + r2, 14).Value = "เบอร์โทรติดต่อ"; + ws.Cell(row + r2, 15).Value = "'" + revenue_estimate.phone; ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK"; ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 14; @@ -2118,30 +2232,30 @@ namespace rmutr_report.Controllers // ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Border.BottomBorder = XLBorderStyleValues.Dotted; ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row+1, 14).Style.Alignment.Horizontal = + ws.Cell(row + 1, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row+2, 14).Style.Alignment.Horizontal = + ws.Cell(row + 2, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row+1, 14).Style.Font.FontName = + ws.Cell(row + 1, 14).Style.Font.FontName = "TH SarabunPSK"; - ws.Cell(row+2, 14).Style.Font.FontName = + ws.Cell(row + 2, 14).Style.Font.FontName = "TH SarabunPSK"; - ws.Cell(row+1, 14).Style.Font.SetBold().Font.FontSize = 14; - ws.Cell(row+2, 14).Style.Font.SetBold().Font.FontSize = 14; + ws.Cell(row + 1, 14).Style.Font.SetBold().Font.FontSize = 14; + ws.Cell(row + 2, 14).Style.Font.SetBold().Font.FontSize = 14; ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.FontName = + ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; - ws.Cell(row+2, 15).Style.Font.FontName = + ws.Cell(row + 2, 15).Style.Font.FontName = "TH SarabunPSK"; ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14; - ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14; - ws.Cell(row+2, 15).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14; + ws.Cell(row + 2, 15).Style.Font.SetBold().Font.FontSize = 14; ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal = + ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Cell(row+2, 15).Style.Alignment.Horizontal = + ws.Cell(row + 2, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; // ws.Cell(row+3, 15).Style.Font.FontName = // "TH SarabunPSK"; @@ -2151,8 +2265,6 @@ namespace rmutr_report.Controllers row++; row += r1; row += r2; - - } } } @@ -2169,13 +2281,13 @@ namespace rmutr_report.Controllers "revenue_estimates_" + date + ".xlsx"); } } + [HttpPost, Route("reports/summary_budget_university/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetSumBudgetUniReport([FromRoute] string type, [FromBody] summary_budget_university summary) { - - var summaryBudget = new List() { summary}; + var summaryBudget = new List() { summary }; Report report = new Report(); report.Load(_setting.report_path + "summary_budget_university.frx"); @@ -2201,7 +2313,7 @@ namespace rmutr_report.Controllers return File( stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "summary_budget_university_"+date + ".xlsx"); + "summary_budget_university_" + date + ".xlsx"); } return Ok(); diff --git a/Models/budget/budget_expenditure_from_revenue.cs b/Models/budget/budget_expenditure_from_revenue.cs index 2d28497..ab38b1b 100644 --- a/Models/budget/budget_expenditure_from_revenue.cs +++ b/Models/budget/budget_expenditure_from_revenue.cs @@ -28,6 +28,9 @@ namespace rmutr_report.Models public DateTime? version { get; set; } public List budget_expenditure_from_revenue_details { get; set; } + // public t_budget_expenditure_from_revenue_detail[] budget_expenditure_from_revenue_details_2 { get; set; } + // public t_budget_expenditure_from_revenue_detail[] budget_expenditure_from_revenue_details_3 { get; set; } + public decimal? sum_1 { get; set; } public decimal? sum_2 { get; set; } public decimal? sum_3 { get; set; } @@ -81,12 +84,99 @@ namespace rmutr_report.Models public decimal? tuition_less_fee_per_student { get; set; } public decimal? education_fee_less_fee_total { get; set; } - - - public int? topic_type { get; set; } + public int? topic_type { get; set; } + public int? row { get; set; } public DateTime? version { get; set; } public Guid? semester_uid { get; set; } public Guid? academic_year_uid { get; set; } - public int? row { get; set; } + public Guid? couse_uid { get; set; } + public Guid? major_uid { get; set; } + } + + // public class t_budget_expenditure_from_revenue_detail_2 + // { + // public string topic { get; set; } + // public string topic_1 { get; set; } + // public string topic_2 { get; set; } + // public string academic_year_name_th { get; set; } + // public decimal? current_students { get; set; } + // public decimal? students_reduced { get; set; } + // public decimal? students_estimates { get; set; } + // public decimal? price_regis_flat_payment_per_student { get; set; } + // public decimal? price_regis_flat_payment { get; set; } + // public decimal? price_regis_flat_payment1 { get; set; } + // + // public decimal? library_per_student { get; set; } + // public decimal? library_total { get; set; } + // public decimal? library_total1 { get; set; } + // + // public decimal? utilities_per_student { get; set; } + // public decimal? utilities_total { get; set; } + // + // public decimal? student_club_per_student { get; set; } + // public decimal? student_club_library_total { get; set; } + // + // public decimal? accident_insurance_per_student { get; set; } + // public decimal? accident_insurance_total { get; set; } + // + // public decimal? academic_activities_per_student { get; set; } + // public decimal? academic_activities_total { get; set; } + // + // public decimal? examination_and_x_rays_per_student { get; set; } + // public decimal? examination_and_x_rays_total { get; set; } + // + // public decimal? tuition_fee_per_student { get; set; } + // public decimal? tuition_fee_total { get; set; } + // + // public decimal? tuition_less_fee_per_student { get; set; } + // public decimal? education_fee_less_fee_total { get; set; } + // + // + // public int? topic_type { get; set; } + // + // } + // + // public class t_budget_expenditure_from_revenue_detail_3 + // { + // public string topic { get; set; } + // public string topic_1 { get; set; } + // public string topic_2 { get; set; } + // public string academic_year_name_th { get; set; } + // public decimal? current_students { get; set; } + // public decimal? students_reduced { get; set; } + // public decimal? students_estimates { get; set; } + // public decimal? price_regis_flat_payment_per_student { get; set; } + // public decimal? price_regis_flat_payment { get; set; } + // public decimal? price_regis_flat_payment1 { get; set; } + // + // public decimal? library_per_student { get; set; } + // public decimal? library_total { get; set; } + // public decimal? library_total1 { get; set; } + // + // public decimal? utilities_per_student { get; set; } + // public decimal? utilities_total { get; set; } + // + // public decimal? student_club_per_student { get; set; } + // public decimal? student_club_library_total { get; set; } + // + // public decimal? accident_insurance_per_student { get; set; } + // public decimal? accident_insurance_total { get; set; } + // + // public decimal? academic_activities_per_student { get; set; } + // public decimal? academic_activities_total { get; set; } + // + // public decimal? examination_and_x_rays_per_student { get; set; } + // public decimal? examination_and_x_rays_total { get; set; } + // + // public decimal? tuition_fee_per_student { get; set; } + // public decimal? tuition_fee_total { get; set; } + // + // public decimal? tuition_less_fee_per_student { get; set; } + // public decimal? education_fee_less_fee_total { get; set; } + // + // + // public int? topic_type { 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 35de205..d83b9ad 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 97bdca5..c413bb4 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 35de205..d83b9ad 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 97bdca5..c413bb4 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/budget_expenditure_from_revenue.frx b/wwwroot/reports/budget_expenditure_from_revenue.frx index 6d1f813..2db879e 100644 --- a/wwwroot/reports/budget_expenditure_from_revenue.frx +++ b/wwwroot/reports/budget_expenditure_from_revenue.frx @@ -1,5 +1,5 @@  - + @@ -37,7 +37,7 @@ - +