diff --git a/Controllers/RoFive.Controller.cs b/Controllers/RoFive.Controller.cs index caac32b..f344a31 100644 --- a/Controllers/RoFive.Controller.cs +++ b/Controllers/RoFive.Controller.cs @@ -650,7 +650,7 @@ namespace rmutr_report.Controllers [FromBody] revenue_estimate_register_credits revenueEstimate) { var workbook = new XLWorkbook(); - var ws = workbook.Worksheets.Add("detailkpi"); + var ws = workbook.Worksheets.Add("ร.12"); ws.Range("A1:R1").Merge().Value = "งบประมาณรายจ่ายจากเงินรายได้ ประจำปีงบประมาณ พ.ศ. " + revenueEstimate.budget_year; ws.Range("A1:R1").Style.Font.FontName = "TH SarabunPSK"; @@ -683,60 +683,71 @@ namespace rmutr_report.Controllers ws.Range("A4:A6").Style.Font.FontName = "TH SarabunPSK"; ws.Range("A4:A6").Style.Font.SetBold().Font.FontSize = 16; ws.Range("A4:A6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("A4:A6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Range("A4:A6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range("B4:B6").Merge().Value = "รหัสวิชา"; ws.Range("B4:B6").Style.Font.SetBold().Font.FontSize = 16; ws.Range("B4:B6").Style.Font.FontName = "TH SarabunPSK"; ws.Range("B4:B6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("B4:B6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("B4:B6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("C4:C6").Merge().Value = "ชื่อรายวิชา"; ws.Range("C4:C6").Style.Font.SetBold().Font.FontSize = 16; ws.Range("C4:C6").Style.Font.FontName = "TH SarabunPSK"; ws.Range("C4:C6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("C4:C6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("C4:C6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Column(1).Width = 10; ws.Column(2).Width = 15; ws.Column(3).Width = 30; - ws.Column(4).Width = 10; - ws.Column(5).Width = 10; - ws.Column(6).Width = 10; - ws.Column(7).Width = 10; - ws.Column(8).Width = 10; - ws.Column(9).Width = 10; - ws.Column(10).Width = 10; - ws.Column(11).Width = 10; - ws.Column(12).Width = 10; - ws.Column(13).Width = 10; - ws.Column(15).Width = 10; - ws.Column(16).Width = 10; - ws.Column(17).Width = 10; - ws.Column(18).Width = 10; - ws.Column(19).Width = 10; - ws.Column(20).Width = 10; - ws.Column(21).Width = 10; - ws.Column(22).Width = 10; - ws.Column(23).Width = 10; + // ws.Column(4).Width = 10; + // ws.Column(5).Width = 10; + // ws.Column(6).Width = 10; + // ws.Column(7).Width = 10; + // ws.Column(8).Width = 10; + // ws.Column(9).Width = 10; + // ws.Column(10).Width = 10; + // ws.Column(11).Width = 10; + // ws.Column(12).Width = 10; + // ws.Column(13).Width = 10; + // ws.Column(15).Width = 10; + // ws.Column(16).Width = 10; + // ws.Column(17).Width = 10; + // ws.Column(18).Width = 10; + // ws.Column(19).Width = 10; + // ws.Column(20).Width = 10; + // ws.Column(21).Width = 10; + // ws.Column(22).Width = 10; + // ws.Column(23).Width = 10; + // ws.Column(24).Width = 10; + // ws.Column(25).Width = 10; + // ws.Column(26).Width = 10; + // ws.Column(27).Width = 10; + // ws.Column(28).Width = 10; + // ws.Column(29).Width = 10; + // ws.Column(30).Width = 10; + ws.Columns("D", "AE").AdjustToContents(); + int col = 4; int rowhead = 5; int row = 7; - + int no = 1; if (revenueEstimate != null) - { - + { foreach (var i in revenueEstimate.majors) { - //ws.Cell(rowhead, col).Value = i.major_name; - ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead+1, col)).Merge().Value = i.major_name; + ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead + 1, col)).Merge().Value = i.major_name; ws.Cell(rowhead, col).Style.Alignment.SetTextRotation(90); ws.Cell(rowhead, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(rowhead, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell(rowhead, col).Style.Border.RightBorder = XLBorderStyleValues.Thin; ws.Cell(rowhead, col).Style.Font.FontName = "TH SarabunPSK"; ws.Cell(rowhead, col).Style.Font.FontSize = 16; - ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead+1, col)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead + 1, col)).Style.Alignment.WrapText = true; col++; var a = revenueEstimate.majors.Count; @@ -775,7 +786,7 @@ namespace rmutr_report.Controllers XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 10)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); - + ws.Range(ws.Cell(5, 5), ws.Cell(6, 10)).Style.Border.RightBorder = XLBorderStyleValues.Thin; // ws.Cell("D4").Style.Border.RightBorder = XLBorderStyleValues.Thin; // ws.Cell("D4").Style.Border.TopBorder = XLBorderStyleValues.Thin; @@ -816,241 +827,1586 @@ namespace rmutr_report.Controllers XLBorderStyleValues.Thin; ws.Range(ws.Cell(4, 4), ws.Cell(4, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180); - + ws.Range(ws.Cell(5, 5), ws.Cell(6, 11)).Style.Border.RightBorder = XLBorderStyleValues.Thin; } + + if (a == 3) + { + ws.Range("D4:G4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("G5").Value = "รวม"; + ws.Cell("G6").Value = "( 1 )"; + ws.Cell("H5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("H6").Value = "( 2 )"; + ws.Cell("I5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("I6").Value = "( 3 )"; + ws.Cell("J5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("J6").Value = "(4)=(1)x(2)x150"; + ws.Cell("K5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("K6").Value = "(5)=(1)x(3)x200"; + ws.Cell("L5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("L6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("H5").Style.Alignment.SetTextRotation(90); + ws.Cell("I5").Style.Alignment.SetTextRotation(90); + ws.Range("H4:L4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(4, 5), ws.Cell(8, 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(5, 5), ws.Cell(6, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("D4:G4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 12)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 12)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 4) + { + ws.Range("D4:H4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("H5").Value = "รวม"; + ws.Cell("H6").Value = "( 1 )"; + ws.Cell("I5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("I6").Value = "( 2 )"; + ws.Cell("J5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("J6").Value = "( 3 )"; + ws.Cell("K5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("K6").Value = "(4)=(1)x(2)x150"; + ws.Cell("L5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("L6").Value = "(5)=(1)x(3)x200"; + ws.Cell("M5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("M6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("I5").Style.Alignment.SetTextRotation(90); + ws.Cell("J5").Style.Alignment.SetTextRotation(90); + ws.Range("I4:M4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 13)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 13)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 5) + { + ws.Range("D4:I4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("I5").Value = "รวม"; + ws.Cell("I6").Value = "( 1 )"; + ws.Cell("J5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("J6").Value = "( 2 )"; + ws.Cell("K5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("K6").Value = "( 3 )"; + ws.Cell("L5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("L6").Value = "(4)=(1)x(2)x150"; + ws.Cell("M5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("M6").Value = "(5)=(1)x(3)x200"; + ws.Cell("N5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("N6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("J5").Style.Alignment.SetTextRotation(90); + ws.Cell("K5").Style.Alignment.SetTextRotation(90); + ws.Range("J4:N4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 14)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 14)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 6) + { + ws.Range("D4:J4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("J5").Value = "รวม"; + ws.Cell("J6").Value = "( 1 )"; + ws.Cell("K5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("K6").Value = "( 2 )"; + ws.Cell("L5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("L6").Value = "( 3 )"; + ws.Cell("M5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("M6").Value = "(4)=(1)x(2)x150"; + ws.Cell("N5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("N6").Value = "(5)=(1)x(3)x200"; + ws.Cell("O5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("O6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("K5").Style.Alignment.SetTextRotation(90); + ws.Cell("L5").Style.Alignment.SetTextRotation(90); + ws.Range("K4:O4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 15)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 15)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 7) + { + ws.Range("D4:K4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("K5").Value = "รวม"; + ws.Cell("K6").Value = "( 1 )"; + ws.Cell("L5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("L6").Value = "( 2 )"; + ws.Cell("M5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("M6").Value = "( 3 )"; + ws.Cell("N5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("N6").Value = "(4)=(1)x(2)x150"; + ws.Cell("O5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("O6").Value = "(5)=(1)x(3)x200"; + ws.Cell("P5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("P6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("L5").Style.Alignment.SetTextRotation(90); + ws.Cell("M5").Style.Alignment.SetTextRotation(90); + ws.Range("L4:P4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 16)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 16)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 8) + { + ws.Range("D4:L4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("L5").Value = "รวม"; + ws.Cell("L6").Value = "( 1 )"; + ws.Cell("M5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("M6").Value = "( 2 )"; + ws.Cell("N5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("N6").Value = "( 3 )"; + ws.Cell("O5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("O6").Value = "(4)=(1)x(2)x150"; + ws.Cell("P5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("P6").Value = "(5)=(1)x(3)x200"; + ws.Cell("Q5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("Q6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("M5").Style.Alignment.SetTextRotation(90); + ws.Cell("Q5").Style.Alignment.SetTextRotation(90); + ws.Range("M4:Q4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 17)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 17)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 9) + { + ws.Range("D4:M4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("M5").Value = "รวม"; + ws.Cell("M6").Value = "( 1 )"; + ws.Cell("N5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("N6").Value = "( 2 )"; + ws.Cell("O5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("O6").Value = "( 3 )"; + ws.Cell("P5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("P6").Value = "(4)=(1)x(2)x150"; + ws.Cell("Q5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("Q6").Value = "(5)=(1)x(3)x200"; + ws.Cell("R5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("R6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("N5").Style.Alignment.SetTextRotation(90); + ws.Cell("O5").Style.Alignment.SetTextRotation(90); + ws.Range("N4:R4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 4), ws.Cell(4, 18)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + + ws.Range(ws.Cell(5, 5), ws.Cell(6, 18)).Style.Border.RightBorder = XLBorderStyleValues.Thin; + } + + if (a == 10) + { + ws.Range("D4:N4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน"; + + ws.Cell("N5").Value = "รวม"; + ws.Cell("N6").Value = "( 1 )"; + ws.Cell("O5").Value = "จำนวนหน่วยกิตบรรยาย"; + ws.Cell("O6").Value = "( 2 )"; + ws.Cell("P5").Value = "จำนวนหน่วยกิตปฏิบัติ"; + ws.Cell("P6").Value = "( 3 )"; + ws.Cell("Q5").Value = "รวมค่าหน่วยกิตบรรยาย"; + ws.Cell("Q6").Value = "(4)=(1)x(2)x150"; + ws.Cell("R5").Value = "รวมค่าหน่วยกิตปฏิบัติ"; + ws.Cell("R6").Value = "(5)=(1)x(3)x200"; + ws.Cell("S5").Value = "รวมเงินค่าลงทะเบียนเรียน"; + ws.Cell("S6").Value = "( 6 )=( 4 )+( 5 )"; + ws.Cell("O5").Style.Alignment.SetTextRotation(90); + ws.Cell("P5").Style.Alignment.SetTextRotation(90); + ws.Range("O4:S4").Merge().Merge().Value = + "ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Font.SetBold().Font.FontSize = 16; + 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 = + XLBorderStyleValues.Thin; + ws.Range("H4:L4").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; + } } } - // int col2 = 6; - foreach (var header in revenueEstimate.data) + foreach (var header in revenueEstimate.data) + { + var a = revenueEstimate.majors.Count; + int rowhead2 = 4; + + if (a == 1) { - var a = revenueEstimate.majors.Count; - int rowhead2 = 4; - int no = 1; - if (a == 1) + if (header.topic_type == 1) { - if (header.topic_type == 1) - { - ws.Range(ws.Cell(row, 3), ws.Cell(row, 10)).Merge().Value = header.education_level; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor = - XLColor.FromArgb(198, 224, 180); - - 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 + 1).Value = header.total_credits; - ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits; - ws.Cell(row, rowhead2 + 3).Value = header.practical_credits; - ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits; - ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits; - ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize = - 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Fill.BackgroundColor = - XLColor.FromArgb(255, 255, 153); - ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Center; - ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Right; - ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).Style.NumberFormat.SetFormat("#,#"); - ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Center; - 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, rowhead2 + 1).Value = header.total_credits; - ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits; - ws.Cell(row, rowhead2 + 3).Value = header.practical_credits; - ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits; - ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits; - ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize = - 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).Style.NumberFormat.SetFormat("#,#"); - - - row++; - } - if (header.topic_type == 4) //รวมระดับชั้น - { - ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม "+header.education_level; - ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor = - XLColor.FromArgb(198, 224, 180); - ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row, rowhead2 + 6).Style.NumberFormat.SetFormat("#,#"); - - row++; - } - if (header.topic_type == 5) //รวมรายรับ - { - ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Merge().Value = "รวมรายรับจากการจัดการศึกษาให้กับ "+revenueEstimate.faculty+ " " + - " ภาคเรียน "+ revenueEstimate.semester+" / "+revenueEstimate.year+ " "+ revenueEstimate.budget_project_name_th; - ws.Cell(row, 10).Value = revenueEstimate.total_income; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Cell(row, 10).Style.Fill.BackgroundColor = - XLColor.FromArgb(189, 215, 238); - ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#"); - - } - + ws.Range(ws.Cell(row, 3), ws.Cell(row, 10)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + row++; } - if (a == 2) + if (header.topic_type == 2) { - if (header.topic_type == 1) - { - ws.Range(ws.Cell(row, 3), ws.Cell(row, 11)).Merge().Value = header.education_level; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = - XLColor.FromArgb(198, 224, 180); - - 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 + 2).Value = header.total_credits; - ws.Cell(row, rowhead2 + 3).Value = header.lecture_credits; - ws.Cell(row, rowhead2 + 4).Value = header.practical_credits; - ws.Cell(row, rowhead2 + 5).Value = header.total_lecture_credits; - ws.Cell(row, rowhead2 + 6).Value = header.total_practical_credits; - ws.Cell(row, rowhead2 + 7).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.SetBold().Font.FontSize = - 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Fill.BackgroundColor = - XLColor.FromArgb(255, 255, 153); - ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 7)).Style.NumberFormat.SetFormat("#,#"); - ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Center; - 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, 6).Value = header.total_credits; - ws.Cell(row, 7).Value = header.lecture_credits; - ws.Cell(row, 8).Value = header.practical_credits; - ws.Cell(row, 9).Value = header.total_lecture_credits; - ws.Cell(row, 10).Value = header.total_practical_credits; - ws.Cell(row, 11).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); - - row++; - } - if (header.topic_type == 4) //รวมระดับชั้น - { - ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม "+header.education_level; - ws.Cell(row, rowhead2 + 7).Value = header.total_register_amount; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).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, 11)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = - XLColor.FromArgb(198, 224, 180); - ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); - ws.Cell(row, rowhead2 + 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - row++; - } - if (header.topic_type == 5) //รวมรายรับ - { - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Merge().Value = "รวมรายรับจากการจัดการศึกษาให้กับ "+revenueEstimate.faculty+ " " + - " ภาคเรียน "+ revenueEstimate.semester+" / "+revenueEstimate.year+ " "+ revenueEstimate.budget_project_name_th; - ws.Cell(row, 11).Value = revenueEstimate.total_income; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Cell(row, 10).Style.Fill.BackgroundColor = - XLColor.FromArgb(189, 215, 238); - ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - ws.Cell(row, 11).Style.NumberFormat.SetFormat("#,#"); - - } - - + 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 + 1).Value = header.total_credits; + ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 3).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).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 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).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, rowhead2 + 1).Value = header.total_credits; + ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 3).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).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, rowhead2 + 6).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, rowhead2 + 6).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, rowhead2 + 6).Style.Border.RightBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Merge().Value = "รวมรายรับจากการจัดการศึกษาให้กับ " + + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 10).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 10).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; } - - // row++; - // col++; } - //} + + if (a == 2) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 11)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.RightBorder = + 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 + 2).Value = header.total_credits; + ws.Cell(row, rowhead2 + 3).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 4).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 5).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 6).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 7).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 7)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 7)).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, 6).Value = header.total_credits; + ws.Cell(row, 7).Value = header.lecture_credits; + ws.Cell(row, 8).Value = header.practical_credits; + ws.Cell(row, 9).Value = header.total_lecture_credits; + ws.Cell(row, 10).Value = header.total_practical_credits; + ws.Cell(row, 11).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).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, rowhead2 + 7).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, rowhead2 + 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, rowhead2 + 7).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 11).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 11).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 3) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 12)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).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 + 3).Value = header.total_credits; + ws.Cell(row, rowhead2 + 4).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 5).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 6).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 7).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 8).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 8)).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 + 8)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).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, 7).Value = header.total_credits; + ws.Cell(row, 8).Value = header.lecture_credits; + ws.Cell(row, 9).Value = header.practical_credits; + ws.Cell(row, 10).Value = header.total_lecture_credits; + ws.Cell(row, 11).Value = header.total_practical_credits; + ws.Cell(row, 12).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).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, rowhead2 + 8).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, rowhead2 + 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 8)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 12).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 12).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 4) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 13)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).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 + 4).Value = header.total_credits; + ws.Cell(row, rowhead2 + 5).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 6).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 7).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 8).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 9).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 9)).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 + 9)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).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, 8).Value = header.total_credits; + ws.Cell(row, 9).Value = header.lecture_credits; + ws.Cell(row, 10).Value = header.practical_credits; + ws.Cell(row, 11).Value = header.total_lecture_credits; + ws.Cell(row, 12).Value = header.total_practical_credits; + ws.Cell(row, 13).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 13)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).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, 13).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).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, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 13)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 13).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 13).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 5) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 14)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).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 + 5).Value = header.total_credits; + ws.Cell(row, rowhead2 + 6).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 7).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 8).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 9).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 10).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 10)).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 + 10)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).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, 9).Value = header.total_credits; + ws.Cell(row, 10).Value = header.lecture_credits; + ws.Cell(row, 11).Value = header.practical_credits; + ws.Cell(row, 12).Value = header.total_lecture_credits; + ws.Cell(row, 13).Value = header.total_practical_credits; + ws.Cell(row, 14).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).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, 14).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).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, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 14).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 14).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 6) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 15)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).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 + 6).Value = header.total_credits; + ws.Cell(row, rowhead2 + 7).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 8).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 9).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 10).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 11).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 11)).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 + 11)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).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, 10).Value = header.total_credits; + ws.Cell(row, 11).Value = header.lecture_credits; + ws.Cell(row, 12).Value = header.practical_credits; + ws.Cell(row, 13).Value = header.total_lecture_credits; + ws.Cell(row, 14).Value = header.total_practical_credits; + ws.Cell(row, 15).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).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, 15).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).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, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 15).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 15).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 7) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 16)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).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 + 7).Value = header.total_credits; + ws.Cell(row, rowhead2 + 8).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 9).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 10).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 11).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 12).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 12)).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 + 12)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).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, 11).Value = header.total_credits; + ws.Cell(row, 12).Value = header.lecture_credits; + ws.Cell(row, 13).Value = header.practical_credits; + ws.Cell(row, 14).Value = header.total_lecture_credits; + ws.Cell(row, 15).Value = header.total_practical_credits; + ws.Cell(row, 16).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).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, 16).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).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, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 16).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 16).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 16).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 16).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 8) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 17)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).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 + 8).Value = header.total_credits; + ws.Cell(row, rowhead2 + 9).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 10).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 11).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 12).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 13).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 13)).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 + 13)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).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, 12).Value = header.total_credits; + ws.Cell(row, 13).Value = header.lecture_credits; + ws.Cell(row, 14).Value = header.practical_credits; + ws.Cell(row, 15).Value = header.total_lecture_credits; + ws.Cell(row, 16).Value = header.total_practical_credits; + ws.Cell(row, 17).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 17)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).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, 17).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).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, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 17)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 17).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 17).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 17).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 17).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 17).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 9) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 18)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).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 + 9).Value = header.total_credits; + ws.Cell(row, rowhead2 + 10).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 11).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 12).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 13).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 14).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 14)).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 + 14)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).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, 13).Value = header.total_credits; + ws.Cell(row, 14).Value = header.lecture_credits; + ws.Cell(row, 15).Value = header.practical_credits; + ws.Cell(row, 16).Value = header.total_lecture_credits; + ws.Cell(row, 17).Value = header.total_practical_credits; + ws.Cell(row, 18).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 18)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).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, 18).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).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, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 18)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 18).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 18).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 18).Style.Fill.BackgroundColor = + XLColor.FromArgb(189, 215, 238); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 18).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + + if (a == 10) + { + if (header.topic_type == 1) + { + ws.Range(ws.Cell(row, 3), ws.Cell(row, 19)).Merge().Value = header.education_level; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).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 + 10).Value = header.total_credits; + ws.Cell(row, rowhead2 + 11).Value = header.lecture_credits; + ws.Cell(row, rowhead2 + 12).Value = header.practical_credits; + ws.Cell(row, rowhead2 + 13).Value = header.total_lecture_credits; + ws.Cell(row, rowhead2 + 14).Value = header.total_practical_credits; + ws.Cell(row, rowhead2 + 15).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Font.SetBold().Font.FontSize = + 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Fill.BackgroundColor = + XLColor.FromArgb(255, 255, 153); + ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 15)).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 + 15)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).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, 14).Value = header.total_credits; + ws.Cell(row, 15).Value = header.lecture_credits; + ws.Cell(row, 16).Value = header.practical_credits; + ws.Cell(row, 17).Value = header.total_lecture_credits; + ws.Cell(row, 18).Value = header.total_practical_credits; + ws.Cell(row, 19).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 4), ws.Cell(row, 19)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).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, 19).Value = header.total_register_amount; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).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, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = + XLColor.FromArgb(198, 224, 180); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 19)).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 3), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 19).Style.Border.LeftBorder = + XLBorderStyleValues.Thin; + row++; + } + + if (header.topic_type == 5) //รวมรายรับ + { + ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Merge().Value = + "รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " + + " ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " + + revenueEstimate.budget_project_name_th; + ws.Cell(row, 19).Value = revenueEstimate.total_income; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).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, 19)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Center; + ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 19).Style.NumberFormat.SetFormat("#,#"); + ws.Cell(row, 19).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + } + } + } using (var stream = new MemoryStream()) { diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index c854f87..8a93bdc 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.dll and b/bin/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.pdb b/bin/Debug/netcoreapp3.1/rmutr_report.pdb index 58589af..1359315 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.pdb and b/bin/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index c854f87..8a93bdc 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.dll and b/obj/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.pdb b/obj/Debug/netcoreapp3.1/rmutr_report.pdb index 58589af..1359315 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ