update
This commit is contained in:
@@ -309,7 +309,7 @@ namespace rmutr_report.Controllers
|
||||
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;
|
||||
@@ -480,65 +480,301 @@ namespace rmutr_report.Controllers
|
||||
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 equipment in summary_of_equipments.data)
|
||||
foreach (var equipments in summary_of_equipments.header_data)
|
||||
{
|
||||
ws.Cell(row, 1).Value = no;
|
||||
no++;
|
||||
ws.Cell(row, 2).Value = equipment.list;
|
||||
ws.Cell(row, 3).Value = equipment.type_1;
|
||||
ws.Cell(row, 4).Value = equipment.type_2;
|
||||
ws.Cell(row, 5).Value = equipment.type_3;
|
||||
ws.Cell(row, 6).Value = equipment.unit;
|
||||
ws.Cell(row, 7).Value = equipment.quantity;
|
||||
ws.Cell(row, 8).Value = equipment.unit_price;
|
||||
ws.Cell(row, 9).Value = equipment.price_1;
|
||||
ws.Cell(row, 10).Value = equipment.price_2;
|
||||
ws.Cell(row, 11).Value = equipment.price_3;
|
||||
ws.Cell(row, 12).Value = equipment.price_4;
|
||||
ws.Cell(row, 13).Value = equipment.price_5;
|
||||
ws.Cell(row, 14).Value = equipment.amount;
|
||||
ws.Cell(row, 15).Value = equipment.company;
|
||||
ws.Cell(row, 16).Value = equipment.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 Sarabun New";
|
||||
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;
|
||||
row++;
|
||||
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 Sarabun New";
|
||||
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.BabyBlue;
|
||||
|
||||
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 Sarabun New";
|
||||
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.LavenderPurple;
|
||||
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 == 3)
|
||||
{
|
||||
|
||||
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 Sarabun New";
|
||||
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.GrannySmithApple;
|
||||
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 equipment in equipments.data)
|
||||
{
|
||||
|
||||
ws.Cell(row, 1).Value = no;
|
||||
no++;
|
||||
ws.Cell(row, 2).Value = equipment.list;
|
||||
ws.Cell(row, 3).Value = equipment.type_1;
|
||||
ws.Cell(row, 4).Value = equipment.type_2;
|
||||
ws.Cell(row, 5).Value = equipment.type_3;
|
||||
ws.Cell(row, 6).Value = equipment.unit;
|
||||
ws.Cell(row, 7).Value = equipment.quantity;
|
||||
ws.Cell(row, 8).Value = equipment.unit_price;
|
||||
ws.Cell(row, 9).Value = equipment.price_1;
|
||||
ws.Cell(row, 10).Value = equipment.price_2;
|
||||
ws.Cell(row, 11).Value = equipment.price_3;
|
||||
ws.Cell(row, 12).Value = equipment.price_4;
|
||||
ws.Cell(row, 13).Value = equipment.price_5;
|
||||
ws.Cell(row, 14).Value = equipment.amount;
|
||||
ws.Cell(row, 15).Value = equipment.company;
|
||||
ws.Cell(row, 16).Value = equipment.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 Sarabun New";
|
||||
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 = equipment.amount;
|
||||
string str = equipment.amount+"\n"+ equipment.amount+"\n"+ equipment.amount;
|
||||
//string str3 = str2.Substring(7, 39);
|
||||
if (str.Length == 4)
|
||||
{
|
||||
for (int i = 1; i <= str.Length - 1; i += 4)
|
||||
{
|
||||
equipment.amount = str.Insert(i, ",");
|
||||
}
|
||||
}
|
||||
else if (str.Length == 5)
|
||||
{
|
||||
for (int i = 2; i <= str.Length - 1; i += 5)
|
||||
{
|
||||
equipment.amount= str.Insert(i, ",");
|
||||
}
|
||||
}
|
||||
else if (str.Length == 6)
|
||||
{
|
||||
for (int i = 3; i <= str.Length - 1; i += 6)
|
||||
{
|
||||
equipment.amount= str.Insert(i, ",");
|
||||
}
|
||||
}
|
||||
else if (str.Length == 7)
|
||||
{
|
||||
for (int i = 4; i <= str.Length - 1; i += 7)
|
||||
{
|
||||
equipment.amount= str.Insert(i, ",");
|
||||
}
|
||||
}
|
||||
|
||||
else if (str.Length == 7)
|
||||
{
|
||||
for (int i = 4; i <= str.Length - 1; i += 7)
|
||||
{
|
||||
equipment.amount= str.Insert(i, ",");
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
equipment.amount = str;
|
||||
}
|
||||
row++;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
@@ -547,23 +783,10 @@ namespace rmutr_report.Controllers
|
||||
workbook.SaveAs(stream);
|
||||
var content = stream.ToArray();
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
// switch (type)
|
||||
// {
|
||||
// case "pdf":
|
||||
// //Response.Clear();
|
||||
// Response.Headers.Clear();
|
||||
// Response.ContentType = "application/pdf";
|
||||
// Response.Headers.Add("Content-Length", content.Length.ToString());
|
||||
// stream.Seek(0, SeekOrigin.Begin);
|
||||
// return File(content,
|
||||
// "application/pdf",
|
||||
// "equipment_" + date + ".pdf");
|
||||
// case "xlsx":
|
||||
return File(
|
||||
return File(
|
||||
content,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"equipment_" + date + ".xlsx");
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,32 @@ namespace rmutr_report.Models
|
||||
public class summary_of_equipment_five_year
|
||||
{
|
||||
public string academic_year { get; set; }
|
||||
public string budget_year { get; set; }
|
||||
public string budget_year_1 { get; set; }
|
||||
public string budget_year_2 { get; set; }
|
||||
public string budget_year_3 { get; set; }
|
||||
public string budget_year_4 { get; set; }
|
||||
public string budget_year_5 { get; set; }
|
||||
public List<summary_of_equipment_five_years> header_data { get; set; }
|
||||
}
|
||||
|
||||
public class summary_of_equipment_five_years
|
||||
{
|
||||
public int? color { get; set; }
|
||||
public string list { get; set; }
|
||||
public decimal? unit_price { get; set; }
|
||||
public decimal? price_1 { get; set; }
|
||||
public decimal? price_2 { get; set; }
|
||||
public decimal? price_3 { get; set; }
|
||||
public decimal? price_4 { get; set; }
|
||||
public decimal? price_5 { get; set; }
|
||||
public List<summary_of_equipment_five_year_detail> data { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class summary_of_equipment_five_year_detail
|
||||
{
|
||||
//public int? no { get; set; }
|
||||
//public int? color { get; set; }
|
||||
public string list { get; set; }
|
||||
public string type_1 { get; set; }
|
||||
public string type_2 { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user