2422 lines
148 KiB
C#
2422 lines
148 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using ClosedXML.Excel;
|
|
using FastReport;
|
|
using FastReport.Export.Csv;
|
|
using FastReport.Export.Mht;
|
|
using FastReport.Export.OoXML;
|
|
using FastReport.Export.Pdf;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using rmutr_report.Models;
|
|
using rmutr_report.Models.RoThree;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
|
|
namespace rmutr_report.Controllers
|
|
{
|
|
[SwaggerTag("สำหรับรายงาน ร.(คำของบประมาณรายจ่ายจากเงินรายได้)")]
|
|
public class Ro : Controller
|
|
{
|
|
readonly Setting _setting;
|
|
|
|
public Ro(Setting setting)
|
|
{
|
|
this._setting = setting;
|
|
}
|
|
|
|
[HttpPost, Route("reports/ro_five/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetRoFiveReport([FromRoute] string type, [FromBody] ro_five building_fours)
|
|
{
|
|
foreach (var a in building_fours.building_type)
|
|
{
|
|
if (a.usage_per_target != null)
|
|
{
|
|
var a1 = a.usage_per_target.Where(d => d.used_year == d.used_year)
|
|
.Sum(o => o.used_year);
|
|
building_fours.sum_year1 = a1;
|
|
var a2 = a.usage_per_target.Where(d => d.year1 == d.year1)
|
|
.Sum(o => o.year1);
|
|
building_fours.sum_year2 = a2;
|
|
var a3 = a.usage_per_target.Where(d => d.year2 == d.year2)
|
|
.Sum(o => o.year2);
|
|
building_fours.sum_year3 = a3;
|
|
var a4 = a.usage_per_target.Where(d => d.year3 == d.year3)
|
|
.Sum(o => o.year3);
|
|
building_fours.sum_year4 = a4;
|
|
var a5 = a.usage_per_target.Where(d => d.year4 == d.year4)
|
|
.Sum(o => o.year4);
|
|
building_fours.sum_year5 = a5;
|
|
var a6 = a.usage_per_target.Where(d => d.year5 == d.year5)
|
|
.Sum(o => o.year5);
|
|
building_fours.sum_year6 = a6;
|
|
}
|
|
}
|
|
|
|
// foreach (var bb in building_fours.material_construction_labor1)
|
|
// {
|
|
// if (bb != null)
|
|
// {
|
|
// bb.total_amount = bb.material_cost + bb.labor_unit;
|
|
// var f = building_fours.material_construction_labor1.Where(d => d.total_amount == d.total_amount)
|
|
// .Sum(o => o.total_amount);
|
|
// building_fours.material_total_amount1 = f;
|
|
// }
|
|
// }
|
|
// foreach (var bb in building_fours.material_construction_labor2)
|
|
// {
|
|
// if (bb != null)
|
|
// {
|
|
// bb.total_amount = bb.material_cost + bb.labor_unit;
|
|
// var f = building_fours.material_construction_labor2.Where(d => d.total_amount == d.total_amount)
|
|
// .Sum(o => o.total_amount);
|
|
// building_fours.material_total_amount2 = f;
|
|
// }
|
|
// }
|
|
// foreach (var bb in building_fours.material_construction_labor3)
|
|
// {
|
|
// if (bb != null)
|
|
// {
|
|
// bb.total_amount = bb.material_cost + bb.labor_unit;
|
|
// var f = building_fours.material_construction_labor3.Where(d => d.total_amount == d.total_amount)
|
|
// .Sum(o => o.total_amount);
|
|
// building_fours.material_total_amount3 = f;
|
|
// }
|
|
// }
|
|
foreach (var cc in building_fours.budget_limit)
|
|
{
|
|
if (cc != null)
|
|
{
|
|
var a = building_fours.budget_limit.Where(d => d.amount == d.amount)
|
|
.Sum(o => o.amount);
|
|
building_fours.amount = a;
|
|
if (cc.outside_amount != null)
|
|
{
|
|
var b = building_fours.budget_limit.Where(d => d.outside_amount == d.outside_amount)
|
|
.Sum(o => o.outside_amount);
|
|
building_fours.outside_amount = b;
|
|
}
|
|
|
|
if (cc.outside_amount == null)
|
|
{
|
|
building_fours.outside_amount = null;
|
|
}
|
|
|
|
if (cc.amount != null && cc.outside_amount != null)
|
|
{
|
|
cc.total_amount = cc.amount + cc.outside_amount;
|
|
}
|
|
|
|
var c = building_fours.budget_limit.Where(d => d.total_amount == d.total_amount)
|
|
.Sum(o => o.total_amount);
|
|
building_fours.total_amount = c;
|
|
}
|
|
}
|
|
|
|
foreach (var boqPrice in building_fours.basic_information)
|
|
{
|
|
if (boqPrice.list != null)
|
|
{
|
|
string str = boqPrice.list;
|
|
string num = String.Concat(str.Where(c => c >= '0' && c <= '9'));
|
|
|
|
if (num.Length == 4)
|
|
{
|
|
for (int i = 1; i <= num.Length - 1; i += 4)
|
|
{
|
|
boqPrice.list = num.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (num.Length == 5)
|
|
{
|
|
for (int i = 2; i <= num.Length - 1; i += 5)
|
|
{
|
|
boqPrice.list = num.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (num.Length == 6)
|
|
{
|
|
for (int i = 3; i <= num.Length - 1; i += 6)
|
|
{
|
|
boqPrice.list = num.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (num.Length == 7)
|
|
{
|
|
for (int i = 1, j = 5; i <= num.Length - 1; i += 7, j += 7)
|
|
{
|
|
boqPrice.list = num.Insert(i, ",").Insert(j, ",");
|
|
}
|
|
}
|
|
else if (num.Length == 8)
|
|
{
|
|
for (int i = 2, j = 6; i <= num.Length - 1; i += 8, j += 8)
|
|
{
|
|
boqPrice.list = num.Insert(i, ",").Insert(j, ",");
|
|
}
|
|
}
|
|
|
|
if (boqPrice.list == "20000000.0000")
|
|
{
|
|
boqPrice.list = "20,000,000";
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var boqPrice in building_fours.boq)
|
|
{
|
|
if (boqPrice.is_data == "1")
|
|
{
|
|
string str = boqPrice.have;
|
|
if (str.Length == 4)
|
|
{
|
|
for (int i = 1; i <= str.Length - 1; i += 4)
|
|
{
|
|
boqPrice.have = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 5)
|
|
{
|
|
for (int i = 2; i <= str.Length - 1; i += 5)
|
|
{
|
|
boqPrice.have = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 6)
|
|
{
|
|
for (int i = 3; i <= str.Length - 1; i += 6)
|
|
{
|
|
boqPrice.have = str.Insert(i, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 7)
|
|
{
|
|
for (int i = 1, j = 5; i <= str.Length - 1; i += 7, j += 7)
|
|
{
|
|
boqPrice.have = str.Insert(i, ",").Insert(j, ",");
|
|
}
|
|
}
|
|
else if (str.Length == 8)
|
|
{
|
|
for (int i = 2, j = 6; i <= str.Length - 1; i += 8, j += 8)
|
|
{
|
|
boqPrice.have = str.Insert(i, ",").Insert(j, ",");
|
|
}
|
|
}
|
|
|
|
// if (boqPrice.have == "10000000")
|
|
// {
|
|
// boqPrice.have = "10,000,000";
|
|
// }
|
|
boqPrice.text1 = "- มี วงเงิน " + boqPrice.have + " บาท";
|
|
boqPrice.text2 = "- ดำเนินการจัดทำ BOQ เดือน " + boqPrice.pending_boq_month;
|
|
boqPrice.text3 = "- BOQ แล้วเสร็จเดือน " + boqPrice.done_boq_month;
|
|
boqPrice.text4 = "- ขออนุมัติ BOQ เดือน " + boqPrice.approval_month;
|
|
boqPrice.text5 = "- ทำสัญญาก่อสร้าง เดือน " + boqPrice.construction_contract_month;
|
|
}
|
|
|
|
if (boqPrice.is_data == "2")
|
|
{
|
|
boqPrice.text1 = "- ไม่มี";
|
|
boqPrice.text2 = "- กรณีไม่มีคาดว่าจะแล้วเสร็จ เดือน " + boqPrice.months + " ปี " +
|
|
boqPrice.years;
|
|
boqPrice.text3 = "- ขณะนี้อยูในขั้นตอน " + boqPrice.step;
|
|
}
|
|
}
|
|
|
|
|
|
var _budget_summary_report = new List<ro_five>() { building_fours };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "ro_five.frx");
|
|
report.RegisterData(_budget_summary_report, "ro_five");
|
|
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.ms-excel");
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
date + ".xlsx");
|
|
break;
|
|
case "doc":
|
|
case "docx":
|
|
Word2007Export word = new Word2007Export();
|
|
report.Export(word, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return File(stream, "appllication/vnd.ms-word");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/external_research/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetExReport([FromRoute] string type, [FromBody] external_research external)
|
|
{
|
|
var s1 = external.data.Sum(g => g.budget_1);
|
|
var s2 = external.data.Sum(g => g.budget_2);
|
|
var s3 = external.data.Sum(g => g.budget_3);
|
|
var s4 = external.data.Sum(g => g.budget_4);
|
|
var s5 = external.data.Sum(g => g.budget_5);
|
|
var s6 = external.data.Sum(g => g.budget_received);
|
|
var s7 = external.data.Sum(g => g.total_budget);
|
|
var s8 = external.data.Sum(g => g.expenses);
|
|
if (s1 != null && s2 != null && s3 != null && s4 != null && s5 != null)
|
|
{
|
|
external.project_amount = s6;
|
|
external.total_1 = s6;
|
|
//external.total_8 = s7;
|
|
external.total_2 = s8;
|
|
external.total_3 = s1;
|
|
external.total_4 = s2;
|
|
external.total_5 = s3;
|
|
external.total_6 = s4;
|
|
external.total_7 = s5;
|
|
}
|
|
|
|
CultureInfo culture = new CultureInfo("th-TH");
|
|
|
|
if (external.data_date != null)
|
|
{
|
|
external.data_day = external.data_date.Value.ToString("dd", culture);
|
|
external.data_month = external.data_date.Value.ToString("MMMM", culture);
|
|
external.data_year = external.data_date.Value.ToString("yyyy", culture);
|
|
}
|
|
|
|
if (external.data_date == null)
|
|
{
|
|
external.data_day = "";
|
|
external.data_month = "";
|
|
external.data_year = "";
|
|
}
|
|
|
|
if (external.data != null)
|
|
{
|
|
foreach (var data in external.data)
|
|
{
|
|
data.total_budget = data.budget_1 + data.budget_2 + data.budget_3 + data.budget_4 +
|
|
data.budget_5;
|
|
var ss = external.data.Sum(y => y.total_budget);
|
|
external.institutional_subsidy_fee = ss;
|
|
external.total_8 = external.institutional_subsidy_fee;
|
|
}
|
|
}
|
|
|
|
|
|
var _budget_summary_report = new List<external_research>() { external };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "external_research.frx");
|
|
report.RegisterData(_budget_summary_report, "external_research");
|
|
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");
|
|
break;
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
//return File(stream, "application/vnd.ms-excel");
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
date + ".xlsx");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/ro_nine/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetNineReport([FromRoute] string type, [FromBody] ro_nine external)
|
|
{
|
|
var s1 = external.data.Sum(g => g.budget_1);
|
|
var s2 = external.data.Sum(g => g.budget_2);
|
|
var s3 = external.data.Sum(g => g.budget_3);
|
|
var s4 = external.data.Sum(g => g.budget_4);
|
|
var s5 = external.data.Sum(g => g.budget_5);
|
|
var s6 = external.data.Sum(g => g.budget_received);
|
|
var s7 = external.data.Sum(g => g.total_budget);
|
|
var s8 = external.data.Sum(g => g.expenses);
|
|
if (s1 != null && s2 != null && s3 != null && s4 != null && s5 != null)
|
|
{
|
|
external.total_1 = s6;
|
|
//external.total_8 = s7;
|
|
external.total_2 = s8;
|
|
external.total_3 = s1;
|
|
external.total_4 = s2;
|
|
external.total_5 = s3;
|
|
external.total_6 = s4;
|
|
external.total_7 = s5;
|
|
}
|
|
|
|
CultureInfo culture = new CultureInfo("th-TH");
|
|
|
|
if (external.data_date != null)
|
|
{
|
|
external.data_day = external.data_date.Value.ToString("dd", culture);
|
|
external.data_month = external.data_date.Value.ToString("MMMM", culture);
|
|
external.data_year = external.data_date.Value.ToString("yyyy", culture);
|
|
}
|
|
|
|
if (external.data_date == null)
|
|
{
|
|
external.data_day = "";
|
|
external.data_month = "";
|
|
external.data_year = "";
|
|
}
|
|
|
|
if (external.data != null)
|
|
{
|
|
foreach (var data in external.data)
|
|
{
|
|
data.total_budget = data.budget_1 + data.budget_2 + data.budget_3 + data.budget_4 + data.budget_5;
|
|
var ss = external.data.Sum(y => y.total_budget);
|
|
external.total_8 = ss;
|
|
}
|
|
}
|
|
|
|
var _budget_summary_report = new List<ro_nine>() { external };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "ro_nine.frx");
|
|
report.RegisterData(_budget_summary_report, "ro_nine");
|
|
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");
|
|
break;
|
|
case "xls":
|
|
case "xlsx":
|
|
Excel2007Export excel = new Excel2007Export();
|
|
report.Export(excel, stream);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
//return File(stream, "application/vnd.ms-excel");
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
date + ".xlsx");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/ro_ten/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetTenReport([FromRoute] string type, [FromBody] ro_ten ten)
|
|
{
|
|
var t_ten = ten.data.ToArray();
|
|
if (t_ten != null)
|
|
{
|
|
// var t1 = ten.data.Sum(g => g.amount_1);
|
|
// var t2 = ten.data.Sum(g => g.amount_2);
|
|
// var t3 = ten.data.Sum(g => g.amount_3);
|
|
// var t2 = t_ten.Sum(g => g.amount_2);
|
|
// var t3 = t_ten.Sum(g => g.amount_3);
|
|
|
|
|
|
foreach (var detail in t_ten)
|
|
{
|
|
var s1 = detail.data_detail.Sum(g => g.amount_1);
|
|
var s2 = detail.data_detail.Sum(g => g.amount_2);
|
|
var s3 = detail.data_detail.Sum(g => g.amount_3);
|
|
// var s4 = t_ten.Sum(g => g.amount_1);
|
|
// var s5 = t_ten.Sum(g => g.amount_2);
|
|
// var s6 = t_ten.Sum(g => g.amount_3);
|
|
detail.amount_1 = s1;
|
|
detail.amount_2 = s2;
|
|
detail.amount_3 = s3;
|
|
}
|
|
}
|
|
|
|
var _budget_summary_report = new List<ro_ten>() { ten };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "ro_ten.frx");
|
|
report.RegisterData(_budget_summary_report, "ro_ten");
|
|
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.ms-excel");
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
date + ".xlsx");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/ro_eleven/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetEleReport([FromRoute] string type, [FromBody] ro_eleven eleven)
|
|
{
|
|
var t_eleven = eleven.data.ToArray();
|
|
if (t_eleven != null)
|
|
{
|
|
var t1 = eleven.data.Sum(g => g.amount_1);
|
|
var t2 = eleven.data.Sum(g => g.amount_2);
|
|
var t3 = eleven.data.Sum(g => g.amount_3);
|
|
eleven.total_amount_1 = t1;
|
|
eleven.total_amount_2 = t2;
|
|
eleven.total_amount_3 = t3;
|
|
}
|
|
|
|
var ele = new List<ro_eleven>() { eleven };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "ro_eleven.frx");
|
|
report.RegisterData(ele, "ro_eleven");
|
|
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.ms-excel");
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
stream,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
date + ".xlsx");
|
|
break;
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/revenue_estimate_income_summary/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetEstimateIncomeReport([FromRoute] string type,
|
|
[FromBody] revenue_estimate_income_summary estimate)
|
|
{
|
|
var s1 = estimate.data.Sum(d => d.science_1);
|
|
var s2 = estimate.data.Sum(d => d.social_1);
|
|
var s3 = estimate.data.Sum(d => d.science_2);
|
|
var s4 = estimate.data.Sum(d => d.social_2);
|
|
var s5 = estimate.data.Sum(d => d.total_register_fee);
|
|
var s6 = estimate.data.Sum(d => d.science_3);
|
|
var s7 = estimate.data.Sum(d => d.social_3);
|
|
var s8 = estimate.data.Sum(d => d.science_4);
|
|
var s9 = estimate.data.Sum(d => d.social_4);
|
|
var s10 = estimate.data.Sum(d => d.total_education_fee);
|
|
var s11 = estimate.data.Sum(d => d.total_science);
|
|
var s12 = estimate.data.Sum(d => d.total_social);
|
|
var s13 = estimate.data.Sum(d => d.total_science_social);
|
|
|
|
estimate.sum_1 = s1;
|
|
estimate.sum_2 = s2;
|
|
estimate.sum_3 = s3;
|
|
estimate.sum_4 = s4;
|
|
estimate.sum_5 = s5;
|
|
estimate.sum_6 = s6;
|
|
estimate.sum_7 = s7;
|
|
estimate.sum_8 = s8;
|
|
estimate.sum_9 = s9;
|
|
estimate.sum_10 = s10;
|
|
estimate.sum_11 = s11;
|
|
estimate.sum_12 = s12;
|
|
estimate.sum_13 = s13;
|
|
var estimateEducation = new List<revenue_estimate_income_summary>() { estimate };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "revenue_estimate_income_summary.frx");
|
|
report.RegisterData(estimateEducation, "revenue_estimate_income_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",
|
|
"estimateincome_" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/revenue_estimate_education_fee/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetEstimateReport([FromRoute] string type,
|
|
[FromBody] revenue_estimate_education_fee estimate)
|
|
{
|
|
var estimateEducation = new List<revenue_estimate_education_fee>() { estimate };
|
|
|
|
Report report = new Report();
|
|
report.Load(_setting.report_path + "revenue_estimate_education_fee.frx");
|
|
report.RegisterData(estimateEducation, "revenue_estimate_education_fee");
|
|
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",
|
|
"estimateEducation" + ".xlsx");
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost, Route("reports/revenue_estimate_register_credits/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetDetailKpiReport([FromRoute] string type,
|
|
[FromBody] revenue_estimate_register_credits revenueEstimate)
|
|
{
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("ร.12");
|
|
ws.Range("A1:R1").Merge().Value =
|
|
"งบประมาณรายจ่ายจากเงินรายได้ ประจำปีงบประมาณ พ.ศ. " + revenueEstimate.budget_year;
|
|
ws.Range("A1:R1").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("A1:R1").Style.Font.SetBold().Font.FontSize = 22;
|
|
ws.Range("A1:R1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A2:R2").Merge().Value =
|
|
"ประมาณการรายรับภาคปกติ ของคณะศิลปศาสตร์ จาก ค่าหน่วยกิตที่ลงทะเบียน ( พื้นที่ " +
|
|
revenueEstimate.area + " ) " + "จากการจัดการศึกษาให้แก่" + revenueEstimate.faculty + " ภาคเรียนที่ " +
|
|
revenueEstimate.semester + "/" + revenueEstimate.year;
|
|
ws.Range("A2:R2").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("A2:R2").Style.Font.SetBold().Font.FontSize = 22;
|
|
ws.Range("A2:R2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A3:C3").Merge().Value = "ประมาณการรายรับจากการจัดการศึกษาด้าน ";
|
|
ws.Range("A3:C3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("A3:C3").Style.Font.SetBold().Font.FontSize = 22;
|
|
ws.Range("A3:C3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("D3").Value = "þ";
|
|
ws.Cell("D3").Style.Font.Bold = true;
|
|
ws.Cell("D3").Style.Font.FontName = "Wingdings";
|
|
ws.Cell("D3").Style.Font.SetBold().Font.FontSize = 22;
|
|
ws.Cell("D3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell("D3").Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180);
|
|
ws.Range("E3:M3").Merge().Value = revenueEstimate.budget_project_name_th;
|
|
ws.Range("E3:M3").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("E3:M3").Style.Font.SetBold().Font.FontSize = 22;
|
|
ws.Range("E3:M3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range("E3:M3").Style.Fill.BackgroundColor = XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range("A4:A6").Merge().Value = "ลำดับที่";
|
|
ws.Range("A4:A6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("A4:A6").Style.Font.SetBold().Font.FontSize = 16;
|
|
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.Range("B4:B6").Merge().Value = "รหัสวิชา";
|
|
ws.Range("B4:B6").Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range("B4:B6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("B4:B6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("B4:B6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("B4:B6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
|
|
ws.Range("C4:C6").Merge().Value = "ชื่อรายวิชา";
|
|
ws.Range("C4:C6").Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range("C4:C6").Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range("C4:C6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C4:C6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("C4:C6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
|
|
ws.Column(1).Width = 10;
|
|
ws.Column(2).Width = 15;
|
|
ws.Column(3).Width = 30;
|
|
// ws.Column(4).Width = 10;
|
|
// ws.Column(5).Width = 10;
|
|
// ws.Column(6).Width = 10;
|
|
// ws.Column(7).Width = 10;
|
|
// ws.Column(8).Width = 10;
|
|
// ws.Column(9).Width = 10;
|
|
// ws.Column(10).Width = 10;
|
|
// ws.Column(11).Width = 10;
|
|
// ws.Column(12).Width = 10;
|
|
// ws.Column(13).Width = 10;
|
|
// ws.Column(15).Width = 10;
|
|
// ws.Column(16).Width = 10;
|
|
// ws.Column(17).Width = 10;
|
|
// ws.Column(18).Width = 10;
|
|
// ws.Column(19).Width = 10;
|
|
// ws.Column(20).Width = 10;
|
|
// ws.Column(21).Width = 10;
|
|
// ws.Column(22).Width = 10;
|
|
// ws.Column(23).Width = 10;
|
|
// ws.Column(24).Width = 10;
|
|
// ws.Column(25).Width = 10;
|
|
// ws.Column(26).Width = 10;
|
|
// ws.Column(27).Width = 10;
|
|
// ws.Column(28).Width = 10;
|
|
// ws.Column(29).Width = 10;
|
|
// ws.Column(30).Width = 10;
|
|
ws.Columns("D", "AE").AdjustToContents();
|
|
|
|
|
|
int col = 4;
|
|
int rowhead = 5;
|
|
int row = 7;
|
|
int no = 1;
|
|
if (revenueEstimate != null)
|
|
{
|
|
foreach (var i in revenueEstimate.majors)
|
|
{
|
|
//ws.Cell(rowhead, col).Value = i.major_name;
|
|
ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead + 1, col)).Merge().Value = i.major_name;
|
|
ws.Cell(rowhead, col).Style.Alignment.SetTextRotation(90);
|
|
ws.Cell(rowhead, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(rowhead, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell(rowhead, col).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(rowhead, col).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(rowhead, col).Style.Font.FontSize = 16;
|
|
ws.Range(ws.Cell(rowhead, col), ws.Cell(rowhead + 1, col)).Style.Alignment.WrapText = true;
|
|
col++;
|
|
var a = revenueEstimate.majors.Count;
|
|
|
|
if (a == 1)
|
|
{
|
|
ws.Range("D4:E4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("E5").Value = "รวม";
|
|
ws.Cell("E6").Value = "( 1 )";
|
|
ws.Cell("F5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("F6").Value = "( 2 )";
|
|
ws.Cell("G5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("G6").Value = "( 3 )";
|
|
ws.Cell("H5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("H6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("I5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("I6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("J5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("J6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("F5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("G5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("F4:J4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 10)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 10)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 10)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 10)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 10)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 10)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:E4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("F4:J4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 10)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 10)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
// ws.Cell("D4").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
// ws.Cell("D4").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 2)
|
|
{
|
|
ws.Range("D4:F4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("F5").Value = "รวม";
|
|
ws.Cell("F6").Value = "( 1 )";
|
|
ws.Cell("G5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("G6").Value = "( 2 )";
|
|
ws.Cell("H5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("H6").Value = "( 3 )";
|
|
ws.Cell("I5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("I6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("J5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("J6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("K5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("K6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("G5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("H5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("G4:K4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 11)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 11)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 11)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:F4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("G4:K4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 11)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 11)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 3)
|
|
{
|
|
ws.Range("D4:G4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("G5").Value = "รวม";
|
|
ws.Cell("G6").Value = "( 1 )";
|
|
ws.Cell("H5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("H6").Value = "( 2 )";
|
|
ws.Cell("I5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("I6").Value = "( 3 )";
|
|
ws.Cell("J5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("J6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("K5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("K6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("L5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("L6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("H5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("I5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("H4:L4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 12)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 12)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 12)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 4)
|
|
{
|
|
ws.Range("D4:H4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("H5").Value = "รวม";
|
|
ws.Cell("H6").Value = "( 1 )";
|
|
ws.Cell("I5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("I6").Value = "( 2 )";
|
|
ws.Cell("J5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("J6").Value = "( 3 )";
|
|
ws.Cell("K5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("K6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("L5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("L6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("M5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("M6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("I5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("J5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("I4:M4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 13)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 13)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 13)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 13)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 5)
|
|
{
|
|
ws.Range("D4:I4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("I5").Value = "รวม";
|
|
ws.Cell("I6").Value = "( 1 )";
|
|
ws.Cell("J5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("J6").Value = "( 2 )";
|
|
ws.Cell("K5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("K6").Value = "( 3 )";
|
|
ws.Cell("L5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("L6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("M5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("M6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("N5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("N6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("J5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("K5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("J4:N4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 14)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 14)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 14)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 14)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 6)
|
|
{
|
|
ws.Range("D4:J4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("J5").Value = "รวม";
|
|
ws.Cell("J6").Value = "( 1 )";
|
|
ws.Cell("K5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("K6").Value = "( 2 )";
|
|
ws.Cell("L5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("L6").Value = "( 3 )";
|
|
ws.Cell("M5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("M6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("N5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("N6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("O5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("O6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("K5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("L5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("K4:O4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 15)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 15)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 15)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 15)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 7)
|
|
{
|
|
ws.Range("D4:K4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("K5").Value = "รวม";
|
|
ws.Cell("K6").Value = "( 1 )";
|
|
ws.Cell("L5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("L6").Value = "( 2 )";
|
|
ws.Cell("M5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("M6").Value = "( 3 )";
|
|
ws.Cell("N5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("N6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("O5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("O6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("P5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("P6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("L5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("M5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("L4:P4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 16)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 16)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 16)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 16)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 16)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 8)
|
|
{
|
|
ws.Range("D4:L4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("L5").Value = "รวม";
|
|
ws.Cell("L6").Value = "( 1 )";
|
|
ws.Cell("M5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("M6").Value = "( 2 )";
|
|
ws.Cell("N5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("N6").Value = "( 3 )";
|
|
ws.Cell("O5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("O6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("P5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("P6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("Q5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("Q6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("M5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("Q5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("M4:Q4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 17)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 17)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 17)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 17)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 9)
|
|
{
|
|
ws.Range("D4:M4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("M5").Value = "รวม";
|
|
ws.Cell("M6").Value = "( 1 )";
|
|
ws.Cell("N5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("N6").Value = "( 2 )";
|
|
ws.Cell("O5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("O6").Value = "( 3 )";
|
|
ws.Cell("P5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("P6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("Q5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("Q6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("R5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("R6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("N5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("O5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("N4:R4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 18)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 18)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 18)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 18)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
|
|
if (a == 10)
|
|
{
|
|
ws.Range("D4:N4").Merge().Value = "จำนวนนักศึกษาที่ลงทะเบียน";
|
|
|
|
ws.Cell("N5").Value = "รวม";
|
|
ws.Cell("N6").Value = "( 1 )";
|
|
ws.Cell("O5").Value = "จำนวนหน่วยกิตบรรยาย";
|
|
ws.Cell("O6").Value = "( 2 )";
|
|
ws.Cell("P5").Value = "จำนวนหน่วยกิตปฏิบัติ";
|
|
ws.Cell("P6").Value = "( 3 )";
|
|
ws.Cell("Q5").Value = "รวมค่าหน่วยกิตบรรยาย";
|
|
ws.Cell("Q6").Value = "(4)=(1)x(2)x150";
|
|
ws.Cell("R5").Value = "รวมค่าหน่วยกิตปฏิบัติ";
|
|
ws.Cell("R6").Value = "(5)=(1)x(3)x200";
|
|
ws.Cell("S5").Value = "รวมเงินค่าลงทะเบียนเรียน";
|
|
ws.Cell("S6").Value = "( 6 )=( 4 )+( 5 )";
|
|
ws.Cell("O5").Style.Alignment.SetTextRotation(90);
|
|
ws.Cell("P5").Style.Alignment.SetTextRotation(90);
|
|
ws.Range("O4:S4").Merge().Merge().Value =
|
|
"ค่าลงทะเบียนเรียนภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(8, 19)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(4, 5), ws.Cell(8, 19)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 19)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("D4:G4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range("H4:L4").Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(4, 4), ws.Cell(4, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
|
|
ws.Range(ws.Cell(5, 5), ws.Cell(6, 19)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var header in revenueEstimate.data)
|
|
{
|
|
var a = revenueEstimate.majors.Count;
|
|
int rowhead2 = 4;
|
|
|
|
if (a == 1)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 10)).Merge().Value = header.education_level;
|
|
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.SetBold().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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 1).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 3).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
//rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, rowhead2 + 1).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 2).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 3).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 4).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 6)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_register_amount;
|
|
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.SetBold().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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Cell(row, rowhead2 + 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, rowhead2 + 6).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 6)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2 + 6).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 10).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Merge().Value = "รวมรายรับจากการจัดการศึกษาให้กับ " +
|
|
revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 10).Value = revenueEstimate.total_income;
|
|
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.SetBold().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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 10).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 9)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 10).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 2)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 11)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 2).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 3).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 4).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 7)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 7)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 7)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 6).Value = header.total_credits;
|
|
ws.Cell(row, 7).Value = header.lecture_credits;
|
|
ws.Cell(row, 8).Value = header.practical_credits;
|
|
ws.Cell(row, 9).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 10).Value = header.total_practical_credits;
|
|
ws.Cell(row, 11).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 11)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, rowhead2 + 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, rowhead2 + 7).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 11).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 11).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 10).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 10)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 11).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 11).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 3)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 12)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 3).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 4).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 8)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 8)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 8)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 7).Value = header.total_credits;
|
|
ws.Cell(row, 8).Value = header.lecture_credits;
|
|
ws.Cell(row, 9).Value = header.practical_credits;
|
|
ws.Cell(row, 10).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 11).Value = header.total_practical_credits;
|
|
ws.Cell(row, 12).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, rowhead2 + 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 8)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 12).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 11)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 12).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 12).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 12).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 4)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 13)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 4).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 9)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 9)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 9)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 8).Value = header.total_credits;
|
|
ws.Cell(row, 9).Value = header.lecture_credits;
|
|
ws.Cell(row, 10).Value = header.practical_credits;
|
|
ws.Cell(row, 11).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 12).Value = header.total_practical_credits;
|
|
ws.Cell(row, 13).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 13)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 13).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 13)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 13).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 12)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 13).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 13).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 13).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 13).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 5)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 14)).Merge().Value = header.education_level;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 5).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 10)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 10)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 10)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 9).Value = header.total_credits;
|
|
ws.Cell(row, 10).Value = header.lecture_credits;
|
|
ws.Cell(row, 11).Value = header.practical_credits;
|
|
ws.Cell(row, 12).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 13).Value = header.total_practical_credits;
|
|
ws.Cell(row, 14).Value = header.total_register_amount;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 14).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 14).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 13)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 14).Value = revenueEstimate.total_income;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 14).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 14).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 6)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 15)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 6).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 11).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 11)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 11)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 11)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 10).Value = header.total_credits;
|
|
ws.Cell(row, 11).Value = header.lecture_credits;
|
|
ws.Cell(row, 12).Value = header.practical_credits;
|
|
ws.Cell(row, 13).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 14).Value = header.total_practical_credits;
|
|
ws.Cell(row, 15).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 15).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 15)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 15).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 15).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 15).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 15).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 15).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 7)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 16)).Merge().Value = header.education_level;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 7).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 11).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 12).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 12)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 12)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 12)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 11).Value = header.total_credits;
|
|
ws.Cell(row, 12).Value = header.lecture_credits;
|
|
ws.Cell(row, 13).Value = header.practical_credits;
|
|
ws.Cell(row, 14).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 15).Value = header.total_practical_credits;
|
|
ws.Cell(row, 16).Value = header.total_register_amount;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 16).Value = header.total_register_amount;
|
|
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.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 16)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 16).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 16).Value = revenueEstimate.total_income;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 16).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 16).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 8)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 17)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 8).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 11).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 12).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 13).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 13)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 13)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 13)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 12).Value = header.total_credits;
|
|
ws.Cell(row, 13).Value = header.lecture_credits;
|
|
ws.Cell(row, 14).Value = header.practical_credits;
|
|
ws.Cell(row, 15).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 16).Value = header.total_practical_credits;
|
|
ws.Cell(row, 17).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 17)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 17).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 17)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 17).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 17).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 17).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 17).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 9)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 18)).Merge().Value = header.education_level;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 9).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 11).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 12).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 13).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 14).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 14)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 14)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 14)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 13).Value = header.total_credits;
|
|
ws.Cell(row, 14).Value = header.lecture_credits;
|
|
ws.Cell(row, 15).Value = header.practical_credits;
|
|
ws.Cell(row, 16).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 17).Value = header.total_practical_credits;
|
|
ws.Cell(row, 18).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 18)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 18).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 18)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 18).Value = revenueEstimate.total_income;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Font.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 18).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 18).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
|
|
if (a == 10)
|
|
{
|
|
if (header.topic_type == 1)
|
|
{
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 19)).Merge().Value = header.education_level;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 2)
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Value = header.year_class;
|
|
ws.Cell(row, 3).Value = "นักศึกษา รหัส" + header.code;
|
|
ws.Cell(row, rowhead2 + 10).Value = header.total_credits;
|
|
ws.Cell(row, rowhead2 + 11).Value = header.lecture_credits;
|
|
ws.Cell(row, rowhead2 + 12).Value = header.practical_credits;
|
|
ws.Cell(row, rowhead2 + 13).Value = header.total_lecture_credits;
|
|
ws.Cell(row, rowhead2 + 14).Value = header.total_practical_credits;
|
|
ws.Cell(row, rowhead2 + 15).Value = header.total_register_amount;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Font.SetBold().Font.FontSize =
|
|
16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(255, 255, 153);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, rowhead2 + 15)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, rowhead2 + 15)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, rowhead2 + 15)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = no;
|
|
no++;
|
|
ws.Cell(row, 2).Value = header.topic_code;
|
|
ws.Cell(row, 3).Value = header.topic;
|
|
foreach (var i in header.majors)
|
|
{
|
|
ws.Cell(row, rowhead2).Value = i.credits;
|
|
ws.Cell(row, rowhead2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell(row, rowhead2).Style.Font.FontName = "TH SarabunPSK";
|
|
ws.Cell(row, rowhead2).Style.Font.FontSize = 16;
|
|
ws.Cell(row, rowhead2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
rowhead2++;
|
|
}
|
|
|
|
ws.Cell(row, 14).Value = header.total_credits;
|
|
ws.Cell(row, 15).Value = header.lecture_credits;
|
|
ws.Cell(row, 16).Value = header.practical_credits;
|
|
ws.Cell(row, 17).Value = header.total_lecture_credits;
|
|
ws.Cell(row, 18).Value = header.total_practical_credits;
|
|
ws.Cell(row, 19).Value = header.total_register_amount;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 19)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.RightBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 4) //รวมระดับชั้น
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม " + header.education_level;
|
|
ws.Cell(row, 19).Value = header.total_register_amount;
|
|
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.SetBold().Font.FontSize = 16;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Style.Alignment.WrapText = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(198, 224, 180);
|
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 19)).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 19)).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Border.LeftBorder =
|
|
XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.topic_type == 5) //รวมรายรับ
|
|
{
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Merge().Value =
|
|
"รวมรายรับจากการจัดการศึกษาให้กับ " + revenueEstimate.faculty + " " +
|
|
" ภาคเรียน " + revenueEstimate.semester + " / " + revenueEstimate.year + " " +
|
|
revenueEstimate.budget_project_name_th;
|
|
ws.Cell(row, 19).Value = revenueEstimate.total_income;
|
|
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.SetBold().Font.FontSize = 16;
|
|
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.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
ws.Cell(row, 19).Style.Fill.BackgroundColor =
|
|
XLColor.FromArgb(189, 215, 238);
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
|
ws.Cell(row, 19).Style.NumberFormat.SetFormat("#,#");
|
|
ws.Cell(row, 19).Style.Border.OutsideBorder =
|
|
XLBorderStyleValues.Thin;
|
|
}
|
|
}
|
|
}
|
|
|
|
using (var stream = new MemoryStream())
|
|
{
|
|
workbook.SaveAs(stream);
|
|
var content = stream.ToArray();
|
|
return File(
|
|
content,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"revenueEstimate_register" + ".xlsx");
|
|
}
|
|
}
|
|
}
|
|
} |