diff --git a/Controllers/Detail_Kpi.Controller.cs b/Controllers/Detail_Kpi.Controller.cs index e715a64..41fd6e4 100644 --- a/Controllers/Detail_Kpi.Controller.cs +++ b/Controllers/Detail_Kpi.Controller.cs @@ -500,8 +500,8 @@ namespace rmutr_report.Controllers ws.Range("A4:H4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:H4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("H4:H5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -516,8 +516,8 @@ namespace rmutr_report.Controllers ws.Range("A4:I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:I4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("I4:I5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -532,8 +532,8 @@ namespace rmutr_report.Controllers ws.Range("A4:J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:J4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("J4:J5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -548,8 +548,8 @@ namespace rmutr_report.Controllers ws.Range("A4:K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:K4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("K4:K5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -564,8 +564,8 @@ namespace rmutr_report.Controllers ws.Range("A4:L4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:L4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("L4:L5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -580,8 +580,8 @@ namespace rmutr_report.Controllers ws.Range("A4:M4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:M4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("M4:M5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -596,8 +596,8 @@ namespace rmutr_report.Controllers ws.Range("A4:N4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:N4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("N4:N5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -612,8 +612,8 @@ namespace rmutr_report.Controllers ws.Range("A4:O4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:O4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("O4:O5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -628,8 +628,8 @@ namespace rmutr_report.Controllers ws.Range("A4:P4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:P4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("P4:P5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -644,8 +644,8 @@ namespace rmutr_report.Controllers ws.Range("A4:Q4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:Q4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("Q4:Q5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -660,8 +660,8 @@ namespace rmutr_report.Controllers ws.Range("A4:R4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:R4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("R4:R5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -676,8 +676,8 @@ namespace rmutr_report.Controllers ws.Range("A4:S4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:S4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("S4:S5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -692,8 +692,8 @@ namespace rmutr_report.Controllers ws.Range("A4:T4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:T4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("T4:T5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -708,8 +708,8 @@ namespace rmutr_report.Controllers ws.Range("A4:U4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:U4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("U4:U5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -724,8 +724,8 @@ namespace rmutr_report.Controllers ws.Range("A4:V4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:V4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("V4:V5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -740,8 +740,8 @@ namespace rmutr_report.Controllers ws.Range("A4:W4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:W4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("W4:W5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -756,8 +756,8 @@ namespace rmutr_report.Controllers ws.Range("A4:X4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:X4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("X4:X5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -772,8 +772,8 @@ namespace rmutr_report.Controllers ws.Range("A4:Y4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:Y4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("X4:Y5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -788,8 +788,8 @@ namespace rmutr_report.Controllers ws.Range("A4:Z4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:Z4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("X4:Z5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -804,8 +804,8 @@ namespace rmutr_report.Controllers ws.Range("A4:AA4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:AA4").Style.Fill.BackgroundColor = XLColor.PurpleX11; ws.Range("X4:AA5").Style.Border.RightBorder = XLBorderStyleValues.Thin; - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.None; @@ -818,7 +818,7 @@ namespace rmutr_report.Controllers // ws.Range("A4:W4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; // ws.Range("A4:W4").Style.Fill.BackgroundColor = XLColor.PurpleX11; // ws.Cell("W4").Style.Border.RightBorder = XLBorderStyleValues.Thin; - // string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; + // string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues); // no++; // ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; // ws.Cell(row, 1).Style.Border.OutsideBorder = diff --git a/Controllers/kpi_performance_result.Controller.cs b/Controllers/kpi_performance_result.Controller.cs index e6e1def..8199c0c 100644 --- a/Controllers/kpi_performance_result.Controller.cs +++ b/Controllers/kpi_performance_result.Controller.cs @@ -104,8 +104,8 @@ namespace rmutr_report.Controllers { foreach (var header in _kpi.header_data) { - string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no +" " + header.strategic_issues; - no++; + string kpiname = header.is_reference_section ? header.strategic_issues : ("ประเด็นยุทธ์ศาสตร์ที่ " + no +" " + header.strategic_issues); + if (!header.is_reference_section) no++; ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; // ws.Cell(row, 2).Value = header.header_1; ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.PurpleX11; diff --git a/Models/budget/detail_kpi.cs b/Models/budget/detail_kpi.cs index 4610b00..b7401be 100644 --- a/Models/budget/detail_kpi.cs +++ b/Models/budget/detail_kpi.cs @@ -31,6 +31,7 @@ namespace rmutr_report.Models { public string year_range { get; set; } public string strategic_issues { get; set;} + public bool is_reference_section { get; set; } //public string agency_name { get; set; } public List data { get; set; } } diff --git a/Models/budget/kpi_performance_results.cs b/Models/budget/kpi_performance_results.cs index 1b2a665..01f057e 100644 --- a/Models/budget/kpi_performance_results.cs +++ b/Models/budget/kpi_performance_results.cs @@ -14,6 +14,8 @@ namespace rmutr_report.Models { public string strategic_issues { get; set; } + public bool is_reference_section { get; set; } + public List data { get; set; } }