From 6b10902a303d320ac21356fd4f1d1e2759f28c8d Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Sun, 19 Feb 2023 13:08:23 +0700 Subject: [PATCH] bug fixed --- Controllers/DetailKpiFinance.Controller.cs | 140 ++++++++++++++++-- Controllers/Detail_Kpi.Controller.cs | 14 +- .../kpi_performance_finance.Controller.cs | 2 +- Models/budget/kpi_performance_finance.cs | 2 +- 4 files changed, 135 insertions(+), 23 deletions(-) diff --git a/Controllers/DetailKpiFinance.Controller.cs b/Controllers/DetailKpiFinance.Controller.cs index 8ee0d26..d0832c6 100644 --- a/Controllers/DetailKpiFinance.Controller.cs +++ b/Controllers/DetailKpiFinance.Controller.cs @@ -63,6 +63,7 @@ namespace rmutr_report.Controllers ws.Range("G2:G3").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" มหาวิทยาลัย"; ws.Range("G2:G3").Style.Font.Bold = true; ws.Range("G2:G3").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("G2:G3").Style.Alignment.WrapText = true; // ws.Range("H2:W2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; // ws.Range("H2:W2").Style.Font.Bold = true; // ws.Range("H2:H3").Style.Border.RightBorder = XLBorderStyleValues.Thin; @@ -328,7 +329,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==10) + if (a==11) { ws.Range("H2:R2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -343,7 +344,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==11) + if (a==12) { ws.Range("H2:S2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -358,7 +359,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==12) + if (a==13) { ws.Range("H2:T2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -373,7 +374,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==13) + if (a==14) { ws.Range("H2:U2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -388,7 +389,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==14) + if (a==15) { ws.Range("H2:V2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -403,7 +404,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - if (a==15) + if (a==16) { ws.Range("H2:W2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -418,7 +419,74 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; } - + if (a==17) + { + ws.Range("H2:X2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; + ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H2").Style.Font.FontName = "TH Sarabun New"; + ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("X2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("X2").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell("X4").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("H2:X2").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Range("A1:X1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ทางการเงิน พ.ศ. " + _kpi.year_range+" มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์ ประจำปีงบประมาณ พ.ศ. "+_kpi.budget_year; + ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + + } + if (a==18) + { + ws.Range("H2:Y2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; + ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H2").Style.Font.FontName = "TH Sarabun New"; + ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("Y2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("Y2").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell("Y4").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("H2:Y2").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Range("A1:Y1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ทางการเงิน พ.ศ. " + _kpi.year_range+" มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์ ประจำปีงบประมาณ พ.ศ. "+_kpi.budget_year; + ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + + } + if (a==19) + { + ws.Range("H2:Z2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; + ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H2").Style.Font.FontName = "TH Sarabun New"; + ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("Z2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("Z2").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell("Z4").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("H2:Z2").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Range("A1:Z1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ทางการเงิน พ.ศ. " + _kpi.year_range+" มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์ ประจำปีงบประมาณ พ.ศ. "+_kpi.budget_year; + ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + + } + if (a==20) + { + ws.Range("H2:AA2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; + ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H2").Style.Font.FontName = "TH Sarabun New"; + ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("AA2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("AA2").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell("AA4").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("H2:AA2").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Range("A1:AA1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ทางการเงิน พ.ศ. " + _kpi.year_range+" มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์ ประจำปีงบประมาณ พ.ศ. "+_kpi.budget_year; + ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + + } } foreach (var header in _kpi.header_data) { @@ -609,9 +677,53 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Merge().Style.Fill.BackgroundColor = XLColor.Bisque; } + if (a==17) + { + + string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; + no++; + ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; + ws.Cell(row, 1).Style.Border.OutsideBorder = + XLBorderStyleValues.None; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Merge().Style.Fill.BackgroundColor = + XLColor.Bisque; + } + if (a==18) + { + + string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; + no++; + ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; + ws.Cell(row, 1).Style.Border.OutsideBorder = + XLBorderStyleValues.None; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Merge().Style.Fill.BackgroundColor = + XLColor.Bisque; + } + if (a==19) + { + + string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; + no++; + ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; + ws.Cell(row, 1).Style.Border.OutsideBorder = + XLBorderStyleValues.None; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Merge().Style.Fill.BackgroundColor = + XLColor.Bisque; + } + if (a==20) + { + + string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues; + no++; + ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true; + ws.Cell(row, 1).Style.Border.OutsideBorder = + XLBorderStyleValues.None; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Merge().Style.Fill.BackgroundColor = + XLColor.Bisque; + } ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; - ws.Cell(row,23).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row,26).Style.Border.RightBorder = XLBorderStyleValues.Thin; row++; foreach (var data1 in header.data) { @@ -633,9 +745,9 @@ namespace rmutr_report.Controllers ws.Cell(row,col2).Style.Font.FontSize = 16; col2++; } - ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; - ws.Range(ws.Cell(row,8),ws.Cell(row,23)).Style.Alignment.SetTextRotation(90); + ws.Range(ws.Cell(row, 1),ws.Cell(row,26)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 1),ws.Cell(row,26)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row,8),ws.Cell(row,26)).Style.Alignment.SetTextRotation(90); ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Cell(row, 1).Style.Border.LeftBorder = XLBorderStyleValues.Thin; @@ -662,10 +774,10 @@ namespace rmutr_report.Controllers // ws.Cell(row, 21).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; // ws.Cell(row, 22).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; // ws.Cell(row, 23).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1),ws.Cell(row,26)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Font.FontName = "TH Sarabun New"; - ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Font.FontSize = 16; + ws.Range(ws.Cell(row, 1),ws.Cell(row,26)).Style.Font.FontName = "TH Sarabun New"; + ws.Range(ws.Cell(row, 1),ws.Cell(row,26)).Style.Font.FontSize = 16; row++; rowno++; col++; diff --git a/Controllers/Detail_Kpi.Controller.cs b/Controllers/Detail_Kpi.Controller.cs index 7bdcc53..68f2e19 100644 --- a/Controllers/Detail_Kpi.Controller.cs +++ b/Controllers/Detail_Kpi.Controller.cs @@ -184,7 +184,7 @@ namespace rmutr_report.Controllers ws.Cell(rowhead,col).Style.Font.FontSize = 16; col++; var a = _kpi.agencys.Count; - + if (a==1) { ws.Range("H2").Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; @@ -326,7 +326,7 @@ namespace rmutr_report.Controllers ws.Range("A1:Q1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==10) + if (a==11) { ws.Range("H2:R2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -340,7 +340,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A1:R1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==11) + if (a==12) { ws.Range("H2:S2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -354,7 +354,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A1:S1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==12) + if (a==13) { ws.Range("H2:T2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -368,7 +368,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A1:T1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==13) + if (a==14) { ws.Range("H2:U2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -382,7 +382,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A1:U1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==14) + if (a==15) { ws.Range("H2:V2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -396,7 +396,7 @@ namespace rmutr_report.Controllers ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A1:V1").Style.Fill.BackgroundColor = XLColor.Yellow; } - if (a==15) + if (a==16) { ws.Range("H2:W2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน"; ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; diff --git a/Controllers/kpi_performance_finance.Controller.cs b/Controllers/kpi_performance_finance.Controller.cs index 262ec5e..532c154 100644 --- a/Controllers/kpi_performance_finance.Controller.cs +++ b/Controllers/kpi_performance_finance.Controller.cs @@ -145,7 +145,7 @@ namespace rmutr_report.Controllers ws.Cell(row, 4).Value = data1.director; ws.Cell(row, 5).Value = data1.responsible_person; ws.Cell(row, 6).Value = data1.compiler_reporter; - ws.Cell(row, 7).Value = data1.value; + ws.Cell(row, 7).Value = data1.plan_value; ws.Cell(row, 8).Value = data1.result; ws.Cell(row, 9).Value = data1.achieve; ws.Cell(row, 10).Value = data1.note; diff --git a/Models/budget/kpi_performance_finance.cs b/Models/budget/kpi_performance_finance.cs index 0ce86c3..870b0bb 100644 --- a/Models/budget/kpi_performance_finance.cs +++ b/Models/budget/kpi_performance_finance.cs @@ -22,7 +22,7 @@ namespace rmutr_report.Models public string director { get; set; } public string responsible_person { get; set; } public string compiler_reporter { get; set; } - public decimal? value { get; set; } + public decimal? plan_value { get; set; } public decimal? result { get; set; } public string achieve { get; set; } public string note { get; set; }