bug fixed
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kamonwan taengsuk
2023-12-13 14:30:49 +07:00
parent bb28a07de1
commit 5942f73550
15 changed files with 44 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ClosedXML.Excel;
using Microsoft.AspNetCore.Mvc;
using rmutr_report.Models;
@@ -35,7 +36,7 @@ namespace rmutr_report.Controllers
ws.Cell("A1").Style.Font.FontSize = 16;
ws.Range("A1:J1").Style.Font.Bold = true;
ws.Range("A2:J2").Merge().Value =
"ผลผลิต " + _study_material.product + " คณะ " + _study_material.faculty;
"ผลผลิต " + _study_material.product +" " + _study_material.faculty;
ws.Range("A2:J2").Style.Alignment.WrapText = true;
ws.Range("A2:J2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A2:J2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
@@ -143,11 +144,13 @@ namespace rmutr_report.Controllers
var row1 = ws.Row(3);
row1.Height = 20;
int row = 6;
if (_study_material != null)
{
foreach (var data in _study_material.data1)
{
// ws.Cell(row, 1).Value = "ภาคการศึกษา " + data.academic_semester + "/" + data.academic_year;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName =
// "TH SarabunPSK";
@@ -180,6 +183,8 @@ namespace rmutr_report.Controllers
// ws.Cell(row, 1).Value = "ภาคการศึกษา " + data.academic_semester + "/" + data.academic_year;
ws.Cell(row, 2).Value =
"ชั้นปีที่ " + data2.year_class + " (รหัส " + data.academic_year + ")";
ws.Cell(row, 9).Value = data2.total_cost_science;
ws.Cell(row, 10).Value = data2.total_cost_social;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontSize = 16;
@@ -208,7 +213,7 @@ namespace rmutr_report.Controllers
row++;
foreach (var data3 in data2.data3)
{
//_study_material.text = " - สาขา ";
if (data3.academic_semester == "รวม" ||
data3.academic_semester == "รวม 1 ปีภาคการศึกษา")
{
@@ -291,12 +296,12 @@ namespace rmutr_report.Controllers
ws.Range(ws.Cell(row, 3), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
//row++;
}
row++;
}
}
// if (data.academic_semester != "รวม")
// {
// ws.Cell(row, 1).Value = data.academic_semester;
@@ -378,6 +383,31 @@ namespace rmutr_report.Controllers
// row++;
// }
}
if (_study_material.total_cost_science !=null &&_study_material.total_cost_social !=null)
{
ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Merge().Value = "รวมทั้งหมด";
ws.Cell(row, 9).Value = _study_material.total_cost_science;
ws.Cell(row, 10).Value = _study_material.total_cost_social;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), 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.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Font.Bold = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.RightBorder =
XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 9), ws.Cell(row, 10)).SetDataType(XLDataType.Number);
ws.Range(ws.Cell(row, 9), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
}
}
using (var stream = new MemoryStream())