add reports

This commit is contained in:
kamonwan taengsuk
2023-07-10 18:31:46 +07:00
parent 6e8933e081
commit 6a65a50caa
12 changed files with 2085 additions and 5 deletions

View File

@@ -1554,11 +1554,14 @@ namespace rmutr_report.Controllers
"basic_plan_all_" + date + ".xlsx");
}
}
[HttpPost, Route("reports/summary_strategic/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumStrategicReport([FromRoute] string type, [FromBody] summary_strategic summary_strategics)
{ var _summary_strategic = new List<summary_strategic>() { summary_strategics };
public IActionResult GetSumStrategicReport([FromRoute] string type,
[FromBody] summary_strategic summary_strategics)
{
var _summary_strategic = new List<summary_strategic>() { summary_strategics };
Report report = new Report();
report.Load(_setting.report_path + "summary_strategic.frx");
report.RegisterData(_summary_strategic, "summary_strategic");
@@ -1585,10 +1588,586 @@ namespace rmutr_report.Controllers
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
date + ".xlsx");
break;
}
return Ok();
}
[HttpPost, Route("reports/budget_expenditure_from_revenue/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetReport([FromRoute] string type,
[FromBody] budget_expenditure_from_revenue budget_expenditure_from_revenues)
{
if (budget_expenditure_from_revenues.budget_expenditure_from_revenue_details != null)
{
foreach (var detail in budget_expenditure_from_revenues.budget_expenditure_from_revenue_details)
{
if (detail.topic_type == 1)
{
detail.topic_1 = detail.topic;
detail.topic_2 = null;
var sum1 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.current_students);
budget_expenditure_from_revenues.sum_1 = sum1;
var sum2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.students_reduced);
budget_expenditure_from_revenues.sum_2 = sum2;
var sum3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.students_estimates);
budget_expenditure_from_revenues.sum_3 = sum3;
var sum4 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.price_regis_flat_payment);
budget_expenditure_from_revenues.sum_4 = sum4;
var sum5 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.library_total);
budget_expenditure_from_revenues.sum_5 = sum5;
var sum6 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.utilities_total);
budget_expenditure_from_revenues.sum_6 = sum6;
var sum7 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.student_club_library_total);
budget_expenditure_from_revenues.sum_7 = sum7;
var sum8 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.accident_insurance_total);
budget_expenditure_from_revenues.sum_8 = sum8;
var sum9 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.academic_activities_total);
budget_expenditure_from_revenues.sum_9 = sum9;
var sum10 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.examination_and_x_rays_total);
budget_expenditure_from_revenues.sum_10 = sum10;
var sum11 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.tuition_fee_total);
budget_expenditure_from_revenues.sum_11 = sum11;
var sum12 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
.Where(h => h.topic_type == 1).Sum(j =>
j.education_fee_less_fee_total);
budget_expenditure_from_revenues.sum_12 = sum12;
}
if (detail.topic_type == 2)
{
detail.topic_1 = detail.topic;
detail.topic_2 = null;
}
if (detail.topic_type == 3)
{
detail.topic_2 = detail.topic;
detail.topic_1 = null;
}
}
}
var _summarys = new List<budget_expenditure_from_revenue>() { budget_expenditure_from_revenues };
Report report = new Report();
report.Load(_setting.report_path + "budget_expenditure_from_revenue.frx");
report.RegisterData(_summarys, "budget_expenditure_from_revenue");
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_estimates/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetRevenueEstimatesReport([FromRoute] string type,
[FromBody] revenue_estimates revenue_estimate)
{
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("สรุปรายรับและจัดสรรตามเกณฑ์");
ws.Range("A1:S1").Merge().Value = "งบประมาณรายจ่ายจากเงินรายได้ ประจำปีงบประมาณ พ.ศ. " +
revenue_estimate.academic_year_name_th;
ws.Range("A1:S1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A1:S1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A1:S1").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A1:S1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A2:S2").Merge().Value = "( " + revenue_estimate.start_and_end_date_report + " )";
ws.Range("A2:S2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A2:S2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A2:S2").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A2:S2").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A3:S3").Merge().Value = "สรุปประมาณการรายรับ และการจัดสรรตามเกณฑ์รายจ่าย การจัดการศึกษาระดับ" +
revenue_estimate.education_level;
ws.Range("A3:S3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A3:S3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A3:S3").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A3:S3").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A4:S4").Merge().Value = "คณะ/วิทยาลัย " + revenue_estimate.faculty_name_th + " " + "พื้นที่ " +
revenue_estimate.agency_name_th;
ws.Range("A4:S4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A4:S4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A4:S4").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A4:S4").Style.Font.SetBold().Font.FontSize = 16;
ws.Column(1).Width = 30;
ws.Column(5).Width = 15;
ws.Column(6).Width = 15;
ws.Column(7).Width = 15;
ws.Column(8).Width = 15;
ws.Column(9).Width = 15;
ws.Column(10).Width = 15;
ws.Column(11).Width = 15;
ws.Column(12).Width = 15;
ws.Column(13).Width = 15;
ws.Column(14).Width = 15;
ws.Column(15).Width = 15;
ws.Column(16).Width = 15;
ws.Column(17).Width = 15;
ws.Column(18).Width = 15;
ws.Column(19).Width = 15;
ws.Row(5).Height = 30;
ws.Row(6).Height = 30;
int row = 7;
//int no = 1;
if (revenue_estimate != null)
{
ws.Range("A5:A6").Merge().Value = "ผลผลิต / ภาคการศึกษา / ภาคเรียน";
ws.Range("A5:A6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A5:A6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A5:A6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A5:A6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("A5:A6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("A5:A6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("B5:C6").Merge().Value = "ประมาณการรายรับ";
ws.Range("B5:C6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("B5:C6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("B5:C6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("B5:C6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("B5:C6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("B5:C6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("D5:E6").Merge().Value = "หัก ประมาณการรายรับคณะศิลปศาสตร์ ( ศึกษาทั่วไป )";
ws.Range("D5:E6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("D5:E6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("D5:E6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("D5:E6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("D5:E6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("D5:E6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("F5:G6").Merge().Value = "คงเหลือ ประมาณการรายรับก่อนหักรายได้สะสม และจัดสรรตามเกณฑ์";
ws.Range("F5:G6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("F5:G6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("F5:G6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("F5:G6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("F5:G6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("F5:G6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("H5:I6").Merge().Value = "หัก รายได้สะสม ร้อยละ 10";
ws.Range("H5:I6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("H5:I6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("H5:I6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("H5:I6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("H5:I6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("H5:I6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("J5:K6").Merge().Value = "คงเหลือ ประมาณการรายรับ ก่อนจัดสรรตามเกณฑ์";
ws.Range("J5:K6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("J5:K6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("J5:K6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("J5:K6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("J5:K6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("J5:K6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("L5:M6").Merge().Value = "สมทบค่าสาธารณูปโภคมหาวิทยาลัย ร้อยละ 5";
ws.Range("L5:M6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("L5:M6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("L5:M6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("L5:M6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("L5:M6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("L5:M6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("N5:O6").Merge().Value = "สมทบงบกลาง มหาวิทยาลัย ร้อยละ 15";
ws.Range("N5:O6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("N5:O6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("N5:O6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("N5:O6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("N5:O6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("N5:O6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("P5:Q6").Merge().Value = "สมทบรายจ่ายส่วนกลางมหาวิทยาลัย ร้อยละ 40/50/60";
ws.Range("P5:Q6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("P5:Q6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("P5:Q6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("P5:Q6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("P5:Q6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("P5:Q6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("R5:S6").Merge().Value = "กรอบวงเงินรายจ่ายของคณะ/วิทยาลัย ร้อยละ 40/50/60";
ws.Range("R5:S6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("R5:S6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("R5:S6").Style.Font.FontName = "TH SarabunPSK";
ws.Range("R5:S6").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("R5:S6").Style.Fill.BackgroundColor = XLColor.FromArgb(248, 203, 173);
ws.Range("R5:S6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(5, 1), ws.Cell(6, 19)).Style.Alignment.WrapText = true;
int r1 = 1;
int r2 = 2;
foreach (var detail in revenue_estimate.revenue_estimates_details)
{
if (detail.topic_type == 1)
{
ws.Cell(row, 1).Value = detail.topic;
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
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.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
XLColor.FromArgb(252, 228, 214);
ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.topic_type == 2)
{
ws.Cell(row, 1).Value = detail.topic;
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
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 = 14;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
//ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214);
ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.topic_type == 3)
{
ws.Cell(row, 1).Value = detail.topic;
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 14;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
//ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214);
ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.topic_type == 4)
{
ws.Cell(row, 1).Value = "รวม";
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
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.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
XLColor.FromArgb(252, 228, 214);
ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.is_footer== true)
{
ws.Cell(row, 14).Value = "ลงชื่อ";
ws.Cell(row, 15).Value = revenue_estimate.author_name;
ws.Cell(row, 17).Value = "ผู้จัดทำ";
ws.Cell(row + r1, 14).Value = "ตำแหน่ง";
ws.Cell(row+r1, 15).Value = revenue_estimate.position_name;
ws.Cell(row+r2, 14).Value = "เบอร์โทรติดต่อ";
ws.Cell(row+r2, 15).Value = "'"+revenue_estimate.phone;
ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 14;
// ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
// ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell(row, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+1, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+2, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+1, 14).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+2, 14).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+1, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row+2, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+2, 15).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row+2, 15).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Cell(row+2, 15).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Cell(row+3, 15).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+3, 15).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row+3, 15).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
row++;
row += r1++;
row += r2++;
}
}
}
using (var stream1 = new MemoryStream())
{
workbook.SaveAs(stream1);
var content = stream1.ToArray();
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
return File(
content,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"revenue_estimates_" + date + ".xlsx");
}
}
}
}

View File

@@ -8802,5 +8802,660 @@ namespace rmutr_report.Controllers
"set_personnel_budget_university_" + date + ".xlsx");
}
}
[HttpPost, Route("reports/set_personnel_budget_permanent/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSetPersonPermanentReport([FromRoute] string type,
[FromBody] set_personnel_budget_permanent personnel)
{
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("4.ค่าจ้างประจำ");
ws.Range("A1:S1").Merge().Value= "การตั้งงบประมาณค่าใช้จ่ายบุคลากร ของลูกจ้างประจำ ปีงบประมาณ พ.ศ. " + personnel.academic_year_name_th;
ws.Range("A1:S1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A1:S1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A1:S1").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A1:S1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A2:S2").Merge().Value= "กรณี ลูกจ้างประจำเกษียณแล้วยุบ และจ้างพนักงานราชการทดแทน";
ws.Range("A2:S2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A2:S2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A2:S2").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A2:S2").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A3:S3").Merge().Value= "(กรณีเงินเลื่อนขั้นอยู่ในงบกลาง และมีการเลื่อนเงินเดือนปีละ 2 ครั้ง)";
ws.Range("A3:S3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A3:S3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A3:S3").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A3:S3").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("A4").Value = "กระทรวง : ";
ws.Cell("A4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A4").Style.Font.FontSize = 16;
ws.Cell("A4").Style.Font.Bold = true;
ws.Range("B4:F4").Merge().Value = personnel.ministry_name_th;
ws.Range("B4:F4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("B4:F4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B4").Style.Font.FontSize = 16;
ws.Range("B4:F4").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("A5").Value = "หน่วยงาน : ";
ws.Cell("A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A5").Style.Font.FontSize = 16;
ws.Cell("A5").Style.Font.Bold = true;
ws.Range("B5:F5").Merge().Value = personnel.agency_name_th;
ws.Range("B5:F5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("B5:F5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("B5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B5").Style.Font.FontSize = 16;
ws.Range("B5:F5").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("A9").Value = "แบบคำนวณค่าจ้างประจำ";
ws.Cell("A9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A9").Style.Font.FontSize = 16;
ws.Cell("A9").Style.Font.Bold = true;
ws.Cell("D9").Value = "จำนวนรวมทั้งสิ้น";
ws.Cell("D9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("D9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("D9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("D9").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("E9:F9").Merge().Value = personnel.calculate_regular_wages_rate;
ws.Range("E9:F9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("E9:F9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("E9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("E9").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("E9:F9").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("G9").Value = "อัตรา";
ws.Cell("G9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("G9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("G9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G9").Style.Font.FontSize = 16;
ws.Cell("G9").Style.Font.Bold = true;
ws.Cell("H9").Value = "งบประมาณ";
ws.Cell("H9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("H9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("H9").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("I9:J9").Merge().Value = personnel.calculate_regular_wages_budget;
ws.Range("I9:J9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("I9:J9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("I9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I9").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("I9:J9").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("K9").Value = "ล้านบาท (ไม่รวมส่วนควบ)";
ws.Cell("K9").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("K9").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("K9").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K9").Style.Font.FontSize = 16;
ws.Cell("K9").Style.Font.Bold = true;
ws.Cell("A10").Value = "พรบ.ปี 2564";
ws.Cell("A10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A10").Style.Font.FontSize = 16;
ws.Cell("A10").Style.Font.Bold = true;
ws.Cell("B10").Value = personnel.act_old1;
ws.Cell("B10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("B10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("B10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B10").Style.Font.FontSize = 16;
ws.Cell("B10").Style.Font.Bold = true;
ws.Cell("B10").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("C10").Value = "ลบ.";
ws.Cell("C10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("C10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("C10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("C10").Style.Font.FontSize = 16;
ws.Cell("C10").Style.Font.Bold = true;
ws.Range("D10:E10").Merge().Value = "ผลเบิกจ่ายปี งปม.64";
ws.Range("D10:E10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("D10:E10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("D10:E10").Style.Font.FontName = "TH SarabunPSK";
ws.Range("D10:E10").Style.Font.FontSize = 16;
ws.Range("D10:E10").Style.Font.Bold = true;
ws.Cell("F10").Value = personnel.disbursement_year_act_old1;
ws.Cell("F10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("F10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("F10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("F10").Style.Font.FontSize = 16;
ws.Cell("F10").Style.Font.Bold = true;
ws.Cell("F10").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("G10").Value = "ลบ.";
ws.Cell("G10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("G10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("G10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G10").Style.Font.FontSize = 16;
ws.Cell("G10").Style.Font.Bold = true;
ws.Cell("H10").Value = "คิดเป็นร้อยละ";
ws.Cell("H10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("H10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("H10").Style.Font.FontSize = 16;
ws.Cell("H10").Style.Font.Bold = true;
ws.Cell("I10").Value = personnel.disbursement_year_act_old1_percent;
ws.Cell("I10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("I10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("I10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I10").Style.Font.FontSize = 16;
ws.Cell("I10").Style.Font.Bold = true;
ws.Cell("I10").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("J10").Value = "คงเหลือ";
ws.Cell("J10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("J10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("J10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("J10").Style.Font.FontSize = 16;
ws.Cell("J10").Style.Font.Bold = true;
ws.Cell("K10").Value = personnel.remaining_act_old1;
ws.Cell("K10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("K10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("K10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K10").Style.Font.FontSize = 16;
ws.Cell("K10").Style.Font.Bold = true;
ws.Cell("K10").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("L10").Value = "ลบ.";
ws.Cell("L10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("L10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("L10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("L10").Style.Font.FontSize = 16;
ws.Cell("L10").Style.Font.Bold = true;
ws.Cell("M10").Value = "คิดเป็นร้อยละ";
ws.Cell("M10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("M10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("M10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("M10").Style.Font.FontSize = 16;
ws.Cell("M10").Style.Font.Bold = true;
ws.Cell("N10").Value = personnel.remaining_act_old1_percent;
ws.Cell("N10").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("N10").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("N10").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("N10").Style.Font.FontSize = 16;
ws.Cell("N10").Style.Font.Bold = true;
ws.Cell("N10").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("A11").Value = "พรบ.ปี 2565";
ws.Cell("A11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A11").Style.Font.FontSize = 16;
ws.Cell("A11").Style.Font.Bold = true;
ws.Cell("B11").Value = personnel.act_old2;
ws.Cell("B11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("B11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("B11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B11").Style.Font.FontSize = 16;
ws.Cell("B11").Style.Font.Bold = true;
ws.Cell("B11").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("C11").Value = "ลบ.";
ws.Cell("C11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("C11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("C11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("C11").Style.Font.FontSize = 16;
ws.Cell("C11").Style.Font.Bold = true;
ws.Range("D11:E11").Merge().Value = "จ่ายจริง ต.ค.64 - พ.ย.64";
ws.Range("D11:E11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range("D11:E11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("D11:E11").Style.Font.FontName = "TH SarabunPSK";
ws.Range("D11:E11").Style.Font.FontSize = 16;
ws.Range("D11:E11").Style.Font.Bold = true;
ws.Cell("F11").Value = personnel.actually_paid;
ws.Cell("F11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("F11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("F11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("F11").Style.Font.FontSize = 16;
ws.Cell("F11").Style.Font.Bold = true;
ws.Cell("F11").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("G11").Value = "ลบ.";
ws.Cell("G11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("G11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("G11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G11").Style.Font.FontSize = 16;
ws.Cell("G11").Style.Font.Bold = true;
ws.Cell("H11").Value = "คิดเป็นร้อยละ";
ws.Cell("H11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("H11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("H11").Style.Font.FontSize = 16;
ws.Cell("H11").Style.Font.Bold = true;
ws.Cell("I11").Value = personnel.actually_paid_percent;
ws.Cell("I11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("I11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("I11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I11").Style.Font.FontSize = 16;
ws.Cell("I11").Style.Font.Bold = true;
ws.Cell("I11").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("J11").Value = "คงเหลือ";
ws.Cell("J11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("J11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("J11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("J11").Style.Font.FontSize = 16;
ws.Cell("J11").Style.Font.Bold = true;
ws.Cell("K11").Value = personnel.remaining_act_old2;
ws.Cell("K11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("K11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("K11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K11").Style.Font.FontSize = 16;
ws.Cell("K11").Style.Font.Bold = true;
ws.Cell("K11").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("L11").Value = "ลบ.";
ws.Cell("L11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("L11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("L11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("L11").Style.Font.FontSize = 16;
ws.Cell("L11").Style.Font.Bold = true;
ws.Cell("M11").Value = "คิดเป็นร้อยละ";
ws.Cell("M11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("M11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("M11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("M11").Style.Font.FontSize = 16;
ws.Cell("M11").Style.Font.Bold = true;
ws.Cell("N11").Value = personnel.remaining_act_old2_percent;
ws.Cell("N11").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("N11").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("N11").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("N11").Style.Font.FontSize = 16;
ws.Cell("N11").Style.Font.Bold = true;
ws.Cell("N11").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Range("A12:B12").Merge().Value = "(ไม่รวมส่วนควบ)";
ws.Range("A12:B12").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Range("A12:B12").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A12:B12").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A12:B12").Style.Font.FontSize = 16;
ws.Range("D12:E12").Merge().Value = "(ไม่รวมส่วนควบ)";
ws.Range("D12:E12").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Range("D12:E12").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("D12:E12").Style.Font.FontName = "TH SarabunPSK";
ws.Range("D12:E12").Style.Font.FontSize = 16;
ws.Cell("A13").Value = "เฉลี่ยต่อเดือน";
ws.Cell("A13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("A13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("A13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A13").Style.Font.FontSize = 16;
ws.Cell("B13").Value = personnel.average_per_month1;
ws.Cell("B13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("B13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("B13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B13").Style.Font.FontSize = 16;
ws.Cell("B13").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("C13").Value = "ลบ.";
ws.Cell("C13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("C13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("C13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("C13").Style.Font.FontSize = 16;
ws.Cell("E13").Value = "เฉลี่ยต่อเดือน";
ws.Cell("E13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("E13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("E13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("E13").Style.Font.FontSize = 16;
ws.Cell("F13").Value = personnel.average_per_month2;
ws.Cell("F13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell("F13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("F13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("F13").Style.Font.FontSize = 16;
ws.Cell("F13").Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell("G13").Value = "ลบ.";
ws.Cell("G13").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell("G13").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("G13").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G13").Style.Font.FontSize = 16;
ws.Column(1).Width = 30;
ws.Column(5).Width = 15;
ws.Column(6).Width = 15;
ws.Column(7).Width = 15;
ws.Column(8).Width = 15;
ws.Column(9).Width = 15;
ws.Column(10).Width = 15;
ws.Column(11).Width = 15;
ws.Column(12).Width = 15;
ws.Column(13).Width = 15;
ws.Column(14).Width = 15;
ws.Column(15).Width = 15;
ws.Column(16).Width = 15;
ws.Column(17).Width = 30;
int row = 17;
//int no = 1;
if (personnel != null)
{
ws.Range("A14:D16").Merge().Value = "รายการ";
ws.Range("A14:D16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A14:D16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A14:D16").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A14:D16").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("A14:D16").Style.Fill.BackgroundColor = XLColor.FromArgb(252, 252, 214);
ws.Range("A14:D16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("E14:F14").Merge().Value = "งปม. 2565";
ws.Range("E14:F14").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("E14:F14").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("E14:F14").Style.Font.FontName = "TH SarabunPSK";
ws.Range("E14:F14").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("E14:F14").Style.Fill.BackgroundColor = XLColor.FromArgb(226, 239, 218);
ws.Range("E14:F14").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("E15:F15").Merge().Value = "พ.ร.บ.";
ws.Range("E15:F15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("E15:F15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("E15:F15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("E15:F15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("E15:F15").Style.Fill.BackgroundColor = XLColor.FromArgb(226, 239, 218);
ws.Range("E15:F15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("E16").Value = "อัตรา";
ws.Cell("E16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("E16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("E16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("E16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("E16").Style.Alignment.WrapText = true;
ws.Cell("E16").Style.Fill.BackgroundColor = XLColor.FromArgb(226, 239, 218);
ws.Cell("E16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("F16").Value = "งบประมาณ";
ws.Cell("F16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("F16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("F16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("F16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("F16").Style.Alignment.WrapText = true;
ws.Cell("F16").Style.Fill.BackgroundColor = XLColor.FromArgb(226, 239, 218);
ws.Cell("F16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("G14:J14").Merge().Value = "งปม. 2566 (จ่ายจริง ต.ค.- ธ.ค. 64)";
ws.Range("G14:J14").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("G14:J14").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("G14:J14").Style.Font.FontName = "TH SarabunPSK";
ws.Range("G14:J14").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("G14:J14").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Range("G14:J14").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("G15:H15").Merge().Value = "คำขอ";
ws.Range("G15:H15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("G15:H15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("G15:H15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("G15:H15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("G15:H15").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Range("G15:H15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("I15:J15").Merge().Value = "ข้อเสนอ";
ws.Range("I15:J15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("I15:J15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("I15:J15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("I15:J15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("I15:J15").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Range("I15:J15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("G16").Value = "อัตรา";
ws.Cell("G16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("G16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("G16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("G16").Style.Alignment.WrapText = true;
ws.Cell("G16").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Cell("G16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("H16").Value = "งบประมาณ";
ws.Cell("H16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("H16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("H16").Style.Alignment.WrapText = true;
ws.Cell("H16").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Cell("H16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("I16").Value = "อัตรา";
ws.Cell("I16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("I16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("I16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("I16").Style.Alignment.WrapText = true;
ws.Cell("I16").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Cell("I16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("J16").Value = "งบประมาณ";
ws.Cell("J16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("J16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("J16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("J16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("J16").Style.Alignment.WrapText = true;
ws.Cell("J16").Style.Fill.BackgroundColor = XLColor.FromArgb(221, 235, 247);
ws.Cell("J16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("K14:P14").Merge().Value = "MTEF";
ws.Range("K14:P14").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("K14:P14").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("K14:P14").Style.Font.FontName = "TH SarabunPSK";
ws.Range("K14:P14").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("K14:P14").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Range("K14:P14").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("K15:L15").Merge().Value = "2567";
ws.Range("K15:L15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("K15:L15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("K15:L15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("K15:L15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("K15:L15").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Range("K15:L15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("K16").Value = "อัตรา";
ws.Cell("K16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("K16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("K16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("K16").Style.Alignment.WrapText = true;
ws.Cell("K16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("K16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("L16").Value = "งบประมาณ";
ws.Cell("L16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("L16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("L16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("L16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("L16").Style.Alignment.WrapText = true;
ws.Cell("L16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("L16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("M15:N15").Merge().Value = "2568";
ws.Range("M15:N15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("M15:N15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("M15:N15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("M15:N15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("M15:N15").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Range("M15:N15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("M16").Value = "อัตรา";
ws.Cell("M16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("M16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("M16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("M16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("M16").Style.Alignment.WrapText = true;
ws.Cell("M16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("M16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("N16").Value = "งบประมาณ";
ws.Cell("N16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("N16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("N16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("N16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("N16").Style.Alignment.WrapText = true;
ws.Cell("N16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("N16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("O15:P15").Merge().Value = "2569";
ws.Range("O15:P15").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("O15:P15").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("O15:P15").Style.Font.FontName = "TH SarabunPSK";
ws.Range("O15:P15").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("O15:P15").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Range("O15:P15").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("O16").Value = "อัตรา";
ws.Cell("O16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("O16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("O16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("O16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("O16").Style.Alignment.WrapText = true;
ws.Cell("O16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("O16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("P16").Value = "งบประมาณ";
ws.Cell("P16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("P16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("P16").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("P16").Style.Font.SetBold().Font.FontSize = 14;
ws.Cell("P16").Style.Alignment.WrapText = true;
ws.Cell("P16").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 230, 153);
ws.Cell("P16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range("Q14:U16").Merge().Value = "คำชี้แจง";
ws.Range("Q14:U16").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("Q14:U16").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("Q14:U16").Style.Font.FontName = "TH SarabunPSK";
ws.Range("Q14:U16").Style.Font.SetBold().Font.FontSize = 14;
ws.Range("Q14:U16").Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214);
ws.Range("Q14:U16").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
//ws.Range(ws.Cell(4, 2), ws.Cell(4, 6)).Style.Alignment.WrapText = true;
foreach (var detail in personnel.set_personnel_budget_permanent_details)
{
if (detail.topic_type == 1)
{
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Merge().Value = detail.topic;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Merge();
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.SetBold().Font.FontSize = 16;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
//ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#0");
ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.topic_type == 2)
{
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Merge().Value = detail.topic;
ws.Cell(row, 5).Value = detail.act_rate;
ws.Cell(row, 6).Value = detail.act_budget;
ws.Cell(row, 7).Value = detail.request_rate;
ws.Cell(row, 8).Value = detail.request_budget;
ws.Cell(row, 9).Value = detail.offer_request_rate;
ws.Cell(row, 10).Value = detail.offer_request_budget;
ws.Cell(row, 11).Value = detail.mtef_rate_year_1;
ws.Cell(row, 12).Value = detail.mtef_budget_year_1;
ws.Cell(row, 13).Value = detail.mtef_rate_year_2;
ws.Cell(row, 14).Value = detail.mtef_budget_year_2;
ws.Cell(row, 15).Value = detail.mtef_rate_year_3;
ws.Cell(row, 16).Value = detail.mtef_budget_year_3;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Merge().Value = detail.remark;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 5), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#0");
ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 5), ws.Cell(row, 16)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
if (detail.topic_type == 3)
{
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Merge().Value = " " + detail.topic;
ws.Cell(row, 5).Value = detail.act_rate;
ws.Cell(row, 6).Value = detail.act_budget;
ws.Cell(row, 7).Value = detail.request_rate;
ws.Cell(row, 8).Value = detail.request_budget;
ws.Cell(row, 9).Value = detail.offer_request_rate;
ws.Cell(row, 10).Value = detail.offer_request_budget;
ws.Cell(row, 11).Value = detail.mtef_rate_year_1;
ws.Cell(row, 12).Value = detail.mtef_budget_year_1;
ws.Cell(row, 13).Value = detail.mtef_rate_year_2;
ws.Cell(row, 14).Value = detail.mtef_budget_year_2;
ws.Cell(row, 15).Value = detail.mtef_rate_year_3;
ws.Cell(row, 16).Value = detail.mtef_budget_year_3;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Merge().Value = detail.remark;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.FontSize = 14;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 5), ws.Cell(row, 12)).Style.NumberFormat.SetFormat("#,#0");
ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 5), ws.Cell(row, 16)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 17), ws.Cell(row, 21)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
row++;
}
}
}
using (var stream1 = new MemoryStream())
{
workbook.SaveAs(stream1);
var content = stream1.ToArray();
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
return File(
content,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"set_personnel_budget_permanent_" + date + ".xlsx");
}
}
}
}