From bbfcaa088e4e382a7ec79cd70767d7d68887798d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nut=2E=E0=B9=84=E0=B8=9B=E0=B9=80=E0=B8=A3=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=A2?= Date: Wed, 26 Aug 2026 19:15:26 +0700 Subject: [PATCH] feat(kpi): render vision/values/uniqueness/identity indicator sections in budget policy Excel export Mirrors the existing indicator table layout for the 4 new reference sections coming from rmutr-api (unit, target value, 3 responsible-role columns), reusing the same 8-column styling as the strategic indicators. --- Controllers/KPI.Controller.cs | 44 +++++++++++++++++++++++++++++++++-- Models/budget/kpi.cs | 15 ++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/Controllers/KPI.Controller.cs b/Controllers/KPI.Controller.cs index a067643..75cb019 100644 --- a/Controllers/KPI.Controller.cs +++ b/Controllers/KPI.Controller.cs @@ -269,10 +269,13 @@ namespace rmutr_report.Controllers } //row++; } + + WriteReferenceHeaders(ws, _kpi.vision_data, ref row, ref rowno); + WriteReferenceHeaders(ws, _kpi.popularity_data, ref row, ref rowno); + WriteReferenceHeaders(ws, _kpi.uniqueness_data, ref row, ref rowno); + WriteReferenceHeaders(ws, _kpi.identity_data, ref row, ref rowno); } - - //} // } @@ -287,6 +290,43 @@ namespace rmutr_report.Controllers "kpi_" + date + ".xlsx"); } } + + private void WriteReferenceHeaders(IXLWorksheet ws, List headers, ref int row, ref int rowno) + { + if (headers == null) return; + foreach (var header in headers) + { + if (!string.IsNullOrEmpty(header.header_1)) + { + ws.Cell(row, 1).Value = header.header_1; + ws.Cell(row, 1).Style.Font.Bold = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Merge().Style.Fill.BackgroundColor = XLColor.Bisque; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + row++; + } + foreach (var data1 in header.data_detail ?? new List()) + { + ws.Cell(row, 2).Value = rowno; + ws.Cell(row, 3).Value = data1.name; + ws.Cell(row, 4).Value = data1.unit; + ws.Cell(row, 5).Value = data1.value; + ws.Cell(row, 6).Value = data1.responsible_person; + ws.Cell(row, 7).Value = data1.responsible_work; + ws.Cell(row, 8).Value = data1.collector; + for (var c = 1; c <= 8; c++) + { + ws.Cell(row, c).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, c).Style.Border.LeftBorder = XLBorderStyleValues.Thin; + ws.Cell(row, c).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, c).Style.Alignment.WrapText = true; + } + row++; + rowno++; + } + } + } + [HttpPost, Route("reports/kpi_performance_expenditure_budget/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetKpiBudgetReport([FromRoute] string type, [FromBody] kpi_performance_expenditure_budget kpiPerformance) diff --git a/Models/budget/kpi.cs b/Models/budget/kpi.cs index 7dea266..d69d4cf 100644 --- a/Models/budget/kpi.cs +++ b/Models/budget/kpi.cs @@ -5,9 +5,20 @@ namespace rmutr_report.Models public class kpi { public string academic_year { get; set; } - + public List header_data { get; set; } - + + public List vision_data { get; set; } + public List popularity_data { get; set; } + public List uniqueness_data { get; set; } + public List identity_data { get; set; } + + } + + public class kpi_reference_header + { + public string header_1 { get; set; } + public List data_detail { get; set; } } public class kpi_data_detail