1911 lines
127 KiB
C#
1911 lines
127 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using ClosedXML.Excel;
|
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
|
using FastReport;
|
|
using FastReport.Export.Csv;
|
|
using FastReport.Export.Mht;
|
|
using FastReport.Export.OoXML;
|
|
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
|
|
{
|
|
[SwaggerTag("สำหรับรายงานสรุปแผนความต้องการ")]
|
|
public class SummaryController : Controller
|
|
{
|
|
readonly Setting _setting;
|
|
|
|
public SummaryController(Setting setting)
|
|
{
|
|
this._setting = setting;
|
|
}
|
|
|
|
[SwaggerOperation("สรุปแผนความต้องการ รายการครุภัณฑ์")]
|
|
[HttpPost, Route("reports/summary_of_equipment/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetSum1Report([FromRoute] string type,
|
|
[FromBody] summary_of_equipment summary_of_equipments)
|
|
{
|
|
var _summary_of_equipment = new List<summary_of_equipment>() { summary_of_equipments };
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("รายการก่อสร้างอาคาร");
|
|
var imagePath = _setting.report_path + @"Logo-RMUTR.png";
|
|
ws.AddPicture(imagePath).MoveTo(ws.Cell("A1")).Scale(0.3);
|
|
ws.Range("A4:A6").Merge().Value = "ลำดับความสำคัญ(1)";
|
|
ws.Cell("A4").Style.Alignment.WrapText = true;
|
|
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.Cell("A4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("A4").Style.Font.FontSize = 14;
|
|
ws.Range("B4:B6").Merge().Value = "รายการ";
|
|
ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("B4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("B4").Style.Font.FontSize = 14;
|
|
ws.Range("C5:E5").Merge().Value = "ประเภทของครุภัณฑ์";
|
|
ws.Range("C5:E5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C5:E5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("C5:E5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("C5").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C5").Style.Font.FontSize = 11;
|
|
ws.Range("C6").Value = "ทดแทนของเดิม";
|
|
ws.Cell("C6").Style.Alignment.WrapText = true;
|
|
ws.Cell("C6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("C6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("C6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("C6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C6").Style.Font.FontSize = 11;
|
|
ws.Range("D6").Value = "เพิ่มประสิทธิภาพ";
|
|
ws.Cell("D6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("D6").Style.Font.FontSize = 11;
|
|
ws.Cell("D6").Style.Alignment.WrapText = true;
|
|
ws.Cell("D6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("D6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("D6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("E6").Value = "ครุภัณฑ์ใหม่";
|
|
ws.Cell("E6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("E6").Style.Font.FontSize = 11;
|
|
ws.Cell("E6").Style.Alignment.WrapText = true;
|
|
ws.Cell("E6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("E6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("E6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("F5:F6").Merge().Value = "หน่วยนับ";
|
|
ws.Cell("F5").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("F5").Style.Font.FontSize = 12;
|
|
//ws.Range("F3").Style.Font.Bold = true;
|
|
ws.Range("F5:F6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("F5:F6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("F5:F6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G5:G6").Merge().Value = "จำนวน";
|
|
ws.Cell("G5").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("G5").Style.Font.FontSize = 12;
|
|
//ws.Range("G3").Style.Font.Bold = true;
|
|
ws.Range("G5:G6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("G5:G6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("G5:G6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("H5:H6").Merge().Value = "ราคาต่อหน่วย";
|
|
ws.Cell("H5").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("H5").Style.Font.FontSize = 12;
|
|
//ws.Range("H3").Style.Font.Bold = true;
|
|
ws.Range("H5:H6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("H5:H6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("H5:H6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("I4:M4").Merge().Value = "แผนความต้องการครุภัณฑ์";
|
|
ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I4").Style.Font.FontSize = 14;
|
|
//ws.Range("I2").Style.Font.Bold = true;
|
|
ws.Range("I4:M4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("I4:M4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("I4:M4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("I5:M5").Merge().Value = "วงเงิน";
|
|
ws.Cell("I5").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I5").Style.Font.FontSize = 14;
|
|
ws.Range("I5:M5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("I5:M5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("I5:M5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("N4:N6").Merge().Value = "คำอธิบายความพร้อม/ประโยชน์ที่จะได้รับ";
|
|
ws.Cell("N4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("N4").Style.Font.FontSize = 14;
|
|
ws.Cell("N4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("N4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("N4:N6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Row(4).Height = 30;
|
|
ws.Row(5).Height = 30;
|
|
ws.Row(6).Height = 30;
|
|
ws.Column(1).Width = 9;
|
|
ws.Column(2).Width = 40;
|
|
ws.Column(3).Width = 5;
|
|
ws.Column(4).Width = 5;
|
|
ws.Column(5).Width = 5;
|
|
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 = 40;
|
|
int row = 7;
|
|
int no = 1;
|
|
|
|
if (summary_of_equipments != null)
|
|
{
|
|
string second = "ปีงบประมาณ " + summary_of_equipments.academic_year_name_th + " " +
|
|
summary_of_equipments.header_name;
|
|
string third = "หน่วยงาน/คณะ " + summary_of_equipments.agency_name_th + " พื้นที่ " +
|
|
summary_of_equipments.location;
|
|
ws.Range("A1:N1").Merge().Value =
|
|
"สรุปแผนความต้องการ รายการก่อสร้างอาคารหรือสิ่งก่อสร้างและปรับปรุงซ่อมแซมต่อเติม ของมหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
|
|
ws.Range("A1:N1").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A1:N1").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A2:N2").Merge().Value = second;
|
|
ws.Range("A2:N2").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A2:N2").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A3:N3").Merge().Value = third;
|
|
ws.Range("A3:N3").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A3:N3").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A1:A3").Style.Font.Bold = true;
|
|
ws.Range("A1:A3").Style.Font.FontSize = 16;
|
|
ws.Range("A1:A3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("C4:H4").Merge().Value = "ปี " + summary_of_equipments.academic_year;
|
|
ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C4").Style.Font.FontSize = 14;
|
|
ws.Range("C4:H4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C4:H4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("C4:H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("I6").Value = summary_of_equipments.budget_year_1;
|
|
ws.Cell("I6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I6").Style.Font.FontSize = 12;
|
|
ws.Cell("I6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("I6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("I6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("J6").Value = summary_of_equipments.budget_year_2;
|
|
ws.Cell("J6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("J6").Style.Font.FontSize = 12;
|
|
ws.Cell("J6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("J6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("J6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("K6").Value = summary_of_equipments.budget_year_3;
|
|
ws.Cell("K6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("K6").Style.Font.FontSize = 12;
|
|
ws.Cell("K6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("K6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("K6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("L6").Value = summary_of_equipments.budget_year_4;
|
|
ws.Cell("L6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("L6").Style.Font.FontSize = 12;
|
|
ws.Cell("L6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("L6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("L6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("M6").Value = summary_of_equipments.budget_year_5;
|
|
ws.Cell("M6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("M6").Style.Font.FontSize = 12;
|
|
ws.Cell("M6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("M6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("M6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
foreach (var equipments in summary_of_equipments.data)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = equipments.list;
|
|
ws.Cell(row, 3).Value = equipments.type_1;
|
|
ws.Cell(row, 4).Value = equipments.type_2;
|
|
ws.Cell(row, 5).Value = equipments.type_3;
|
|
ws.Cell(row, 6).Value = equipments.unit;
|
|
ws.Cell(row, 7).Value = equipments.quantity;
|
|
ws.Cell(row, 8).Value = equipments.unit_price;
|
|
ws.Cell(row, 9).Value = equipments.price_1;
|
|
ws.Cell(row, 10).Value = equipments.price_2;
|
|
ws.Cell(row, 11).Value = equipments.price_3;
|
|
ws.Cell(row, 12).Value = equipments.price_4;
|
|
ws.Cell(row, 13).Value = equipments.price_5;
|
|
ws.Cell(row, 14).Value = equipments.description;
|
|
|
|
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.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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
|
|
row++;
|
|
}
|
|
}
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "summary_of_equipment.frx");
|
|
report.RegisterData(_summary_of_equipment, "summary_of_equipment");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
case "mht":
|
|
MHTExport mht = new MHTExport();
|
|
report.Export(mht, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "multipart/related");
|
|
break;
|
|
case "csv":
|
|
CSVExport csv = new CSVExport();
|
|
report.Export(csv, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "text/csv");
|
|
break;
|
|
case "xlsx":
|
|
case "xls":
|
|
workbook.SaveAs(stream);
|
|
var content = stream.ToArray();
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
content,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"equipments_" + date + ".xlsx");
|
|
}
|
|
|
|
// 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",
|
|
// "equipments_" + date + ".xlsx");
|
|
// }
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("สรุปแผนความต้องการ รายการครุภัณฑ์ 5 ปี")]
|
|
[HttpPost, Route("reports/summary_of_equipment_five_year/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetEquipmentReport([FromRoute] string type,
|
|
[FromBody] summary_of_equipment_five_year summary_of_equipments)
|
|
{
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("รายการครุภัณฑ์");
|
|
var imagePath = _setting.report_path + @"Logo-RMUTR.png";
|
|
ws.AddPicture(imagePath).MoveTo(ws.Cell("A1")).Scale(0.27);
|
|
ws.Range("A1:P1").Merge().Value =
|
|
"สรุปแผนความต้องการ รายการครุภัณฑ์ ของมหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์ ปีงบประมาณ" +
|
|
summary_of_equipments.budget_year;
|
|
ws.Range("A1:P1").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A1:P1").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("A1").Style.Font.Bold = true;
|
|
ws.Cell("A1").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("A1").Style.Font.FontSize = 16;
|
|
ws.Range("A2:A4").Merge().Value = "ลำดับความสำคัญ(1)";
|
|
ws.Cell("A2").Style.Alignment.WrapText = true;
|
|
ws.Range("A2:A4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A2:A4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A2:A4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("A2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("A2").Style.Font.FontSize = 14;
|
|
ws.Range("B2:B4").Merge().Value = "รายการ";
|
|
ws.Cell("B2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("B2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("B2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("B2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("B2").Style.Font.FontSize = 14;
|
|
ws.Range("C3:E3").Merge().Value = "ประเภทของครุภัณฑ์";
|
|
ws.Range("C3:E3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C3:E3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("C3:E3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("C3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C3").Style.Font.FontSize = 11;
|
|
ws.Range("C4").Value = "ทดแทนของเดิม";
|
|
ws.Cell("C4").Style.Alignment.WrapText = true;
|
|
ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C4").Style.Font.FontSize = 11;
|
|
ws.Range("D4").Value = "เพิ่มประสิทธิภาพ";
|
|
ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("D4").Style.Font.FontSize = 11;
|
|
ws.Cell("D4").Style.Alignment.WrapText = true;
|
|
ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("E4").Value = "ครุภัณฑ์ใหม่";
|
|
ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("E4").Style.Font.FontSize = 11;
|
|
ws.Cell("E4").Style.Alignment.WrapText = true;
|
|
ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("E4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("F3:F4").Merge().Value = "หน่วยนับ";
|
|
ws.Cell("F3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("F3").Style.Font.FontSize = 12;
|
|
//ws.Range("F3").Style.Font.Bold = true;
|
|
ws.Range("F3:F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("F3:F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("F3:F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G3:G4").Merge().Value = "จำนวน";
|
|
ws.Cell("G3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("G3").Style.Font.FontSize = 12;
|
|
//ws.Range("G3").Style.Font.Bold = true;
|
|
ws.Range("G3:G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("G3:G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("G3:G4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G3").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("H3:H4").Merge().Value = "ราคาต่อหน่วย";
|
|
ws.Cell("H3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("H3").Style.Font.FontSize = 12;
|
|
//ws.Range("H3").Style.Font.Bold = true;
|
|
ws.Range("H3:H4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("H3:H4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("H3:H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("I2:M2").Merge().Value = "แผนความต้องการครุภัณฑ์";
|
|
ws.Cell("I2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I2").Style.Font.FontSize = 14;
|
|
//ws.Range("I2").Style.Font.Bold = true;
|
|
ws.Range("I2:M2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("I2:M2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("I2:M2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("I3:M3").Merge().Value = "วงเงิน";
|
|
ws.Cell("I3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I3").Style.Font.FontSize = 14;
|
|
ws.Range("I3:M3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("I3:M3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("I3:M3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("N4").Value = "วงเงิน";
|
|
ws.Cell("N4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("N4").Style.Font.FontSize = 12;
|
|
//ws.Range("N4").Style.Font.Bold = true;
|
|
ws.Cell("N4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("N4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("N4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("O4").Value = "ชื่อบริษัท";
|
|
ws.Cell("O4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("O4").Style.Font.FontSize = 12;
|
|
//ws.Range("O4").Style.Font.Bold = true;
|
|
ws.Cell("O4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("O4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("O4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("P2:P4").Merge().Value = "คำอธิบายความพร้อม/ประโยชน์ที่จะได้รับ";
|
|
ws.Cell("P2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("P2").Style.Font.FontSize = 14;
|
|
//ws.Cell("P2").Style.Font.Bold = true;
|
|
ws.Cell("P2").Style.Alignment.WrapText = true;
|
|
ws.Cell("P2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("P2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("P2:P4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Row(1).Height = 60;
|
|
ws.Column(1).Width = 8;
|
|
ws.Column(2).Width = 40;
|
|
ws.Column(3).Width = 5;
|
|
ws.Column(4).Width = 5;
|
|
ws.Column(5).Width = 5;
|
|
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 = 50;
|
|
|
|
int row = 5;
|
|
int no = 1;
|
|
|
|
// foreach (var equipments in summary_of_equipments)
|
|
// {
|
|
if (summary_of_equipments != null)
|
|
{
|
|
ws.Range("C2:H2").Merge().Value = "ปี " + summary_of_equipments.academic_year;
|
|
ws.Cell("C2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C2").Style.Font.FontSize = 14;
|
|
ws.Range("C2:H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C2:H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("C2:H2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("I4").Value = summary_of_equipments.budget_year_1;
|
|
ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I4").Style.Font.FontSize = 12;
|
|
ws.Cell("I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("I4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("I4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("J4").Value = summary_of_equipments.budget_year_2;
|
|
ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("J4").Style.Font.FontSize = 12;
|
|
ws.Cell("J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("J4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("J4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("K4").Value = summary_of_equipments.budget_year_3;
|
|
ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("K4").Style.Font.FontSize = 12;
|
|
ws.Cell("K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("K4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("K4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("L4").Value = summary_of_equipments.budget_year_4;
|
|
ws.Cell("L4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("L4").Style.Font.FontSize = 12;
|
|
ws.Cell("L4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("L4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("L4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("M4").Value = summary_of_equipments.budget_year_5;
|
|
ws.Cell("M4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("M4").Style.Font.FontSize = 12;
|
|
ws.Cell("M4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("M4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("M4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("N2:O3").Merge().Value = "ใบเสนอราคาครุภัณฑ์ ปี " + summary_of_equipments.academic_year;
|
|
ws.Cell("N2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("N2").Style.Font.FontSize = 14;
|
|
ws.Range("N2:O3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("N2:O3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("N2:O3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("N2").Style.Alignment.WrapText = true;
|
|
foreach (var equipments in summary_of_equipments.header_data)
|
|
{
|
|
if (equipments.color == 1)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = equipments.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = equipments.unit_price;
|
|
ws.Cell(row, 9).Value = equipments.price_1;
|
|
ws.Cell(row, 10).Value = equipments.price_2;
|
|
ws.Cell(row, 11).Value = equipments.price_3;
|
|
ws.Cell(row, 12).Value = equipments.price_4;
|
|
ws.Cell(row, 13).Value = equipments.price_5;
|
|
ws.Cell(row, 14).Value = null;
|
|
ws.Cell(row, 15).Value = null;
|
|
ws.Cell(row, 16).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 12;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor = XLColor.FromArgb(250,191,143);
|
|
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
if (equipments.color == 2)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = equipments.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = equipments.unit_price;
|
|
ws.Cell(row, 9).Value = equipments.price_1;
|
|
ws.Cell(row, 10).Value = equipments.price_2;
|
|
ws.Cell(row, 11).Value = equipments.price_3;
|
|
ws.Cell(row, 12).Value = equipments.price_4;
|
|
ws.Cell(row, 13).Value = equipments.price_5;
|
|
ws.Cell(row, 14).Value = null;
|
|
ws.Cell(row, 15).Value = null;
|
|
ws.Cell(row, 16).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 12;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor = XLColor.FromArgb(183,222,232);
|
|
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
foreach (var equipments1 in equipments.data)
|
|
{
|
|
if (equipments1.color == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = equipments1.faculty_name;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = equipments1.unit_price;
|
|
ws.Cell(row, 9).Value = equipments1.price_1;
|
|
ws.Cell(row, 10).Value = equipments1.price_2;
|
|
ws.Cell(row, 11).Value = equipments1.price_3;
|
|
ws.Cell(row, 12).Value = equipments1.price_4;
|
|
ws.Cell(row, 13).Value = equipments1.price_5;
|
|
ws.Cell(row, 14).Value = null;
|
|
ws.Cell(row, 15).Value = null;
|
|
ws.Cell(row, 16).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 12;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(204,192,218);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
|
|
foreach (var equipments2 in equipments1.data)
|
|
{
|
|
if (equipments2.color == 4)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = equipments2.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = equipments2.unit_price;
|
|
ws.Cell(row, 9).Value = equipments2.price_1;
|
|
ws.Cell(row, 10).Value = equipments2.price_2;
|
|
ws.Cell(row, 11).Value = equipments2.price_3;
|
|
ws.Cell(row, 12).Value = equipments2.price_4;
|
|
ws.Cell(row, 13).Value = equipments2.price_5;
|
|
ws.Cell(row, 14).Value = null;
|
|
ws.Cell(row, 15).Value = null;
|
|
ws.Cell(row, 16).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 12;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(216,228,188);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
|
|
foreach (var equipment3 in equipments2.data)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = equipment3.list;
|
|
ws.Cell(row, 3).Value = equipment3.type_1;
|
|
ws.Cell(row, 4).Value = equipment3.type_2;
|
|
ws.Cell(row, 5).Value = equipment3.type_3;
|
|
ws.Cell(row, 6).Value = equipment3.unit;
|
|
ws.Cell(row, 7).Value = equipment3.quantity;
|
|
ws.Cell(row, 8).Value = equipment3.unit_price;
|
|
ws.Cell(row, 9).Value = equipment3.price_1;
|
|
ws.Cell(row, 10).Value = equipment3.price_2;
|
|
ws.Cell(row, 11).Value = equipment3.price_3;
|
|
ws.Cell(row, 12).Value = equipment3.price_4;
|
|
ws.Cell(row, 13).Value = equipment3.price_5;
|
|
ws.Cell(row, 14).Value = equipment3.amount;
|
|
ws.Cell(row, 15).Value = equipment3.company;
|
|
ws.Cell(row, 16).Value = equipment3.description;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 12;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Left;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
string str = equipment3.amount;
|
|
string str2 = equipment3.amount + "\r" + equipment3.amount + "\n" + equipment3.amount;
|
|
//string str3 = str2.Substring(0, 7);
|
|
if (str.Length == 4)
|
|
{
|
|
for (int i = 1; i <= str.Length - 1; i += 4)
|
|
{
|
|
equipment3.amount = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 5)
|
|
{
|
|
for (int i = 2; i <= str.Length - 1; i += 5)
|
|
{
|
|
equipment3.amount = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 6)
|
|
{
|
|
for (int i = 3; i <= str.Length - 1; i += 6)
|
|
{
|
|
equipment3.amount = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 7)
|
|
{
|
|
for (int i = 4; i <= str.Length - 1; i += 7)
|
|
{
|
|
equipment3.amount = str.Insert(i, ",");
|
|
}
|
|
}
|
|
// else if (str3.Length == 7)
|
|
// {
|
|
// for (int i = 4; i <= str3.Length - 1; i += 7)
|
|
// {
|
|
// equipment.amount= str3.Insert(i, ",");
|
|
// }
|
|
// }
|
|
|
|
|
|
else
|
|
{
|
|
equipment3.amount = str;
|
|
}
|
|
|
|
row++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
using (var stream = new MemoryStream())
|
|
{
|
|
workbook.SaveAs(stream);
|
|
var content = stream.ToArray();
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
content,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"equipment_" + date + ".xlsx");
|
|
}
|
|
}
|
|
|
|
[SwaggerOperation("รายละเอียดคำชี้แจงค่าครุภัณฑ์")]
|
|
[HttpPost, Route("reports/statement_of_equipment/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetStEquipmentReport([FromRoute] string type,
|
|
[FromBody] statement_of_equipment equipments)
|
|
{
|
|
var a = equipments.page_1.ToArray();
|
|
foreach (var aa in a)
|
|
{
|
|
var s1 = aa.page_1_detail.Sum(d => d.quantity);
|
|
var s2 = aa.page_1_detail.Sum(d => d.unit_price);
|
|
var s3 = aa.page_1_detail.Sum(d => d.amount);
|
|
foreach (var b in aa.page_1_detail)
|
|
{
|
|
if (b.quantity != null)
|
|
{
|
|
aa.sum1 = s1;
|
|
}
|
|
|
|
if (b.quantity == null)
|
|
{
|
|
aa.sum1 = 0;
|
|
}
|
|
|
|
if (b.unit_price != null)
|
|
{
|
|
aa.sum2 = s2;
|
|
}
|
|
|
|
if (b.unit_price == null)
|
|
{
|
|
aa.sum2 = 0;
|
|
}
|
|
|
|
if (b.amount != null)
|
|
{
|
|
aa.sum3 = s3;
|
|
}
|
|
|
|
if (b.amount == null)
|
|
{
|
|
aa.sum3 = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
var _statement_of_equipment = new List<statement_of_equipment>() { equipments };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "statement_of_equipment.frx");
|
|
report.RegisterData(_statement_of_equipment, "statement_of_equipment");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/vnd.ms-excel");
|
|
break;
|
|
case "xlsx":
|
|
Excel2007Export excel1 = new Excel2007Export();
|
|
report.Export(excel1, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/vnd.ms-excel");
|
|
break;
|
|
case "mht":
|
|
MHTExport mht = new MHTExport();
|
|
report.Export(mht, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "multipart/related");
|
|
break;
|
|
case "csv":
|
|
CSVExport csv = new CSVExport();
|
|
report.Export(csv, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "text/csv");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("สรุปแผนความต้องการรายการก่อสร้างอาคารหรือสิ่งก่อสร้าง")]
|
|
[HttpPost, Route("reports/summary_building_construction/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetSum2Report([FromRoute] string type,
|
|
[FromBody] summary_building_construction summary_building_constructions)
|
|
{
|
|
{
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("รายการก่อสร้างอาคาร");
|
|
var imagePath = _setting.report_path + @"Logo-RMUTR.png";
|
|
ws.AddPicture(imagePath).MoveTo(ws.Cell("A1")).Scale(0.20);
|
|
ws.Range("A2:A4").Merge().Value = "ลำดับความสำคัญ(1)";
|
|
ws.Range("A2:A4").Style.Alignment.WrapText = true;
|
|
ws.Range("A2:A4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A2:A4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A2:A4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("A2:A4").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("A2").Style.Font.FontSize = 14;
|
|
ws.Range("A2:A4").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("B2:B4").Merge().Value = "รายการ";
|
|
ws.Cell("B2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("B2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("B2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("B2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("B2").Style.Font.FontSize = 14;
|
|
ws.Range("B2:B4").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("C2:C4").Merge().Value = "จำนวน";
|
|
ws.Cell("C2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("C2").Style.Font.FontSize = 14;
|
|
ws.Range("C2:C4").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("C2:C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C2:C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("C2:C4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("C3").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("D2:F2").Merge().Value = "อายุการใช้งาน";
|
|
ws.Cell("D2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("D2").Style.Font.FontSize = 14;
|
|
ws.Range("D2:F2").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("D2:F2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("D2:F2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("D2:F2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("D3").Value = "ต่ำกว่า 10 ปี";
|
|
ws.Cell("D3").Style.Alignment.WrapText = true;
|
|
ws.Cell("D3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("D3").Style.Font.FontSize = 10;
|
|
ws.Cell("D3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("D3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("D3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("E3").Value = "10-20 ปี";
|
|
ws.Cell("E3").Style.Alignment.WrapText = true;
|
|
ws.Cell("E3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("E3").Style.Font.FontSize = 10;
|
|
ws.Cell("E3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("E3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("E3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("F3").Value = "มากกว่า 20 ปี";
|
|
ws.Cell("F3").Style.Alignment.WrapText = true;
|
|
ws.Cell("F3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("F3").Style.Font.FontSize = 10;
|
|
ws.Cell("F3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("F3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("F3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("D3:F3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Cell("D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("E4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("F4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G2:G4").Merge().Value = "ปัญหาของอาคาร";
|
|
ws.Cell("G2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("G2").Style.Font.FontSize = 14;
|
|
ws.Range("G2:G4").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("G2:G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("G2:G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("G2:G4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("H2:I2").Merge().Value = "ประเภท";
|
|
ws.Cell("H2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("H2").Style.Font.FontSize = 14;
|
|
ws.Range("H2:I2").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("H2:I2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("H2:I2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("H2:I2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("H3").Value = "ทดแทนอาคารเดิม";
|
|
ws.Cell("H3").Style.Alignment.WrapText = true;
|
|
ws.Cell("H3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("H3").Style.Font.FontSize = 10;
|
|
ws.Cell("H3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("H3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("H3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("I3").Value = "อาคารใหม่";
|
|
ws.Cell("I3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("I3").Style.Font.FontSize = 10;
|
|
ws.Cell("I3").Style.Alignment.WrapText = true;
|
|
ws.Cell("I3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("I3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("I3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("H3:I3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("J2:J3").Merge().Value = "ปรับปรุง/ซ่อมแซม/ต่อเติม";
|
|
ws.Range("J2:J3").Style.Alignment.WrapText = true;
|
|
ws.Cell("J2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("J2").Style.Font.FontSize = 14;
|
|
ws.Range("J2:J3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("J2:J3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("J2:J3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("J2:J3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("J4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("I4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("H4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("K2:K3").Merge().Value = "วงเงินที่จะเสนอของบประมาณ";
|
|
ws.Range("K2:K3").Style.Alignment.WrapText = true;
|
|
ws.Cell("K2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("K2").Style.Font.FontSize = 14;
|
|
ws.Range("K2:K3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("K2:K3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("K2:K3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("K2:K3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("K4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("L2:P2").Merge().Value = "ปีงบประมาณที่จะเสนอขอ";
|
|
ws.Range("L2:P2").Style.Alignment.WrapText = true;
|
|
ws.Cell("L2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("L2").Style.Font.FontSize = 14;
|
|
ws.Range("L2:P2").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("L2:P2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("L2:P2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("L2:P2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("L4:P4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("Q3").Value = "BOQ";
|
|
ws.Cell("Q3").Style.Alignment.WrapText = true;
|
|
ws.Cell("Q3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("Q3").Style.Font.FontSize = 10;
|
|
ws.Cell("Q3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("Q3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("Q3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("R3").Value = "แบบรูป";
|
|
ws.Cell("R3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("R3").Style.Font.FontSize = 10;
|
|
ws.Range("Q3:R3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Cell("R3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("R3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("R3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("Q4:R4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("S2:S3").Merge().Value = "คำอธิบาย";
|
|
ws.Range("S2:S3").Style.Alignment.WrapText = true;
|
|
ws.Cell("S2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("S2").Style.Font.FontSize = 14;
|
|
ws.Range("S2:S3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("S2:S3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("S2:S3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("S2:S3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("S4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Row(1).Height = 45;
|
|
// ws.Row(4).Height = 30;
|
|
// ws.Row(5).Height = 30;
|
|
// ws.Row(6).Height = 30;
|
|
ws.Column(1).Width = 9;
|
|
ws.Column(2).Width = 40;
|
|
ws.Column(3).Width = 5;
|
|
ws.Column(4).Width = 5;
|
|
ws.Column(5).Width = 5;
|
|
ws.Column(6).Width = 5;
|
|
ws.Column(7).Width = 30;
|
|
ws.Column(8).Width = 5;
|
|
ws.Column(9).Width = 5;
|
|
ws.Column(10).Width = 10;
|
|
ws.Column(11).Width = 20;
|
|
ws.Column(12).Width = 5;
|
|
ws.Column(13).Width = 5;
|
|
ws.Column(14).Width = 5;
|
|
ws.Column(15).Width = 5;
|
|
ws.Column(16).Width = 5;
|
|
ws.Column(17).Width = 15;
|
|
ws.Column(18).Width = 15;
|
|
ws.Column(19).Width = 50;
|
|
|
|
int row = 5;
|
|
int no = 1;
|
|
|
|
// foreach (var build in summary_building_constructions)
|
|
// {
|
|
if (summary_building_constructions != null)
|
|
{
|
|
//string first = "สรุปแผนความต้องการ รายการก่อสร้างอาคารหรือสิ่งก่อสร้างและปรับปรุงซ่อมแซมต่อเติม ของมหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
|
|
string second = "ปีงบประมาณ " + summary_building_constructions.academic_year_name_th;
|
|
// string third = "หน่วยงาน/คณะ " + summary_building_constructions.agency_name_th +
|
|
// " พื้นที่ " + summary_building_constructions.location;
|
|
ws.Range("A1:S1").Merge().Value =
|
|
"สรุปแผนความต้องการ รายการก่อสร้างอาคารหรือสิ่งก่อสร้างและปรับปรุงซ่อมแซมต่อเติม ของมหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์" +
|
|
second;
|
|
ws.Range("A1:S1").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A1:S1").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Range("A2:S2").Merge().Value = second;
|
|
// ws.Range("A2:S2").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
// ws.Range("A2:S2").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Range("A3:S3").Merge().Value = third;
|
|
// ws.Range("A3:S3").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
// ws.Range("A3:S3").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Range("A1:A3").Style.Font.Bold = true;
|
|
// ws.Range("A1:A3").Style.Font.FontSize = 16;
|
|
// ws.Range("A1:A3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("L3").Value = summary_building_constructions.budget_year_1;
|
|
ws.Cell("L3").Style.Alignment.WrapText = true;
|
|
ws.Cell("L3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("L3").Style.Font.FontSize = 10;
|
|
ws.Cell("L3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("L3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("L3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("M3").Value = summary_building_constructions.budget_year_2;
|
|
ws.Cell("M3").Style.Alignment.WrapText = true;
|
|
ws.Cell("M3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("M3").Style.Font.FontSize = 10;
|
|
ws.Cell("M3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("M3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("M3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("N3").Value = summary_building_constructions.budget_year_3;
|
|
ws.Cell("N3").Style.Alignment.WrapText = true;
|
|
ws.Cell("N3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("N3").Style.Font.FontSize = 10;
|
|
ws.Cell("N3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("N3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("N3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("O3").Value = summary_building_constructions.budget_year_4;
|
|
ws.Cell("O3").Style.Alignment.WrapText = true;
|
|
ws.Cell("O3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("O3").Style.Font.FontSize = 10;
|
|
ws.Cell("O3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("O3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("O3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("P3").Value = summary_building_constructions.budget_year_5;
|
|
ws.Cell("P3").Style.Alignment.WrapText = true;
|
|
ws.Cell("P3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("P3").Style.Font.FontSize = 10;
|
|
ws.Cell("P3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("P3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell("P3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("L3:P3").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Range("Q2:R2").Merge().Value = "ความพร้อมสิ่งก่อสร้าง ปี " +
|
|
summary_building_constructions.academic_year;
|
|
ws.Range("Q2:R2").Style.Fill.BackgroundColor = XLColor.MistyRose;
|
|
ws.Cell("Q2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell("Q2").Style.Font.FontSize = 14;
|
|
ws.Range("Q2:R2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("Q2:R2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("Q2:R2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("L4:R4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("D4:F4").Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
|
ws.Range("H4:S4").Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
|
foreach (var buildings in summary_building_constructions.header_data)
|
|
{
|
|
if (buildings.color == 1)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = buildings.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = null;
|
|
ws.Cell(row, 9).Value = null;
|
|
ws.Cell(row, 10).Value = null;
|
|
ws.Cell(row, 11).Value = buildings.budget;
|
|
ws.Cell(row, 12).Value = buildings.price_1;
|
|
ws.Cell(row, 13).Value = buildings.price_2;
|
|
ws.Cell(row, 14).Value = buildings.price_3;
|
|
ws.Cell(row, 15).Value = buildings.price_4;
|
|
ws.Cell(row, 16).Value = buildings.price_5;
|
|
ws.Cell(row, 17).Value = null;
|
|
ws.Cell(row, 18).Value = null;
|
|
ws.Cell(row, 19).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(250,191,143);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
if (buildings.color == 2)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = buildings.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = null;
|
|
ws.Cell(row, 9).Value = null;
|
|
ws.Cell(row, 10).Value = null;
|
|
ws.Cell(row, 11).Value = buildings.budget;
|
|
ws.Cell(row, 12).Value = buildings.price_1;
|
|
ws.Cell(row, 13).Value = buildings.price_2;
|
|
ws.Cell(row, 14).Value = buildings.price_3;
|
|
ws.Cell(row, 15).Value = buildings.price_4;
|
|
ws.Cell(row, 16).Value = buildings.price_5;
|
|
ws.Cell(row, 17).Value = null;
|
|
ws.Cell(row, 18).Value = null;
|
|
ws.Cell(row, 19).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(183,222,232);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
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.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
foreach (var buildings1 in buildings.data)
|
|
{
|
|
if (buildings1.color == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = buildings1.faculty_name;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = null;
|
|
ws.Cell(row, 9).Value = null;
|
|
ws.Cell(row, 10).Value = null;
|
|
ws.Cell(row, 11).Value = buildings1.budget;
|
|
ws.Cell(row, 12).Value = buildings1.price_1;
|
|
ws.Cell(row, 13).Value = buildings1.price_2;
|
|
ws.Cell(row, 14).Value = buildings1.price_3;
|
|
ws.Cell(row, 15).Value = buildings1.price_4;
|
|
ws.Cell(row, 16).Value = buildings1.price_5;
|
|
ws.Cell(row, 17).Value = null;
|
|
ws.Cell(row, 18).Value = null;
|
|
ws.Cell(row, 19).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(204,192,218);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
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.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat
|
|
.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
foreach (var buildings2 in buildings1.data)
|
|
{
|
|
if (buildings2.color == 4)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = buildings2.list;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = null;
|
|
ws.Cell(row, 9).Value = null;
|
|
ws.Cell(row, 10).Value = null;
|
|
ws.Cell(row, 11).Value = buildings2.budget;
|
|
ws.Cell(row, 12).Value = buildings2.price_1;
|
|
ws.Cell(row, 13).Value = buildings2.price_2;
|
|
ws.Cell(row, 14).Value = buildings2.price_3;
|
|
ws.Cell(row, 15).Value = buildings2.price_4;
|
|
ws.Cell(row, 16).Value = buildings2.price_5;
|
|
ws.Cell(row, 17).Value = null;
|
|
ws.Cell(row, 18).Value = null;
|
|
ws.Cell(row, 19).Value = null;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(216,228,188);
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
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.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat
|
|
.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
|
|
|
|
foreach (var building3 in buildings2.data)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = building3.list;
|
|
ws.Cell(row, 3).Value = building3.total;
|
|
ws.Cell(row, 4).Value = building3.lesser;
|
|
ws.Cell(row, 5).Value = building3.between;
|
|
ws.Cell(row, 6).Value = building3.over;
|
|
ws.Cell(row, 7).Value = building3.problem;
|
|
ws.Cell(row, 8).Value = building3.type_1;
|
|
ws.Cell(row, 9).Value = building3.type_2;
|
|
ws.Cell(row, 10).Value = building3.renovated;
|
|
ws.Cell(row, 11).Value = building3.budget;
|
|
ws.Cell(row, 12).Value = building3.price_1;
|
|
ws.Cell(row, 13).Value = building3.price_2;
|
|
ws.Cell(row, 14).Value = building3.price_3;
|
|
ws.Cell(row, 15).Value = building3.price_4;
|
|
ws.Cell(row, 16).Value = building3.price_5;
|
|
ws.Cell(row, 17).Value = building3.boq;
|
|
ws.Cell(row, 18).Value = building3.image;
|
|
ws.Cell(row, 19).Value = building3.description;
|
|
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;
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
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.FontSize = 11;
|
|
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.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
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.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat
|
|
.SetFormat("#,#");
|
|
row++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
using (var stream = new MemoryStream())
|
|
{
|
|
workbook.SaveAs(stream);
|
|
var content = stream.ToArray();
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
content,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"building_" + date + ".xlsx");
|
|
}
|
|
}
|
|
}
|
|
|
|
[SwaggerOperation("สรุปงบลงทุน")]
|
|
[HttpPost, Route("reports/investment_budget_summary/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetInvestmentReport([FromRoute] string type,
|
|
[FromBody] investment_budget_summary investmentBudget)
|
|
{
|
|
foreach (var detail in investmentBudget.data)
|
|
{
|
|
if (detail.topic_type == 1)
|
|
{
|
|
detail.row_no = null;
|
|
}
|
|
|
|
if (detail.topic_type == 3)
|
|
{
|
|
detail.row_no = null;
|
|
}
|
|
}
|
|
|
|
var investmentBudgetSummaries = new List<investment_budget_summary>() { investmentBudget };
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "investment_budget_summary.frx");
|
|
report.RegisterData(investmentBudgetSummaries, "investment_budget_summary");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"investment_budget_summary" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("สรุป MTEF")]
|
|
[HttpPost, Route("reports/summary_mtef/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetMtefSumReport([FromRoute] string type,
|
|
[FromBody] summary_mtef mtef)
|
|
{
|
|
var sum1 = mtef.data.Sum(f => f.budget_1);
|
|
var sum2 = mtef.data.Sum(f => f.budget_2);
|
|
var sum3 = mtef.data.Sum(f => f.budget_3);
|
|
var sum4 = mtef.data.Sum(f => f.budget_4);
|
|
var sum5 = mtef.data.Sum(f => f.budget_5);
|
|
var sum6 = mtef.data.Sum(f => f.budget_6);
|
|
var sum7 = mtef.data.Sum(f => f.budget_7);
|
|
var sum8 = mtef.data.Sum(f => f.budget_8);
|
|
var sum9 = mtef.data.Sum(f => f.budget_9);
|
|
mtef.budget_1 = sum1;
|
|
mtef.budget_2 = sum2;
|
|
mtef.budget_3 = sum3;
|
|
mtef.budget_4 = sum4;
|
|
mtef.budget_5 = sum5;
|
|
mtef.budget_6 = sum6;
|
|
mtef.budget_7 = sum7;
|
|
mtef.budget_8 = sum8;
|
|
mtef.budget_9 = sum9;
|
|
var mtefs = new List<summary_mtef>() { mtef };
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "summary_mtef.frx");
|
|
report.RegisterData(mtefs, "summary_mtef");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"summary_mtef" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("MTEF แผนงาน ผลผลิต")]
|
|
[HttpPost, Route("reports/mtef_plan/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetMtefPlanReport([FromRoute] string type,
|
|
[FromBody] mtef_plan mtef)
|
|
{
|
|
var mtefs = new List<mtef_plan>() { mtef };
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "mtef_plan.frx");
|
|
report.RegisterData(mtefs, "mtef_plan");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"mtef_plan" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("ตารางสรุปกรอบความต้องการและสถานภาพความพร้อมรายการครุภัณฑ์ (รายการปีเดียว)")]
|
|
[HttpPost, Route("reports/summary_demand_status_equipment/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetSumDemandReport([FromRoute] string type,
|
|
[FromBody] summary_demand_status_equipment summaryDemandStatus)
|
|
{
|
|
summaryDemandStatus.request_assets_year_1 = summaryDemandStatus.request_assets_year_1.Substring(2, 2);
|
|
summaryDemandStatus.request_assets_year_2 = summaryDemandStatus.request_assets_year_2.Substring(2, 2);
|
|
summaryDemandStatus.request_assets_year_3 = summaryDemandStatus.request_assets_year_3.Substring(2, 2);
|
|
foreach (var detail in summaryDemandStatus.data)
|
|
{
|
|
if (detail.topic_type != 5)
|
|
{
|
|
detail.row_no = null;
|
|
detail.conform1 = null;
|
|
detail.conform2 = null;
|
|
detail.conform3 = null;
|
|
detail.standard_price1 = null;
|
|
detail.standard_price2 = null;
|
|
detail.standard_price3 = null;
|
|
detail.unique_feature1 = null;
|
|
detail.unique_feature2 = null;
|
|
detail.unique_feature3 = null;
|
|
}
|
|
|
|
if (detail.topic_type == 5)
|
|
{
|
|
if (detail.conform_1 == true)
|
|
{
|
|
detail.conform1 = "P";
|
|
}
|
|
|
|
if (detail.conform_2 == true)
|
|
{
|
|
detail.conform2 = "P";
|
|
}
|
|
|
|
if (detail.conform_3 == true)
|
|
{
|
|
detail.conform3 = "P";
|
|
}
|
|
|
|
if (detail.standard_price_1 == true)
|
|
{
|
|
detail.standard_price1 = "P";
|
|
}
|
|
|
|
if (detail.standard_price_2 == true)
|
|
{
|
|
detail.standard_price2 = "P";
|
|
}
|
|
|
|
if (detail.standard_price_3 == true)
|
|
{
|
|
detail.standard_price3 = "P";
|
|
}
|
|
|
|
if (detail.unique_feature_1 == true)
|
|
{
|
|
detail.unique_feature1 = "P";
|
|
}
|
|
|
|
if (detail.unique_feature_2 == true)
|
|
{
|
|
detail.unique_feature2 = "P";
|
|
}
|
|
|
|
if (detail.unique_feature_3 == true)
|
|
{
|
|
detail.unique_feature3 = "P";
|
|
}
|
|
}
|
|
}
|
|
|
|
var statusEquipments = new List<summary_demand_status_equipment>() { summaryDemandStatus };
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "summary_demand_status_equipment.frx");
|
|
report.RegisterData(statusEquipments, "summary_demand_status_equipment");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"summary_demand_status_equipment" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[SwaggerOperation("สรุปภาพรวมการเสนอแผนการปรับปรุงอาคารสถานที่/แผนการจัดหาที่ดินและสิ่งก่อสร้าง")]
|
|
[HttpPost, Route("reports/summary_overview_building/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetSumDemandReport([FromRoute] string type,
|
|
[FromBody] summary_overview_building summaryOverviewBuilding)
|
|
{
|
|
foreach (var detail in summaryOverviewBuilding.data)
|
|
{
|
|
if (detail.topic_type != 5)
|
|
{
|
|
detail.row_no = null;
|
|
}
|
|
|
|
if (detail.topic_type == 5)
|
|
{
|
|
if (detail.readiness_action_1 == true)
|
|
{
|
|
detail.readiness_action1 = "P";
|
|
}
|
|
|
|
if (detail.readiness_action_2 == true)
|
|
{
|
|
detail.readiness_action2 = "P";
|
|
}
|
|
|
|
if (detail.readiness_action_3 == true)
|
|
{
|
|
detail.readiness_action3 = "P";
|
|
}
|
|
|
|
if (detail.readiness_action_4 == true)
|
|
{
|
|
detail.readiness_action4 = "P";
|
|
}
|
|
|
|
|
|
if (detail.appearance_equipment_1 == true)
|
|
{
|
|
detail.appearance_equipment1 = "P";
|
|
}
|
|
|
|
if (detail.appearance_equipment_2 == true)
|
|
{
|
|
detail.appearance_equipment2 = "P";
|
|
}
|
|
|
|
if (detail.appearance_equipment_3 == true)
|
|
{
|
|
detail.appearance_equipment3 = "P";
|
|
}
|
|
}
|
|
}
|
|
|
|
var summaryOverview = new List<summary_overview_building>() { summaryOverviewBuilding };
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "summary_overview_building.frx");
|
|
report.RegisterData(summaryOverview, "summary_overview_building");
|
|
report.Prepare();
|
|
|
|
MemoryStream stream = new MemoryStream();
|
|
switch (type)
|
|
{
|
|
case "pdf":
|
|
PDFExport pdf = new PDFExport();
|
|
report.Export(pdf, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "application/pdf");
|
|
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"summary_overview_building" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
}
|
|
} |