diff --git a/Controllers/RoFive.Controller.cs b/Controllers/RoFive.Controller.cs index f344a31..a2e6394 100644 --- a/Controllers/RoFive.Controller.cs +++ b/Controllers/RoFive.Controller.cs @@ -899,9 +899,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 13)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 13)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("I4:M4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 13)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -938,9 +938,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 14)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 14)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:I4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("J4:N4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 14)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -977,9 +977,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 15)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:J4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("K4:O4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -1016,9 +1016,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 16)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 16)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:K4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("L4:P4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 16)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -1055,9 +1055,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 17)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 17)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:L4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("M4:Q4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 17)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -1094,9 +1094,9 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 18)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 18)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:M4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("N4:R4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 18)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); @@ -1133,15 +1133,406 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(4, 5), ws.Cell(8, 19)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(5, 5), ws.Cell(6, 19)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("D4:G4").Style.Border.OutsideBorder = + ws.Range("D4:N4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range("H4:L4").Style.Border.OutsideBorder = + ws.Range("O4:S4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); ws.Range(ws.Cell(5, 5), ws.Cell(6, 19)).Style.Border.RightBorder = XLBorderStyleValues.Thin; } + + if (a == 11) + { + ws.Range("D4:O4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("O5").Value = "รวม"; + ws.Cell("O6").Value = "( 1 )"; + ws.Cell("P5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("P6").Value = "( 2 )"; + ws.Cell("Q5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("Q6").Value = "( 3 )"; + ws.Cell("R5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("R6").Value = "(4)=(1)x(2)x150"; + ws.Cell("S5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("S6").Value = "(5)=(1)x(3)x200"; + ws.Cell("T5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("T6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("P5").Style.Alignment.SetTextRotation(90); + ws.Cell("Q5").Style.Alignment.SetTextRotation(90); + ws.Range("P4:T4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 20)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 20)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 20)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 20)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:O4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("P4:T4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 20)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 20)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 12) + { + ws.Range("D4:P4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("P5").Value = "รวม"; + ws.Cell("P6").Value = "( 1 )"; + ws.Cell("Q5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("Q6").Value = "( 2 )"; + ws.Cell("R5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("R6").Value = "( 3 )"; + ws.Cell("S5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("S6").Value = "(4)=(1)x(2)x150"; + ws.Cell("T5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("T6").Value = "(5)=(1)x(3)x200"; + ws.Cell("U5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("U6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("Q5").Style.Alignment.SetTextRotation(90); + ws.Cell("R5").Style.Alignment.SetTextRotation(90); + ws.Range("Q4:U4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 21)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 21)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 21)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 21)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:P4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("Q4:U4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 21)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 21)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 13) + { + ws.Range("D4:Q4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("Q5").Value = "รวม"; + ws.Cell("Q6").Value = "( 1 )"; + ws.Cell("R5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("R6").Value = "( 2 )"; + ws.Cell("S5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("S6").Value = "( 3 )"; + ws.Cell("T5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("T6").Value = "(4)=(1)x(2)x150"; + ws.Cell("U5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("U6").Value = "(5)=(1)x(3)x200"; + ws.Cell("V5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("V6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("Q5").Style.Alignment.SetTextRotation(90); + ws.Cell("R5").Style.Alignment.SetTextRotation(90); + ws.Range("R4:V4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 22)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 22)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 22)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 22)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:Q4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("R4:V4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 22)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 22)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 14) + { + ws.Range("D4:R4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("R5").Value = "รวม"; + ws.Cell("R6").Value = "( 1 )"; + ws.Cell("S5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("S6").Value = "( 2 )"; + ws.Cell("T5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("T6").Value = "( 3 )"; + ws.Cell("U5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("U6").Value = "(4)=(1)x(2)x150"; + ws.Cell("V5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("V6").Value = "(5)=(1)x(3)x200"; + ws.Cell("W5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("W6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("S5").Style.Alignment.SetTextRotation(90); + ws.Cell("T5").Style.Alignment.SetTextRotation(90); + ws.Range("S4:W4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 23)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 23)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 23)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:R4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("S4:W4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 23)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 23)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 15) + { + ws.Range("D4:S4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("S5").Value = "รวม"; + ws.Cell("S6").Value = "( 1 )"; + ws.Cell("T5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("T6").Value = "( 2 )"; + ws.Cell("U5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("U6").Value = "( 3 )"; + ws.Cell("V5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("V6").Value = "(4)=(1)x(2)x150"; + ws.Cell("W5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("W6").Value = "(5)=(1)x(3)x200"; + ws.Cell("X5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("X6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("T5").Style.Alignment.SetTextRotation(90); + ws.Cell("U5").Style.Alignment.SetTextRotation(90); + ws.Range("T4:X4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 24)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 24)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 24)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 24)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:S4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("T4:X4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 24)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 24)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 16) + { + ws.Range("D4:T4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("T5").Value = "รวม"; + ws.Cell("T6").Value = "( 1 )"; + ws.Cell("U5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("U6").Value = "( 2 )"; + ws.Cell("V5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("V6").Value = "( 3 )"; + ws.Cell("W5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("W6").Value = "(4)=(1)x(2)x150"; + ws.Cell("X5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("X6").Value = "(5)=(1)x(3)x200"; + ws.Cell("Y5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("Y6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("U5").Style.Alignment.SetTextRotation(90); + ws.Cell("V5").Style.Alignment.SetTextRotation(90); + ws.Range("U4:Y4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 25)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 25)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 25)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 25)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:T4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("U4:Y4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 25)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 25)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 17) + { + ws.Range("D4:U4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("U5").Value = "รวม"; + ws.Cell("U6").Value = "( 1 )"; + ws.Cell("V5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("V6").Value = "( 2 )"; + ws.Cell("W5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("W6").Value = "( 3 )"; + ws.Cell("X5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("X6").Value = "(4)=(1)x(2)x150"; + ws.Cell("Y5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("Y6").Value = "(5)=(1)x(3)x200"; + ws.Cell("Z5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("Z6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("U5").Style.Alignment.SetTextRotation(90); + ws.Cell("V5").Style.Alignment.SetTextRotation(90); + ws.Range("V4:Z4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 26)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 26)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 26)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 26)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 26)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:U4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("V4:Z4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 26)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 26)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 18) + { + ws.Range("D4:V4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("V5").Value = "รวม"; + ws.Cell("V6").Value = "( 1 )"; + ws.Cell("W5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("W6").Value = "( 2 )"; + ws.Cell("X5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("X6").Value = "( 3 )"; + ws.Cell("Y5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("Y6").Value = "(4)=(1)x(2)x150"; + ws.Cell("Z5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("Z6").Value = "(5)=(1)x(3)x200"; + ws.Cell("AA5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("AA6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("W5").Style.Alignment.SetTextRotation(90); + ws.Cell("X5").Style.Alignment.SetTextRotation(90); + ws.Range("W4:AA4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 27)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 27)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 27)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 27)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 27)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:V4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("W4:AA4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 27)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 27)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 19) + { + ws.Range("D4:W4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("W5").Value = "รวม"; + ws.Cell("W6").Value = "( 1 )"; + ws.Cell("X5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("X6").Value = "( 2 )"; + ws.Cell("Y5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("Y6").Value = "( 3 )"; + ws.Cell("Z5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("Z6").Value = "(4)=(1)x(2)x150"; + ws.Cell("AA5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("AA6").Value = "(5)=(1)x(3)x200"; + ws.Cell("AB5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("AB6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("X5").Style.Alignment.SetTextRotation(90); + ws.Cell("Y5").Style.Alignment.SetTextRotation(90); + ws.Range("X4:AB4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 28)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 28)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 28)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 28)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 28)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:W4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("X4:AB4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 28)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 28)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 20) + { + ws.Range("D4:X4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("X5").Value = "รวม"; + ws.Cell("X6").Value = "( 1 )"; + ws.Cell("Y5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("Y6").Value = "( 2 )"; + ws.Cell("Z5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("Z6").Value = "( 3 )"; + ws.Cell("AA5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("AA6").Value = "(4)=(1)x(2)x150"; + ws.Cell("AB5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("AB6").Value = "(5)=(1)x(3)x200"; + ws.Cell("AC5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("AC6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("Y5").Style.Alignment.SetTextRotation(90); + ws.Cell("Z5").Style.Alignment.SetTextRotation(90); + ws.Range("Y4:AC4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 29)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 29)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 29)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 29)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 29)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:X4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("Y4:AC4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 29)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 29)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + } } @@ -2406,6 +2797,1246 @@ namespace rmutr_report.Controllers XLBorderStyleValues.Thin; } } + if (a == 11) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 20)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 11).Value = header.total_credits; + ws.Cell(row, rowhead2 + 12).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 13).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 14).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 15).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 16).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 16)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 16)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 15).Value = header.total_credits; + ws.Cell(row, 16).Value = header.lecture_credits; + ws.Cell(row, 17).Value = header.practical_credits; + ws.Cell(row, 18).Value = header.total_lecture_credits; + ws.Cell(row, 19).Value = header.total_practical_credits; + ws.Cell(row, 20).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 20)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 20).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 20)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 20).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 20).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 20).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 19).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 20).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 20).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 20).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 12) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 21)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 12).Value = header.total_credits; + ws.Cell(row, rowhead2 + 13).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 14).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 15).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 16).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 17).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 17)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 17)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 16).Value = header.total_credits; + ws.Cell(row, 17).Value = header.lecture_credits; + ws.Cell(row, 18).Value = header.practical_credits; + ws.Cell(row, 19).Value = header.total_lecture_credits; + ws.Cell(row, 20).Value = header.total_practical_credits; + ws.Cell(row, 21).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 21)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 21).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 21)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 21).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 21).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 21).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 21).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 21).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 21).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 21).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 13) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 22)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 13).Value = header.total_credits; + ws.Cell(row, rowhead2 + 14).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 15).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 16).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 17).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 18).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 18)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 18)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 17).Value = header.total_credits; + ws.Cell(row, 18).Value = header.lecture_credits; + ws.Cell(row, 19).Value = header.practical_credits; + ws.Cell(row, 20).Value = header.total_lecture_credits; + ws.Cell(row, 21).Value = header.total_practical_credits; + ws.Cell(row, 22).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 22)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 22).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 22)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 22).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 22).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 22).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 22).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 22).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 22).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 22).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 14) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 23)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 14).Value = header.total_credits; + ws.Cell(row, rowhead2 + 15).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 16).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 17).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 18).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 19).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 19)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 19)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 18).Value = header.total_credits; + ws.Cell(row, 19).Value = header.lecture_credits; + ws.Cell(row, 20).Value = header.practical_credits; + ws.Cell(row, 21).Value = header.total_lecture_credits; + ws.Cell(row, 22).Value = header.total_practical_credits; + ws.Cell(row, 23).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 23)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 23).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 23)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 23).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 23).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 23).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 23).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 23).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 23).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 23).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 15) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 24)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 15).Value = header.total_credits; + ws.Cell(row, rowhead2 + 16).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 17).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 18).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 19).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 20).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 20)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 20)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 19).Value = header.total_credits; + ws.Cell(row, 20).Value = header.lecture_credits; + ws.Cell(row, 21).Value = header.practical_credits; + ws.Cell(row, 22).Value = header.total_lecture_credits; + ws.Cell(row, 23).Value = header.total_practical_credits; + ws.Cell(row, 24).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 24)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 24).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 24)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 24).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 24).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 24).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 24).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 24).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 24).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 24).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 16) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 25)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 16).Value = header.total_credits; + ws.Cell(row, rowhead2 + 17).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 18).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 19).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 20).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 21).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 21)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 21)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 21)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 21)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 21)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 21)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 20)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 20).Value = header.total_credits; + ws.Cell(row, 21).Value = header.lecture_credits; + ws.Cell(row, 22).Value = header.practical_credits; + ws.Cell(row, 23).Value = header.total_lecture_credits; + ws.Cell(row, 24).Value = header.total_practical_credits; + ws.Cell(row, 25).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 25)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 25).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 25)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 25).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 25).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 25).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 25).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 25).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 25).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 25).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 17) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 26)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 17).Value = header.total_credits; + ws.Cell(row, rowhead2 + 18).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 19).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 20).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 21).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 22).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 22)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 22)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 22)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 21).Value = header.total_credits; + ws.Cell(row, 22).Value = header.lecture_credits; + ws.Cell(row, 23).Value = header.practical_credits; + ws.Cell(row, 24).Value = header.total_lecture_credits; + ws.Cell(row, 25).Value = header.total_practical_credits; + ws.Cell(row, 26).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 26)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 26).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 26)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 26).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 26).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 26).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 26).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 26).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 26).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 26).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 18) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 27)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 18).Value = header.total_credits; + ws.Cell(row, rowhead2 + 19).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 20).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 21).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 22).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 23).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 23)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 23)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 23)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 22).Value = header.total_credits; + ws.Cell(row, 23).Value = header.lecture_credits; + ws.Cell(row, 24).Value = header.practical_credits; + ws.Cell(row, 25).Value = header.total_lecture_credits; + ws.Cell(row, 26).Value = header.total_practical_credits; + ws.Cell(row, 27).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 27)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 27).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 27)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 27).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 27).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 27).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 27).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 27).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 27).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 27).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 19) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 28)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 19).Value = header.total_credits; + ws.Cell(row, rowhead2 + 20).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 21).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 22).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 23).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 24).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 24)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 24)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 24)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 23).Value = header.total_credits; + ws.Cell(row, 24).Value = header.lecture_credits; + ws.Cell(row, 25).Value = header.practical_credits; + ws.Cell(row, 26).Value = header.total_lecture_credits; + ws.Cell(row, 27).Value = header.total_practical_credits; + ws.Cell(row, 28).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 28)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 28).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 28)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 28).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 28).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 28).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 27).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 28).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 28).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 28).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + if (a == 20) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 29)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + + row++; + } + + if (header.topic_type == 2) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class; + ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code; + ws.Cell(row, rowhead2 + 20).Value = header.total_credits; + ws.Cell(row, rowhead2 + 21).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 22).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 23).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 24).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 25).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 25)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 25)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 25)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 3) + { + ws.Cell(row, 1).Value = no; + no++; + ws.Cell(row, 2).Value = header.topic_code; + ws.Cell(row, 3).Value = header.topic; + foreach (var i in header.majors) + { + ws.Cell(row, rowhead2).Value = i.credits; + ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK"; + ws.Cell(row, rowhead2).Style.Font.FontSize = 16; + ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + rowhead2++; + } + + ws.Cell(row, 24).Value = header.total_credits; + ws.Cell(row, 25).Value = header.lecture_credits; + ws.Cell(row, 26).Value = header.practical_credits; + ws.Cell(row, 27).Value = header.total_lecture_credits; + ws.Cell(row, 28).Value = header.total_practical_credits; + ws.Cell(row, 29).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 29)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 4) //รวมระดับชั้น + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level; + ws.Cell(row, 29).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 29)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 29).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 29)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 29).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 29).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 28)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 29).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 29)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 29).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 29).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 29).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } } using (var stream = new MemoryStream())