diff --git a/Controllers/StudyMaterial.Controller.cs b/Controllers/StudyMaterial.Controller.cs index dfc8df0..7af61c9 100644 --- a/Controllers/StudyMaterial.Controller.cs +++ b/Controllers/StudyMaterial.Controller.cs @@ -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()) diff --git a/Models/budget/study_material.cs b/Models/budget/study_material.cs index 4adce13..c890649 100644 --- a/Models/budget/study_material.cs +++ b/Models/budget/study_material.cs @@ -8,7 +8,8 @@ namespace rmutr_report.Models public string product { get; set; } public string faculty { get; set; } public List data1 { get; set; } - //public string text { get; set; } + public decimal? total_cost_science { get; set; } + public decimal? total_cost_social { get; set; } } @@ -25,7 +26,8 @@ namespace rmutr_report.Models { public string year_class { get; set; } public string code { get; set; } - + public decimal? total_cost_science { get; set; } + public decimal? total_cost_social { get; set; } public List data3 { get; set; } } @@ -33,8 +35,6 @@ namespace rmutr_report.Models { public string academic_semester { get; set; } public string student { get; set; } - // public string code { get; set; } - // public string major { get; set; } public decimal? salaya { get; set; } public decimal? bophitphimuk { get; set; } public decimal? pohchang { get; set; } diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index 236f85f..6814f09 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index edf6ffe..31cfde8 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index 6211224..ad692c2 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index 6211224..ad692c2 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs b/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs index 39daae7..10f994c 100644 --- a/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs +++ b/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bb28a07de16511483ded679e4bc48870a9fc097f")] [assembly: System.Reflection.AssemblyProductAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache b/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache index 7d63e16..92ed1c6 100644 --- a/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache +++ b/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache @@ -1 +1 @@ -f5dfedcaccda50e61bd739707e09ac1f8f1f155f84f01a86842a0ff8ce71abef +8f5779e7467558ec5cd2c9bc43fb2ffc448a0a50afbcdf6ca1295bb1880e38c2 diff --git a/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache b/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache index cbe55bb..2caf3b6 100644 --- a/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache +++ b/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache @@ -1 +1 @@ -e70085a502f543e6f865dcae5f1f26615f0a238b62a14648a1d38a607a23489d +cb1b1e2688c6fd94813d4e16c2a00268702cbaa5fa86e9bffd6abee377f2b6a2 diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 236f85f..6814f09 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index edf6ffe..31cfde8 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfo.cs b/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfo.cs index 773657c..39daae7 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfo.cs +++ b/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ca12ecf690165da4200e0b4f724709e6a4358ec2")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfoInputs.cache b/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfoInputs.cache index 851afa5..7d63e16 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfoInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.AssemblyInfoInputs.cache @@ -1 +1 @@ -5bcb0645a46d5b2ae84fd794dd3c603837c4839ee4e2cd7c21a7c994a5058a2d +f5dfedcaccda50e61bd739707e09ac1f8f1f155f84f01a86842a0ff8ce71abef diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.AssemblyReference.cache b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.AssemblyReference.cache deleted file mode 100644 index ab463e7..0000000 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.AssemblyReference.cache and /dev/null differ diff --git a/obj/rider.project.model.nuget.info b/obj/rider.project.model.nuget.info index ae38e6d..81920f2 100644 --- a/obj/rider.project.model.nuget.info +++ b/obj/rider.project.model.nuget.info @@ -1 +1 @@ -17019436011989991 \ No newline at end of file +17024426939418254 \ No newline at end of file