diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 7593eef..2d691d7 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using ClosedXML.Excel; using FastReport; using FastReport.Export.Csv; using FastReport.Export.Mht; @@ -11,6 +12,7 @@ using FastReport.Export.Pdf; using Microsoft.AspNetCore.Mvc; using rmutr_report.Models; using rmutr_report.Models.Hr; +using rmutr_report.Models.Personnel; using Swashbuckle.AspNetCore.Annotations; namespace rmutr_report.Controllers @@ -295,5 +297,1190 @@ namespace rmutr_report.Controllers return Ok(); } + [HttpPost, Route("reports/basic_plan/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBasicPlanReport([FromRoute] string type, + [FromBody] national_budget personnel) + { + var workbook = new XLWorkbook(); + var ws = workbook.Worksheets.Add("พื้นฐาน"); + ws.Cell("A1").Value = "งบประมาณแผ่นดิน ปีงบประมาณ พ.ศ. " + personnel.academic_year_name_th; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A1").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A1").Style.Font.FontSize = 16; + ws.Cell("A1").Style.Font.Bold = true; + + ws.Cell("A2").Value = personnel.agency_name_th; + ws.Cell("A2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A2").Style.Font.FontSize = 16; + ws.Cell("A2").Style.Font.Bold = true; + ws.Cell("F2").Value = "แผนพื้นฐาน"; + ws.Cell("F2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("F2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("F2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("F2").Style.Font.FontSize = 16; + ws.Cell("F2").Style.Font.Bold = true; + + //ws.Cell("K12").Style.NumberFormat.Format = "#,##0.0000"; + + ws.Column(1).Width = 30; + ws.Column(2).Width = 10; + ws.Column(3).Width = 10; + ws.Column(4).Width = 10; + ws.Column(5).Width = 10; + ws.Column(6).Width = 10; + ws.Column(7).Width = 10; + + int row = 6; + //int no = 1; + if (personnel != null) + { + ws.Range("A3:A5").Merge().Value = "งบรายจ่าย"; + ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("A3:A5").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("A3:A5").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("A3:A5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("B3:F3").Merge().Value = "งบประมาณ "+personnel.academic_year_name_th+" (เบื้องต้น)"; + ws.Range("B3:F3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("B3:F3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("B3:F3").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("B3:F3").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("B3:F3").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("B3:F3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("B4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " วิทย์"; + ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("B4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("B4").Style.Alignment.WrapText = true; + ws.Cell("B4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("B4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("C4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " สังคม"; + ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("C4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("C4").Style.Alignment.WrapText = true; + ws.Cell("C4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("D4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " บริการวิชาการ"; + ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("D4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("D4").Style.Alignment.WrapText = true; + ws.Cell("D4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("E4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " ทำนุบำรุง"; + ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("E4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("E4").Style.Alignment.WrapText = true; + ws.Cell("E4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("F4").Value = "งบประมาณปี " + personnel.academic_year_name_th.Substring(2, 2); + ws.Cell("F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("F4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("F4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("F4").Style.Alignment.WrapText = true; + ws.Cell("F4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("B4:F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 2), ws.Cell(4, 6)).Style.Alignment.WrapText = true; + ws.Cell(5, 2).Value = personnel.science; + ws.Cell(5, 3).Value = personnel.society; + ws.Cell(5, 4).Value = personnel.academic_service; + ws.Cell(5, 5).Value = personnel.nourish; + ws.Cell(5, 6).Value = personnel.budget; + ws.Cell(5, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Font.FontSize = 14; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.Font.FontColor = XLColor.Blue; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 6)).Style.NumberFormat.SetFormat("#,#"); + + foreach (var detail in personnel.national_budget_details) + { + if (detail.topic_type == 1) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, 5).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.budget; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + + if (detail.topic_type == 2) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, 5).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.budget; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,204,153); + row++; + } + if (detail.topic_type == 3) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, 5).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.budget; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 4) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, 5).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.budget; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,204,204); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + row++; + } + if (detail.topic_type == 5) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, 5).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.budget; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,255,204); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + + row++; + } + } + } + + using (var stream1 = new MemoryStream()) + { + workbook.SaveAs(stream1); + var content = stream1.ToArray(); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + content, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "basic_plan_" + date + ".xlsx"); + } + } + [HttpPost, Route("reports/integration_strategic_plan/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetInStrPlanReport([FromRoute] string type, + [FromBody] integration_strategic_plan personnel) + { + var workbook = new XLWorkbook(); + var ws = workbook.Worksheets.Add("แผนบูรณาการ+แผนยุทธศาสตร์"); + ws.Cell("A1").Value = "งบประมาณแผ่นดิน ปีงบประมาณ พ.ศ. " + personnel.academic_year_name_th; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A1").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A1").Style.Font.FontSize = 16; + ws.Cell("A1").Style.Font.Bold = true; + + ws.Cell("A2").Value = personnel.agency_name_th; + ws.Cell("A2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A2").Style.Font.FontSize = 16; + ws.Cell("A2").Style.Font.Bold = true; + ws.Cell("K2").Value = "แผนบูรณาการ+แผนยุทธศาสตร์"; + ws.Cell("K2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell("K2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("K2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("K2").Style.Font.FontSize = 16; + ws.Cell("K2").Style.Font.Bold = true; + + //ws.Cell("K12").Style.NumberFormat.Format = "#,##0.0000"; + + ws.Column(1).Width = 30; + ws.Column(2).Width = 15; + ws.Column(3).Width = 15; + ws.Column(4).Width = 15; + ws.Column(5).Width = 15; + ws.Column(6).Width = 15; + ws.Column(7).Width = 15; + ws.Column(8).Width = 15; + ws.Column(9).Width = 15; + ws.Column(10).Width = 15; + ws.Column(11).Width = 15; + + int row = 6; + //int no = 1; + if (personnel != null) + { + ws.Range("A3:A5").Merge().Value = "งบรายจ่าย"; + ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("A3:A5").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("A3:A5").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("A3:A5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("B3:G3").Merge().Value = "งบประมาณ "+personnel.academic_year_name_th+" (เบื้องต้น)"; + ws.Range("B3:G3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("B3:G3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("B3:G3").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("B3:G3").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("B3:G3").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("B3:G3").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Cell("B3").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("H3:K3").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("B4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการ พัฒนาและส่งเสริมเศรษฐกิจฐานราก"; + ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("B4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("B4").Style.Alignment.WrapText = true; + ws.Cell("B4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("B4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("C4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการ สร้างรายได้ จากการท่องเที่ยว"; + ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("C4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("C4").Style.Alignment.WrapText = true; + ws.Cell("C4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("D4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนบูรณาการพัฒนาด้านคมนาคมและระบบโลจิสติกส์"; + ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("D4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("D4").Style.Alignment.WrapText = true; + ws.Cell("D4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("E4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนบูรณาการ พัฒนาภาค (ภาคกลาง)"; + ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("E4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("E4").Style.Alignment.WrapText = true; + ws.Cell("E4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("E4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("F4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการพัฒนาอุตสาหกรรมและบริการแห่งอนาคต"; + ws.Cell("F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("F4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("F4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("F4").Style.Alignment.WrapText = true; + ws.Cell("F4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("G4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์พัฒนาเศรษฐกิจและสังคมดิจิทัล"; + ws.Cell("G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("G4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("G4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("G4").Style.Alignment.WrapText = true; + ws.Cell("G4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("G4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("H4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์ (โครงการสำคัญ)"; + ws.Cell("H4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("H4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("H4").Style.Alignment.WrapText = true; + ws.Cell("H4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("I4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์ฯโครงการพัฒนาและผลิตกำลังคนของประเทศฯ Thailand 4.0"; + ws.Cell("I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("I4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("I4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("I4").Style.Alignment.WrapText = true; + ws.Cell("I4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("I4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("J4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์การพัฒนาผู้ประกอบการ และวิสาหกิจ ขนาดกลางและขนาดย่อมสู่สากล (SME)"; + ws.Cell("J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("J4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("J4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("J4").Style.Alignment.WrapText = true; + ws.Cell("J4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("J4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("K4").Value = "งบประมาณ ปี "+personnel.academic_year_name_th.Substring(2,2); + ws.Cell("K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("K4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("K4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("K4").Style.Alignment.WrapText = true; + ws.Cell("K4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("K4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("H3:K3").Style.Border.TopBorder = XLBorderStyleValues.Thin; + ws.Cell("K3").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 2), ws.Cell(4, 11)).Style.Alignment.WrapText = true; + ws.Cell(5, 2).Value = personnel.plan_1; + ws.Cell(5, 3).Value = personnel.plan_2; + ws.Cell(5, 4).Value = personnel.plan_3; + ws.Cell(5, 5).Value = personnel.plan_4; + ws.Cell(5, 6).Value = personnel.plan_5; + ws.Cell(5, 7).Value = personnel.plan_6; + ws.Cell(5, 8).Value = personnel.plan_7; + ws.Cell(5, 9).Value = personnel.plan_8; + ws.Cell(5, 10).Value = personnel.plan_9; + ws.Cell(5, 11).Value = personnel.budget; + ws.Cell(5, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Font.FontSize = 14; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.Font.FontColor = XLColor.Blue; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 11)).Style.NumberFormat.SetFormat("#,#"); + + foreach (var detail in personnel.integration_strategic_plan_details) + { + if (detail.topic_type == 1) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.plan_1; + ws.Cell(row, 3).Value = detail.plan_2; + ws.Cell(row, 4).Value = detail.plan_3; + ws.Cell(row, 5).Value = detail.plan_4; + ws.Cell(row, 6).Value = detail.plan_5; + ws.Cell(row, 7).Value = detail.plan_6; + ws.Cell(row, 8).Value = detail.plan_7; + ws.Cell(row, 9).Value = detail.plan_8; + ws.Cell(row, 10).Value = detail.plan_9; + ws.Cell(row, 11).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + + if (detail.topic_type == 2) //ชื่อแผน + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.plan_1; + ws.Cell(row, 3).Value = detail.plan_2; + ws.Cell(row, 4).Value = detail.plan_3; + ws.Cell(row, 5).Value = detail.plan_4; + ws.Cell(row, 6).Value = detail.plan_5; + ws.Cell(row, 7).Value = detail.plan_6; + ws.Cell(row, 8).Value = detail.plan_7; + ws.Cell(row, 9).Value = detail.plan_8; + ws.Cell(row, 10).Value = detail.plan_9; + ws.Cell(row, 11).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 3) //ชื่อโครงการ + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.plan_1; + ws.Cell(row, 3).Value = detail.plan_2; + ws.Cell(row, 4).Value = detail.plan_3; + ws.Cell(row, 5).Value = detail.plan_4; + ws.Cell(row, 6).Value = detail.plan_5; + ws.Cell(row, 7).Value = detail.plan_6; + ws.Cell(row, 8).Value = detail.plan_7; + ws.Cell(row, 9).Value = detail.plan_8; + ws.Cell(row, 10).Value = detail.plan_9; + ws.Cell(row, 11).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 4) //ชื่อกิจกรรม + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.plan_1; + ws.Cell(row, 3).Value = detail.plan_2; + ws.Cell(row, 4).Value = detail.plan_3; + ws.Cell(row, 5).Value = detail.plan_4; + ws.Cell(row, 6).Value = detail.plan_5; + ws.Cell(row, 7).Value = detail.plan_6; + ws.Cell(row, 8).Value = detail.plan_7; + ws.Cell(row, 9).Value = detail.plan_8; + ws.Cell(row, 10).Value = detail.plan_9; + ws.Cell(row, 11).Value = detail.budget; + 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.FontSize = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + + } + } + + using (var stream1 = new MemoryStream()) + { + workbook.SaveAs(stream1); + var content = stream1.ToArray(); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + content, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "integration_strategic_plan_" + date + ".xlsx"); + } + } + [HttpPost, Route("reports/basic_plan_all/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBasicPlanAllReport([FromRoute] string type, + [FromBody] integration_strategic_plan personnel) + { + var workbook = new XLWorkbook(); + var ws = workbook.Worksheets.Add("รวมทุกแผน"); + ws.Cell("A1").Value = "งบประมาณแผ่นดิน ปีงบประมาณ พ.ศ. " + personnel.academic_year_name_th+" (เบื้องต้น)"; + ws.Cell("A1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A1").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A1").Style.Font.FontSize = 16; + ws.Cell("A1").Style.Font.Bold = true; + + ws.Cell("A2").Value = personnel.agency_name_th; + ws.Cell("A2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell("A2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("A2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("A2").Style.Font.FontSize = 16; + ws.Cell("A2").Style.Font.Bold = true; + ws.Cell("O2").Value = "รวมทุกแผน"; + ws.Cell("O2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("O2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("O2").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("O2").Style.Font.FontSize = 16; + ws.Cell("O2").Style.Font.Bold = true; + + //ws.Cell("K12").Style.NumberFormat.Format = "#,##0.0000"; + + ws.Column(1).Width = 30; + ws.Column(2).Width = 10; + ws.Column(3).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(14).Width = 10; + ws.Column(15).Width = 10; + ws.Column(16).Width = 10; + + int row = 6; + //int no = 1; + if (personnel != null) + { + ws.Range("A3:A5").Merge().Value = "งบรายจ่าย"; + ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("A3:A5").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("A3:A5").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("A3:A5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("B3:O3").Merge().Value = "งบประมาณ "+personnel.academic_year_name_th+" (เบื้องต้น)"; + ws.Range("B3:O3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("B3:O3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("B3:O3").Style.Font.FontName = "TH SarabunPSK"; + ws.Range("B3:O3").Style.Font.SetBold().Font.FontSize = 14; + ws.Range("B3:O3").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range("B3:O3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("B4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " วิทย์"; + ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("B4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("B4").Style.Alignment.WrapText = true; + ws.Cell("B4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("B4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("C4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " สังคม"; + ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("C4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("C4").Style.Alignment.WrapText = true; + ws.Cell("C4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("D4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " บริการวิชาการ"; + ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("D4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("D4").Style.Alignment.WrapText = true; + ws.Cell("D4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("E4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " ทำนุบำรุง"; + ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("E4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("E4").Style.Alignment.WrapText = true; + ws.Cell("E4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("E4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("F4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการ พัฒนาและส่งเสริมเศรษฐกิจฐานราก"; + ws.Cell("F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("F4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("F4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("F4").Style.Alignment.WrapText = true; + ws.Cell("F4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("G4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการ สร้างรายได้ จากการท่องเที่ยว"; + ws.Cell("G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("G4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("G4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("G4").Style.Alignment.WrapText = true; + ws.Cell("G4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("G4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("H4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนบูรณาการพัฒนาด้านคมนาคมและระบบโลจิสติกส์"; + ws.Cell("H4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("H4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("H4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("H4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("H4").Style.Alignment.WrapText = true; + ws.Cell("H4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("I4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนบูรณาการ พัฒนาภาค (ภาคกลาง)"; + ws.Cell("I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("I4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("I4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("I4").Style.Alignment.WrapText = true; + ws.Cell("I4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("I4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("J4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานบูรณาการพัฒนาอุตสาหกรรมและบริการแห่งอนาคต"; + ws.Cell("J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("J4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("J4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("J4").Style.Alignment.WrapText = true; + ws.Cell("J4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("K4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์พัฒนาเศรษฐกิจและสังคมดิจิทัล"; + ws.Cell("K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("K4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("K4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("K4").Style.Alignment.WrapText = true; + ws.Cell("K4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("L4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์ (โครงการสำคัญ)"; + ws.Cell("L4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("L4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("L4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("L4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("L4").Style.Alignment.WrapText = true; + ws.Cell("L4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("L4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("M4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์ฯโครงการพัฒนาและผลิตกำลังคนของประเทศฯ Thailand 4.0"; + ws.Cell("M4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("M4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("M4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("M4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("M4").Style.Alignment.WrapText = true; + ws.Cell("M4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("M4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("N4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " แผนงานยุทธศาสตร์การพัฒนาผู้ประกอบการ และวิสาหกิจ ขนาดกลางและขนาดย่อมสู่สากล (SME)"; + ws.Cell("N4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("N4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("N4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("N4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("N4").Style.Alignment.WrapText = true; + ws.Cell("N4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("N4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell("O4").Value = "งบประมาณ ปี "+personnel.academic_year_name_th.Substring(2,2); + ws.Cell("O4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("O4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("O4").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("O4").Style.Font.SetBold().Font.FontSize = 14; + ws.Cell("O4").Style.Alignment.WrapText = true; + ws.Cell("O4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Cell("O4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range("B4:O4").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("B4:O4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(4, 2), ws.Cell(4, 14)).Style.Alignment.WrapText = true; + ws.Cell(5, 2).Value = personnel.science; + ws.Cell(5, 3).Value = personnel.society; + ws.Cell(5, 4).Value = personnel.academic_service; + ws.Cell(5, 5).Value = personnel.nourish; + ws.Cell(5, 6).Value = personnel.plan_1; + ws.Cell(5, 7).Value = personnel.plan_2; + ws.Cell(5, 8).Value = personnel.plan_3; + ws.Cell(5, 9).Value = personnel.plan_4; + ws.Cell(5, 10).Value = personnel.plan_5; + ws.Cell(5, 11).Value = personnel.plan_6; + ws.Cell(5, 12).Value = personnel.plan_7; + ws.Cell(5, 13).Value = personnel.plan_8; + ws.Cell(5, 14).Value = personnel.plan_9; + ws.Cell(5, 15).Value = personnel.budget; + ws.Cell(5, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(5, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Font.FontName = "TH SarabunPSK"; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Font.FontSize = 14; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.Font.FontColor = XLColor.Blue; + ws.Range(ws.Cell(5, 2), ws.Cell(5, 15)).Style.NumberFormat.SetFormat("#,#"); + + foreach (var detail in personnel.integration_strategic_plan_details) + { + if (detail.topic_type == 1) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, row).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.plan_1; + ws.Cell(row, 7).Value = detail.plan_2; + ws.Cell(row, 8).Value = detail.plan_3; + ws.Cell(row, 9).Value = detail.plan_4; + ws.Cell(row, 10).Value = detail.plan_5; + ws.Cell(row, 11).Value = detail.plan_6; + ws.Cell(row, 12).Value = detail.plan_7; + ws.Cell(row, 13).Value = detail.plan_8; + ws.Cell(row, 14).Value = detail.plan_9; + ws.Cell(row, 15).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(204,153,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + + if (detail.topic_type == 2) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, row).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.plan_1; + ws.Cell(row, 7).Value = detail.plan_2; + ws.Cell(row, 8).Value = detail.plan_3; + ws.Cell(row, 9).Value = detail.plan_4; + ws.Cell(row, 10).Value = detail.plan_5; + ws.Cell(row, 11).Value = detail.plan_6; + ws.Cell(row, 12).Value = detail.plan_7; + ws.Cell(row, 13).Value = detail.plan_8; + ws.Cell(row, 14).Value = detail.plan_9; + ws.Cell(row, 15).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(153,204,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 3) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, row).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.plan_1; + ws.Cell(row, 7).Value = detail.plan_2; + ws.Cell(row, 8).Value = detail.plan_3; + ws.Cell(row, 9).Value = detail.plan_4; + ws.Cell(row, 10).Value = detail.plan_5; + ws.Cell(row, 11).Value = detail.plan_6; + ws.Cell(row, 12).Value = detail.plan_7; + ws.Cell(row, 13).Value = detail.plan_8; + ws.Cell(row, 14).Value = detail.plan_9; + ws.Cell(row, 15).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(153,204,255); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 4) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, row).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.plan_1; + ws.Cell(row, 7).Value = detail.plan_2; + ws.Cell(row, 8).Value = detail.plan_3; + ws.Cell(row, 9).Value = detail.plan_4; + ws.Cell(row, 10).Value = detail.plan_5; + ws.Cell(row, 11).Value = detail.plan_6; + ws.Cell(row, 12).Value = detail.plan_7; + ws.Cell(row, 13).Value = detail.plan_8; + ws.Cell(row, 14).Value = detail.plan_9; + ws.Cell(row, 15).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,204,153); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + if (detail.topic_type == 5) + { + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = detail.science; + ws.Cell(row, 3).Value = detail.society; + ws.Cell(row, 4).Value = detail.academic_service; + ws.Cell(row, row).Value = detail.nourish; + ws.Cell(row, 6).Value = detail.plan_1; + ws.Cell(row, 7).Value = detail.plan_2; + ws.Cell(row, 8).Value = detail.plan_3; + ws.Cell(row, 9).Value = detail.plan_4; + ws.Cell(row, 10).Value = detail.plan_5; + ws.Cell(row, 11).Value = detail.plan_6; + ws.Cell(row, 12).Value = detail.plan_7; + ws.Cell(row, 13).Value = detail.plan_8; + ws.Cell(row, 14).Value = detail.plan_9; + ws.Cell(row, 15).Value = detail.budget; + 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 = 14; + 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.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor = XLColor.FromArgb(255,255,204); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } + } + } + + using (var stream1 = new MemoryStream()) + { + workbook.SaveAs(stream1); + var content = stream1.ToArray(); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + content, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "basic_plan_all_" + date + ".xlsx"); + } + } } } \ No newline at end of file diff --git a/Controllers/Personnel.Controller.cs b/Controllers/Personnel.Controller.cs index b4c6dfb..513e84a 100644 --- a/Controllers/Personnel.Controller.cs +++ b/Controllers/Personnel.Controller.cs @@ -6212,7 +6212,7 @@ namespace rmutr_report.Controllers ws.Range("B3:F3").Style.Font.SetBold().Font.FontSize = 14; ws.Range("B3:F3").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); ws.Range("B3:F3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell("B4").Value = " ปี "+personnel.agency_name_th.Substring(2,2) + " วิทย์"; + ws.Cell("B4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " วิทย์"; ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK"; @@ -6220,7 +6220,7 @@ namespace rmutr_report.Controllers ws.Cell("B4").Style.Alignment.WrapText = true; ws.Cell("B4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); ws.Cell("B4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell("C4").Value = " ปี "+personnel.agency_name_th.Substring(2,2) + " สังคม"; + ws.Cell("C4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " สังคม"; ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK"; @@ -6228,7 +6228,7 @@ namespace rmutr_report.Controllers ws.Cell("C4").Style.Alignment.WrapText = true; ws.Cell("C4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); ws.Cell("C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell("D4").Value = " ปี "+personnel.agency_name_th.Substring(2,2) + " บริการวิชาการ"; + ws.Cell("D4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " บริการวิชาการ"; ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK"; @@ -6236,7 +6236,7 @@ namespace rmutr_report.Controllers ws.Cell("D4").Style.Alignment.WrapText = true; ws.Cell("D4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell("E4").Value = " ปี "+personnel.agency_name_th.Substring(2,2) + " ทำนุบำรุง"; + ws.Cell("E4").Value = " ปี "+personnel.academic_year_name_th.Substring(2,2) + " ทำนุบำรุง"; ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK"; @@ -6244,7 +6244,7 @@ namespace rmutr_report.Controllers ws.Cell("E4").Style.Alignment.WrapText = true; ws.Cell("E4").Style.Fill.BackgroundColor = XLColor.FromArgb(255,153,204); ws.Cell("F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell("F4").Value = "งบประมาณปี " + personnel.agency_name_th.Substring(2, 2); + ws.Cell("F4").Value = "งบประมาณปี " + personnel.academic_year_name_th.Substring(2, 2); ws.Cell("F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell("F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Cell("F4").Style.Font.FontName = "TH SarabunPSK"; diff --git a/Models/Personnel/integration_strategic_plan.cs b/Models/Personnel/integration_strategic_plan.cs new file mode 100644 index 0000000..0fef9be --- /dev/null +++ b/Models/Personnel/integration_strategic_plan.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.Personnel +{ + public class integration_strategic_plan + { + public string academic_year_name_th { get; set; } + public string agency_name_th { get; set; } + public decimal? science { get; set; } + public decimal? society { get; set; } + public decimal? academic_service { get; set; } + public decimal? nourish { get; set; } + public decimal? plan_1 { get; set; } + public decimal? plan_2 { get; set; } + public decimal? plan_3 { get; set; } + public decimal? plan_4 { get; set; } + public decimal? plan_5 { get; set; } + public decimal? plan_6 { get; set; } + public decimal? plan_7 { get; set; } + public decimal? plan_8 { get; set; } + public decimal? plan_9 { get; set; } + public decimal? budget { get; set; } + public List integration_strategic_plan_details { get; set; } + + + } + + public class integration_strategic_plan_detail + { + public string topic { get; set; } + public decimal? science { get; set; } + public decimal? society { get; set; } + public decimal? academic_service { get; set; } + public decimal? nourish { get; set; } + public decimal? plan_1 { get; set; } + public decimal? plan_2 { get; set; } + public decimal? plan_3 { get; set; } + public decimal? plan_4 { get; set; } + public decimal? plan_5 { get; set; } + public decimal? plan_6 { get; set; } + public decimal? plan_7 { get; set; } + public decimal? plan_8 { get; set; } + public decimal? plan_9 { get; set; } + public decimal? budget { get; set; } + + public int? topic_type { get; set; } + } +} \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index 9aefadb..c059bce 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 7fe2722..9e3f3a1 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.csproj.CoreCompileInputs.cache b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache index 381e992..1a94141 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -7e2739011ea2dfb9109e8abe681c5a2c80dbe65d +c72c85eb313e56d69a393160878d05d03a62510b diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 9aefadb..c059bce 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 7fe2722..9e3f3a1 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ