feat(kpi): render vision/values/uniqueness/identity indicator sections in budget policy Excel export
continuous-integration/drone/push Build is passing

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.
This commit is contained in:
Nut.ไปเรื่อย
2026-08-26 19:15:26 +07:00
parent e2fcd26b8f
commit bbfcaa088e
2 changed files with 55 additions and 4 deletions
+42 -2
View File
@@ -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<kpi_reference_header> 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<kpi_data_details2>())
{
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)