add รายงานค่าสอนพิเศษ
This commit is contained in:
143
Controllers/Expenses.Controller.cs
Normal file
143
Controllers/Expenses.Controller.cs
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using ClosedXML.Excel;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using rmutr_report.Models;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
|
||||||
|
namespace rmutr_report.Controllers
|
||||||
|
{
|
||||||
|
[SwaggerTag("สำหรับรายงานค่าใช้จ่ายในการดำเนินงาน")]
|
||||||
|
public class Expenses : Controller
|
||||||
|
{
|
||||||
|
readonly Setting _setting;
|
||||||
|
|
||||||
|
public Expenses(Setting setting)
|
||||||
|
{
|
||||||
|
this._setting = setting;
|
||||||
|
}
|
||||||
|
[HttpPost, Route("reports/operating_expenses/{type}")]
|
||||||
|
[ApiExplorerSettings(GroupName = "reports")]
|
||||||
|
public IActionResult GetExpensesReport([FromRoute] string type,
|
||||||
|
[FromBody] operating_expenses _operating_expenses)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
var workbook = new XLWorkbook();
|
||||||
|
var ws = workbook.Worksheets.Add("ค่าใช้จ่ายดำเนินงาน");
|
||||||
|
ws.Range("A1:D1").Merge().Value = "ผลผลิต " + _operating_expenses.product;
|
||||||
|
ws.Range("A1:D1").Style.Alignment.WrapText = true;
|
||||||
|
ws.Range("A1:D1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("A1:D1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("A1").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("A1").Style.Font.FontSize = 14;
|
||||||
|
ws.Range("A1:D1").Style.Font.Bold = true;
|
||||||
|
ws.Cell("A2").Value = "(1 ชุด ต่อ 1 ผลผลิต)";
|
||||||
|
ws.Cell("A2").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("A2").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("A2").Style.Font.Bold = true;
|
||||||
|
ws.Cell("A2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell("A2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D2").Value = "หน่วย : บาท";
|
||||||
|
ws.Cell("D2").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("D2").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("D2").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
||||||
|
ws.Cell("D2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("A3").Value = "ลำดับที่";
|
||||||
|
ws.Cell("A3").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("A3").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("A3").Style.Font.Bold = true;
|
||||||
|
ws.Cell("A3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("A3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("A3").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("A3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("A4").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("A4").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("B3").Value = "งบรายจ่าย";
|
||||||
|
ws.Cell("B3").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("B3").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("B3").Style.Font.Bold = true;
|
||||||
|
ws.Cell("B3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("B3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("B3").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("B3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("B4").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("B4").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("C3").Value = "คำขอตั้ง";
|
||||||
|
ws.Cell("C3").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("C3").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("C3").Style.Font.Bold = true;
|
||||||
|
ws.Cell("C3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("C3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("C3").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("C3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("C4").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("C4").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("D3").Value = "สรุปคำชี้แจง";
|
||||||
|
ws.Cell("D3").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("D3").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("D3").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("D3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D3").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("D3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("D4").Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("D4").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Column(1).Width = 10;
|
||||||
|
ws.Column(2).Width = 40;
|
||||||
|
ws.Column(3).Width = 30;
|
||||||
|
ws.Column(4).Width = 50;
|
||||||
|
int row = 5;
|
||||||
|
ws.Cell(row, 3).SetDataType(XLDataType.Number);
|
||||||
|
if (_operating_expenses != null)
|
||||||
|
{
|
||||||
|
ws.Cell("C4").Value = "ปี "+_operating_expenses.request_year;
|
||||||
|
ws.Cell("C4").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("C4").Style.Font.FontName = "TH Sarabun New";
|
||||||
|
ws.Cell("C4").Style.Font.FontSize = 14;
|
||||||
|
ws.Cell("C4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("C4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("C4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
foreach (var expenses in _operating_expenses.data)
|
||||||
|
{
|
||||||
|
ws.Cell(row, 1).Value = "'"+expenses.no;
|
||||||
|
ws.Cell(row, 2).Value = expenses.expenditure_budget;
|
||||||
|
ws.Cell(row, 3).Value = expenses.amount;
|
||||||
|
ws.Cell(row, 4).Value = expenses.clarification_summary;
|
||||||
|
|
||||||
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Font.FontName =
|
||||||
|
"TH Sarabun New";
|
||||||
|
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, 1), ws.Cell(row, 4)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
|
||||||
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Range(ws.Cell(5, 1), ws.Cell(5, 4)).Style.Font.Bold = true;
|
||||||
|
ws.Range(ws.Cell(5, 1), ws.Cell(5, 4)).Style.Border.BottomBorder = XLBorderStyleValues.Double;
|
||||||
|
ws.Range(ws.Cell(6, 1), ws.Cell(6, 4)).Style.Font.Bold = true;
|
||||||
|
//ws.Cell(row, 3).Style.NumberFormat.NumberFormatId = 2;
|
||||||
|
//ws.Cell(row, 3).DataType = XLDataType.Number;
|
||||||
|
//ws.Cell(row,3).SetDataType(XLDataType.Number);
|
||||||
|
ws.Cell(row,3).Style.NumberFormat.SetFormat("#,#");
|
||||||
|
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
workbook.SaveAs(stream);
|
||||||
|
var content = stream.ToArray();
|
||||||
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
|
return File(
|
||||||
|
content,
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
"operatingexpenses_" + date + ".xlsx");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
333
Controllers/TeachingFeeExtra.Controller.cs
Normal file
333
Controllers/TeachingFeeExtra.Controller.cs
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using ClosedXML.Excel;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using rmutr_report.Models;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
|
||||||
|
namespace rmutr_report.Controllers
|
||||||
|
{
|
||||||
|
[SwaggerTag("สำหรับรายงานค่าสอนพิเศษ")]
|
||||||
|
public class TeachingFeeExtra : Controller
|
||||||
|
{
|
||||||
|
readonly Setting _setting;
|
||||||
|
|
||||||
|
public TeachingFeeExtra(Setting setting)
|
||||||
|
{
|
||||||
|
this._setting = setting;
|
||||||
|
}
|
||||||
|
[HttpPost, Route("reports/teaching_fee_extra/{type}")]
|
||||||
|
[ApiExplorerSettings(GroupName = "reports")]
|
||||||
|
public IActionResult GetTeachingFeeExtraReport([FromRoute] string type,
|
||||||
|
[FromBody] teaching_fee_extra _teaching_fee_extra)
|
||||||
|
{
|
||||||
|
//var t = _teaching_fee_extra.ToArray();
|
||||||
|
{
|
||||||
|
var workbook = new XLWorkbook();
|
||||||
|
var ws = workbook.Worksheets.Add("ค่าสอนพิเศษ");
|
||||||
|
ws.Range("B1:K1").Merge().Value = "แบบฟอร์มการคำนวนค่าสอนอาจารย์พิเศษ";
|
||||||
|
ws.Range("B1:K1").Style.Alignment.WrapText = true;
|
||||||
|
ws.Range("B1:K1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("B1:K1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("B1").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("B1").Style.Font.FontSize = 16;
|
||||||
|
ws.Range("B1:K1").Style.Font.Bold = true;
|
||||||
|
ws.Column(1).Width = 10;
|
||||||
|
ws.Column(2).Width = 40;
|
||||||
|
ws.Column(3).Width = 10;
|
||||||
|
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 = 25;
|
||||||
|
ws.Column(11).Width = 30;
|
||||||
|
int row = 8;
|
||||||
|
int row2 = 9;
|
||||||
|
//ws.Cell(row, 3).SetDataType(XLDataType.Number);
|
||||||
|
if (_teaching_fee_extra != null)
|
||||||
|
{
|
||||||
|
// foreach (var tt in _teaching_fee_extra)
|
||||||
|
// {
|
||||||
|
|
||||||
|
ws.Cell("B2").Value = "หน่วยงาน " + _teaching_fee_extra.agency_name_th;
|
||||||
|
ws.Cell("B2").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("B2").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("B2").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("B2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell("B2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("C2").Value = "พื้นที่ " + _teaching_fee_extra.area;
|
||||||
|
ws.Cell("C2").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("C2").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("C2").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("C2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell("C2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("B3").Value = "ผลผลิต " + _teaching_fee_extra.product;
|
||||||
|
ws.Cell("B3").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("B3").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("B3").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("B3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell("B3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Range("B4:B7").Merge().Value = "รายวิชาที่สอน";
|
||||||
|
ws.Range("B4:B7").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("B4:B7").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("B4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("B4").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("B4").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("B4:B7").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("C4:C7").Merge().Value = "อัตราค่าสอน";
|
||||||
|
ws.Range("C4:C7").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("C4:C7").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("C4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("C4").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("C4").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("C4").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("C4:C7").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("D4:I4").Merge().Value = "รวมค่าสอนพิเศษ/ค่าการศึกษา";
|
||||||
|
ws.Range("D4:I4").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("D4:I4").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("D4").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("D4").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("D4:I4").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("D5:I5").Merge().Value = "(รวมจำนวนชั่วโมง x จำนวนสัปดาห์ x อัตราค่าสอน)";
|
||||||
|
ws.Range("D5:I5").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("D5:I5").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D5").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D5").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("D5").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("D5").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("D5:I5").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("D6:F6").Merge().Value = "'2/" + _teaching_fee_extra.term_2_year;
|
||||||
|
ws.Range("D6:F6").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("D6:F6").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D6").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D6").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("D6").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("D6").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("D6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("G6:I6").Merge().Value = "'1/" + _teaching_fee_extra.term_1_year;
|
||||||
|
ws.Range("G6:I6").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("G6:I6").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("G6").Style.Font.Bold = true;
|
||||||
|
ws.Cell("G6").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("G6").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("G6").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("G6:I6").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("D7").Value = "จำนวนชั่วโมง";
|
||||||
|
ws.Cell("D7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("D7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("D7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("D7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("D7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("D7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("D7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("D7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("E7").Value = "จำนวนสัปดาห์";
|
||||||
|
ws.Cell("E7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("E7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("E7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("E7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("E7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("E7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("E7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("E7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("F7").Value = "รวมเงิน";
|
||||||
|
ws.Cell("F7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("F7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("F7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("F7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("F7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("F7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("F7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("F7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("G7").Value = "จำนวนชั่วโมง";
|
||||||
|
ws.Cell("G7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("G7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("G7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("G7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("G7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("G7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("G7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("G7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("H7").Value = "จำนวนสัปดาห์";
|
||||||
|
ws.Cell("H7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("H7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("H7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("H7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("H7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("H7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("H7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("H7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell("I7").Value = "รวมเงิน";
|
||||||
|
ws.Cell("I7").Style.Font.Bold = true;
|
||||||
|
ws.Cell("I7").Style.Alignment.WrapText = true;
|
||||||
|
ws.Cell("I7").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("I7").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("I7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell("I7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("I7").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Cell("I7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("J4:J7").Merge().Value = "รวมเงินค่าสอนพิเศษทั้งสิ้น";
|
||||||
|
ws.Range("J4:J7").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("J4:J7").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("J4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("J4").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("J4").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("J4:J7").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
ws.Range("K4:K7").Merge().Value = "สาขาวิชา";
|
||||||
|
ws.Range("K4:K7").Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range("K4:K7").Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Cell("K4").Style.Font.Bold = true;
|
||||||
|
ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK";
|
||||||
|
ws.Cell("K4").Style.Font.FontSize = 16;
|
||||||
|
ws.Cell("K4").Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range("K4:K7").Merge().Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||||
|
foreach (var teaching in _teaching_fee_extra.data)
|
||||||
|
{
|
||||||
|
ws.Cell(row, 2).Value = teaching.course;
|
||||||
|
ws.Cell(row, 3).Value = null;
|
||||||
|
ws.Cell(row, 4).Value = teaching.number_of_hours1;
|
||||||
|
ws.Cell(row, 5).Value = teaching.number_of_weeks1;
|
||||||
|
ws.Cell(row, 6).Value = teaching.amount1;
|
||||||
|
ws.Cell(row, 7).Value = teaching.number_of_hours2;
|
||||||
|
ws.Cell(row, 8).Value = teaching.number_of_weeks2;
|
||||||
|
ws.Cell(row, 9).Value = teaching.amount2;
|
||||||
|
ws.Cell(row, 10).Value = teaching.total_amount;
|
||||||
|
ws.Cell(row, 11).Value = teaching.major;
|
||||||
|
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||||
|
"TH SarabunPSK";
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
|
||||||
|
XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
|
||||||
|
ws.Cell(row, 2).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 3).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 4).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 5).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 6).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 7).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 8).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 9).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 10).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||||
|
ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.RightBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).SetDataType(XLDataType.Number);
|
||||||
|
row++;
|
||||||
|
foreach (var datadetail in teaching.datadetail)
|
||||||
|
{
|
||||||
|
if (datadetail.teacher != "รวมทั้งสิ้น")
|
||||||
|
{
|
||||||
|
ws.Cell(row2, 2).Value = datadetail.teacher;
|
||||||
|
ws.Cell(row2, 3).Value = datadetail.teaching_rate;
|
||||||
|
ws.Cell(row2, 4).Value = datadetail.number_of_hours1;
|
||||||
|
ws.Cell(row2, 5).Value = datadetail.number_of_weeks1;
|
||||||
|
ws.Cell(row2, 6).Value = datadetail.amount1;
|
||||||
|
ws.Cell(row2, 7).Value = datadetail.number_of_hours2;
|
||||||
|
ws.Cell(row2, 8).Value = datadetail.number_of_weeks2;
|
||||||
|
ws.Cell(row2, 9).Value = datadetail.amount2;
|
||||||
|
ws.Cell(row2, 10).Value = datadetail.total_amount;
|
||||||
|
ws.Cell(row2, 11).Value = null;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName =
|
||||||
|
"TH SarabunPSK";
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical =
|
||||||
|
XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||||
|
ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).SetDataType(XLDataType.Number);
|
||||||
|
}
|
||||||
|
//row++;
|
||||||
|
if (datadetail.teacher == "รวมทั้งสิ้น")
|
||||||
|
{
|
||||||
|
ws.Cell(row2, 2).Value = datadetail.teacher;
|
||||||
|
ws.Cell(row2, 3).Value = datadetail.teaching_rate;
|
||||||
|
ws.Cell(row2, 4).Value = datadetail.number_of_hours1;
|
||||||
|
ws.Cell(row2, 5).Value = datadetail.number_of_weeks1;
|
||||||
|
ws.Cell(row2, 6).Value = datadetail.amount1;
|
||||||
|
ws.Cell(row2, 7).Value = datadetail.number_of_hours2;
|
||||||
|
ws.Cell(row2, 8).Value = datadetail.number_of_weeks2;
|
||||||
|
ws.Cell(row2, 9).Value = datadetail.amount2;
|
||||||
|
ws.Cell(row2, 10).Value = datadetail.total_amount;
|
||||||
|
ws.Cell(row2, 11).Value = null;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName =
|
||||||
|
"TH SarabunPSK";
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical =
|
||||||
|
XLAlignmentVerticalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder =
|
||||||
|
XLBorderStyleValues.Thin;
|
||||||
|
ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||||
|
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.Bold = true;
|
||||||
|
ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).SetDataType(XLDataType.Number);
|
||||||
|
}
|
||||||
|
row2++;
|
||||||
|
}
|
||||||
|
row++;
|
||||||
|
row2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
workbook.SaveAs(stream);
|
||||||
|
var content = stream.ToArray();
|
||||||
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
|
return File(
|
||||||
|
content,
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
"teaching_fee_extra_" + date + ".xlsx");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Models/budget/operating_expenses.cs
Normal file
19
Models/budget/operating_expenses.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace rmutr_report.Models
|
||||||
|
{
|
||||||
|
public class operating_expenses
|
||||||
|
{
|
||||||
|
public string product { get; set; }
|
||||||
|
public string request_year { get; set; }
|
||||||
|
public List<operating_expenses_detail> data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class operating_expenses_detail
|
||||||
|
{
|
||||||
|
public string no { get; set; }
|
||||||
|
public string expenditure_budget { get; set; }
|
||||||
|
public decimal? amount { get; set; }
|
||||||
|
public string clarification_summary { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Models/budget/teaching_fee_extra.cs
Normal file
43
Models/budget/teaching_fee_extra.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace rmutr_report.Models
|
||||||
|
{
|
||||||
|
public class teaching_fee_extra
|
||||||
|
{
|
||||||
|
public string agency_name_th { get; set; }
|
||||||
|
public string area { get; set; }
|
||||||
|
public string product { get; set; }
|
||||||
|
public string term_1_year { get; set; }
|
||||||
|
public string term_2_year { get; set; }
|
||||||
|
|
||||||
|
public List<teaching_fee_extra_detail> data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class teaching_fee_extra_detail
|
||||||
|
{
|
||||||
|
public string course { get; set; }
|
||||||
|
public decimal? number_of_hours1 { get; set; }
|
||||||
|
public decimal? number_of_weeks1 { get; set; }
|
||||||
|
public decimal? amount1 { get; set; }
|
||||||
|
public decimal? number_of_hours2 { get; set; }
|
||||||
|
public decimal? number_of_weeks2 { get; set; }
|
||||||
|
public decimal? amount2 { get; set; }
|
||||||
|
public decimal? total_amount { get; set; }
|
||||||
|
public string major { get; set; }
|
||||||
|
public List<teaching_fee_extra_datadetail> datadetail { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class teaching_fee_extra_datadetail
|
||||||
|
{
|
||||||
|
public string teacher { get; set; }
|
||||||
|
public string teaching_rate { get; set; }
|
||||||
|
public decimal? number_of_hours1 { get; set; }
|
||||||
|
public decimal? number_of_weeks1 { get; set; }
|
||||||
|
public decimal? amount1 { get; set; }
|
||||||
|
public decimal? number_of_hours2 { get; set; }
|
||||||
|
public decimal? number_of_weeks2 { get; set; }
|
||||||
|
public decimal? amount2 { get; set; }
|
||||||
|
public decimal? total_amount { get; set; }
|
||||||
|
//public string major { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,5 @@
|
|||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.0.7" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Models\budget" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="11/21/2022 10:43:01" ReportInfo.CreatorVersion="1.0.0.0">
|
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="11/21/2022 12:18:55" ReportInfo.CreatorVersion="1.0.0.0">
|
||||||
<Dictionary>
|
<Dictionary>
|
||||||
<BusinessObjectDataSource Name="summary_academic_position_leave_graph" ReferenceName="summary_academic_position_leave_graph" DataType="null" Enabled="true">
|
<BusinessObjectDataSource Name="summary_academic_position_leave_graph" ReferenceName="summary_academic_position_leave_graph" DataType="null" Enabled="true">
|
||||||
<Column Name="year" DataType="System.String"/>
|
<Column Name="year" DataType="System.String"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user