bug fixed

This commit is contained in:
kamonwan taengsuk
2023-07-11 11:55:40 +07:00
parent 6a65a50caa
commit 52f5014980
9 changed files with 512 additions and 637 deletions

View File

@@ -2797,462 +2797,444 @@ namespace rmutr_report.Controllers
}
}
// [HttpPost, Route("reports/personnel_salary_temporary/{type}")]
// [ApiExplorerSettings(GroupName = "reports")]
// public IActionResult GetTemporaryReport([FromRoute] string type,
// [FromBody] personnel_salary_temporary_root _personnel)
// {
// var workbook = new XLWorkbook();
// var ws = workbook.Worksheets.Add("ลูกจ้างชั่วคราว");
// if (_personnel.year == "2567")
// {
// _personnel.year = "2566";
// }
//
// ws.Range("A1:T1").Merge().Value = "รายละเอียดค่าจ้างและส่วนควบของลูกจ้างชั่วคราว ประจำปีงบประมาณ พ.ศ." +
// _personnel.year;
// ws.Cell("A1").Style.Alignment.WrapText = true;
// ws.Range("A1:T1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Range("A1:T1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("A1:T1").Style.Font.FontName = "TH SarabunPSK";
// ws.Range("A1:T1").Style.Font.SetBold().Font.FontSize = 16;
// ws.Range("A2:T2").Merge().Value = "มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
// ws.Cell("A2").Style.Alignment.WrapText = true;
// ws.Range("A2:T2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Range("A2:T2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("A2:T2").Style.Font.FontName = "TH SarabunPSK";
// ws.Range("A2:T2").Style.Font.SetBold().Font.FontSize = 16;
// ws.Range("A3:T3").Merge().Value = "หน่วย : บาท";
// ws.Cell("A3").Style.Alignment.WrapText = true;
// ws.Range("A3:T3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
// ws.Range("A3:T3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("A3:T3").Style.Font.FontName = "TH SarabunPSK";
// ws.Range("A3:T3").Style.Font.FontSize = 16;
// ws.Range("A4:A7").Merge().Value = "ลำดับที่";
// ws.Cell("A4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("A4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("A4:A7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("A4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("A4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("B4:C7").Merge().Value = "ชื่อ- สกุล";
// ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("B4:C7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("B4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("D4:D7").Merge().Value = "ชื่อตำแหน่ง";
// ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("D4:D7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("D4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("E4:F7").Merge().Value = "สังกัด";
// ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("E4:F7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("E4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("G4:H6").Merge().Value = "ค่าจ้าง ณ 1 ต.ค. 64 - 30 ก.ย. 65";
// ws.Cell("G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("G4:H6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("G4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("G4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("I4:J6").Merge().Value = "ค่าจ้าง 1 ต.ค. 65 - 30 ก.ย. 66";
// ws.Cell("I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("I4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("I4:J6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("I4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("J4:J6").Merge().Value = "ประมาณการเลื่อนขั้น 1 ขั้น 1 เม.ย. 65 - 30 ก.ย. 65";
// ws.Cell("J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("J4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("J4:J6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("J4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("K4:S4").Merge().Value = "ส่วนควบงบดำเนินงาน";
// ws.Cell("K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("K4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("K4:S4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("K4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("K5:L6").Merge().Value = "ค่าเช่าบ้าน";
// ws.Cell("K5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("K5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("K5:L6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("K5").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("K5").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("M5:N6").Merge().Value = "เงินสมทบกองทุนประกันสังคม";
// ws.Cell("M5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("M5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("M5:N6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("M5").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("M5").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("O5:P6").Merge().Value = "เงินสมทบกองทุนเงินทดแทน";
// ws.Cell("O5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("O5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("O5:P6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("O5").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("O5").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Range("Q5:R5").Merge().Value = "อื่น ๆ";
// ws.Cell("Q5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("Q5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("Q5:R5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("Q5").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("Q5").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Cell("Q6").Value = "ระบุรายการ";
// ws.Cell("Q6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("Q6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("Q6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("Q6").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("Q6").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Cell("R6").Value = "จำนวนเงิน";
// ws.Cell("R6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("R6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("R6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("R6").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("R6").Style.Font.SetBold().Font.FontSize = 16;
//
//
// ws.Range("S5:S6").Merge().Value = "รวม";
// ws.Cell("S5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("S5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("S5:S6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("S5").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("S5").Style.Font.SetBold().Font.FontSize = 16;
// ws.Range("T4:T6").Merge().Value = "รวมค่าจ้างและส่วนควบ";
// ws.Cell("T4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("T4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Range("T4:T6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("T4").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("T4").Style.Font.SetBold().Font.FontSize = 16;
//
// ws.Cell("H7").Value = "*12";
// ws.Cell("H7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("H7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("H7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("H7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("H7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("I7").Value = "(1)";
// ws.Cell("I7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("I7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("I7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("I7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("I7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("J7").Value = "(1)*12";
// ws.Cell("J7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("J7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("J7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("J7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("J7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("K7").Value = "(2)";
// ws.Cell("K7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("K7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("K7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("K7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("K7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("L7").Value = "(2)*12";
// ws.Cell("L7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("L7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("L7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("L7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("L7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("M7").Value = "(3)";
// ws.Cell("M7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("M7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("M7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("M7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("M7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("N7").Value = "(3)*12";
// ws.Cell("N7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("N7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("N7").Style.Border.BottomBorder = XLBorderStyleValues.Thin;
// ws.Cell("N7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("N7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("O7").Value = "(4)";
// ws.Cell("O7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("O7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("O7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("O7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("O7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("P7").Value = "(4)*12";
// ws.Cell("P7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("P7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("P7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("P7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("P7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("R7").Value = "(5)";
// ws.Cell("R7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("R7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("R7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("R7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("R7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("S7").Value = "(6) = (2) ถึง (5)";
// ws.Cell("S7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("S7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("S7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("S7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("S7").Style.Font.SetBold().Font.FontSize = 12;
// ws.Cell("T7").Value = "(7) = (1) + (6)";
// ws.Cell("T7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell("T7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
// ws.Cell("T7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell("T7").Style.Font.FontName = "TH SarabunPSK";
// ws.Cell("T7").Style.Font.SetBold().Font.FontSize = 12;
//
// ws.Range("A4:T7").Style.Alignment.WrapText = true;
// ws.Row(4).Height = 40;
// ws.Row(5).Height = 40;
// ws.Row(6).Height = 40;
// ws.Column(1).Width = 10;
// ws.Column(2).Width = 10;
// ws.Column(3).Width = 20;
// ws.Column(4).Width = 20;
// ws.Column(5).Width = 30;
// ws.Column(6).Width = 30;
// ws.Column(7).Width = 20;
// 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;
//
// int row = 8;
// int no = 1;
//
// if (_personnel != null)
// {
// foreach (var detail in _personnel.personnel_salary_temporary)
// {
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Merge().Value = detail.agency_category_name;
// ws.Cell(row, 8).Value = detail.salary;
// ws.Cell(row, 9).Value = detail.salary_12;
// ws.Cell(row, 10).Value = detail.salary2_12;
// ws.Cell(row, 11).Value = detail.house_rent;
// ws.Cell(row, 12).Value = detail.house_rent_12;
// ws.Cell(row, 13).Value = detail.salary_next_year_12;
// ws.Cell(row, 14).Value = detail.retiree;
// ws.Cell(row, 15).Value = detail.salary_per_month;
// ws.Cell(row, 16).Value = detail.salary_per_month_12;
// ws.Cell(row, 17).Value = detail.retirement_salary_per_year;
// ws.Cell(row, 18).Value = detail.special_compensation;
//
// 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.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Center;
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Right;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Fill.BackgroundColor = XLColor.LightYellow;
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.NumberFormat.SetFormat("#,#");
// row++;
// foreach (var detail2 in detail.personnel_salary_deltails)
// {
// if (detail2.first_name_th != "รวม")
// {
// ws.Cell(row, 1).Value = no;
// no++;
// ws.Cell(row, 2).Value = detail2.manpower;
// ws.Cell(row, 3).Value = detail2.first_name_th;
// ws.Cell(row, 4).Value = detail2.last_name_th;
// //ws.Range(ws.Cell(row, 3), ws.Cell(row, 4)).Merge().Value = detail2.full_name;
// ws.Cell(row, 5).Value = detail2.position;
// ws.Cell(row, 6).Value = detail2.parent_agency_name;
// ws.Cell(row, 7).Value = detail2.area;
// ws.Cell(row, 8).Value = detail2.salary;
// ws.Cell(row, 9).Value = detail2.estimate_promote_1;
// ws.Cell(row, 10).Value = detail2.estimate_promote_2;
// ws.Cell(row, 11).Value = detail2.estimate_promote_3;
// ws.Cell(row, 12).Value = detail2.estimate_promote_4;
// ws.Cell(row, 13).Value = detail2.salary_next_year_12;
// ws.Cell(row, 14).Value = detail2.retiree;
// ws.Cell(row, 15).Value = detail2.salary_per_month;
// ws.Cell(row, 16).Value = detail2.salary_per_month_12;
// ws.Cell(row, 17).Value = detail2.retirement_salary_per_year;
// ws.Cell(row, 18).Value = detail2.special_compensation;
// ws.Cell(row, 19).Value = detail2.special_compensation_12;
// ws.Cell(row, 20).Value = detail2.full_salary;
// ws.Cell(row, 21).Value = detail2.special_compensation_1;
// ws.Cell(row, 22).Value = detail2.special_compensation_2;
// ws.Cell(row, 23).Value = detail2.special_compensation_3;
// ws.Cell(row, 24).Value = detail2.other;
// ws.Cell(row, 25).Value = detail2.other_price;
// ws.Cell(row, 26).Value = detail2.total;
// ws.Cell(row, 27).Value = detail2.total_wages_and_fittings;
// //ws.Cell(row, 28).Value = _personnel.total_wages_and_fittings_12;
// 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;
// ws.Cell(row, 20).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 21).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 22).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 23).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 24).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 25).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 26).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 27).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
//
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontSize = 16;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Center;
// ws.Range(ws.Cell(row, 3), ws.Cell(row, 7)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Left;
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Right;
// //ws.Range(ws.Cell(row, 8), ws.Cell(row, 21)).SetDataType(XLDataType.Number);
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.NumberFormat.SetFormat("#,#");
// row++;
// }
//
// if (detail2.first_name_th == "รวม")
// {
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = detail2.first_name_th;
//
// ws.Cell(row, 8).Value = detail2.salary;
// ws.Cell(row, 9).Value = detail2.estimate_promote_1;
// ws.Cell(row, 10).Value = detail2.estimate_promote_2;
// ws.Cell(row, 11).Value = detail2.estimate_promote_3;
// ws.Cell(row, 12).Value = detail2.estimate_promote_4;
// ws.Cell(row, 13).Value = detail2.salary_next_year_12;
// ws.Cell(row, 14).Value = detail2.retiree;
// ws.Cell(row, 15).Value = detail2.salary_per_month;
// ws.Cell(row, 16).Value = detail2.salary_per_month_12;
// ws.Cell(row, 17).Value = detail2.retirement_salary_per_year;
// ws.Cell(row, 18).Value = detail2.special_compensation;
// ws.Cell(row, 19).Value = detail2.special_compensation_12;
// ws.Cell(row, 20).Value = detail2.full_salary;
// ws.Cell(row, 21).Value = detail2.special_compensation_1;
// ws.Cell(row, 22).Value = detail2.special_compensation_2;
// ws.Cell(row, 23).Value = detail2.special_compensation_3;
// ws.Cell(row, 24).Value = detail2.other;
// ws.Cell(row, 25).Value = detail2.other_price;
// ws.Cell(row, 26).Value = detail2.total;
// ws.Cell(row, 27).Value = detail2.total_wages_and_fittings;
// //ws.Cell(row, 28).Value = _personnel.total_wages_and_fittings_12;
// 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;
// ws.Cell(row, 20).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 21).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 22).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 23).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 24).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 25).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 26).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 27).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
//
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Border.TopBorder =
// XLBorderStyleValues.Double;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Font.SetBold().Font.FontSize = 16;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 4)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Center;
// // ws.Range(ws.Cell(row, 3), ws.Cell(row, 7)).Style.Alignment.Horizontal =
// // XLAlignmentHorizontalValues.Left;
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.Alignment.Horizontal =
// XLAlignmentHorizontalValues.Right;
// //ws.Range(ws.Cell(row, 8), ws.Cell(row, 21)).SetDataType(XLDataType.Number);
// ws.Range(ws.Cell(row, 8), ws.Cell(row, 27)).Style.NumberFormat.SetFormat("#,#");
// }
// }
// }
// }
//
//
// 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",
// "personnel_temporary_" + date + ".xlsx");
// }
// }
[HttpPost, Route("reports/personnel_salary_temporary/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetTemporaryReport([FromRoute] string type,
[FromBody] personnel_salary_temporary_root _personnel)
{
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("ลูกจ้างชั่วคราว");
if (_personnel.year == "2567")
{
_personnel.year = "2566";
}
ws.Range("A1:T1").Merge().Value = "รายละเอียดค่าจ้างและส่วนควบของลูกจ้างชั่วคราว ประจำปีงบประมาณ พ.ศ." +
_personnel.year;
ws.Cell("A1").Style.Alignment.WrapText = true;
ws.Range("A1:T1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A1:T1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A1:T1").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A1:T1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A2:T2").Merge().Value = "มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
ws.Cell("A2").Style.Alignment.WrapText = true;
ws.Range("A2:T2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A2:T2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A2:T2").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A2:T2").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A3:T3").Merge().Value = "หน่วย : บาท";
ws.Cell("A3").Style.Alignment.WrapText = true;
ws.Range("A3:T3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Range("A3:T3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A3:T3").Style.Font.FontName = "TH SarabunPSK";
ws.Range("A3:T3").Style.Font.FontSize = 16;
ws.Range("A4:A7").Merge().Value = "ลำดับที่";
ws.Cell("A4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("A4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("A4:A7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("A4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("A4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("B4:C7").Merge().Value = "ชื่อ- สกุล";
ws.Cell("B4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("B4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("B4:C7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("B4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("B4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("D4:D7").Merge().Value = "ชื่อตำแหน่ง";
ws.Cell("D4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("D4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("D4:D7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("D4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("D4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("E4:F7").Merge().Value = "สังกัด";
ws.Cell("E4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("E4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("E4:F7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("E4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("E4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("G4:H6").Merge().Value = "ค่าจ้าง ณ 1 ต.ค. 64 - 30 ก.ย. 65";
ws.Cell("G4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("G4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("G4:H6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("G4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("G4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("I4:I6").Merge().Value = "ค่าจ้าง 1 ต.ค. 65 - 30 ก.ย. 66";
ws.Cell("I4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("I4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("I4:I6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("I4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("J4:J6").Merge().Value = "ประมาณการเลื่อนขั้น 1 ขั้น 1 เม.ย. 65 - 30 ก.ย. 65";
ws.Cell("J4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("J4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("J4:J6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("J4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("J4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("K4:S4").Merge().Value = "ส่วนควบงบดำเนินงาน";
ws.Cell("K4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("K4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("K4:S4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("K4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K4").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("K5:L6").Merge().Value = "ค่าเช่าบ้าน";
ws.Cell("K5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("K5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("K5:L6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("K5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K5").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("M5:N6").Merge().Value = "เงินสมทบกองทุนประกันสังคม";
ws.Cell("M5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("M5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("M5:N6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("M5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("M5").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("O5:P6").Merge().Value = "เงินสมทบกองทุนเงินทดแทน";
ws.Cell("O5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("O5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("O5:P6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("O5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("O5").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("Q5:R5").Merge().Value = "อื่น ๆ";
ws.Cell("Q5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("Q5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("Q5:R5").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("Q5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("Q5").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("Q6").Value = "ระบุรายการ";
ws.Cell("Q6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("Q6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("Q6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("Q6").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("Q6").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("R6").Value = "จำนวนเงิน";
ws.Cell("R6").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("R6").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("R6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("R6").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("R6").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("S5:S6").Merge().Value = "รวม";
ws.Cell("S5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("S5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("S5:S6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("S5").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("S5").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("T4:T6").Merge().Value = "รวมค่าจ้างและส่วนควบ";
ws.Cell("T4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("T4").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Range("T4:T6").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("T4").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("T4").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("H7").Value = "*12";
ws.Cell("H7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("H7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("H7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("I7").Value = "(1)";
ws.Cell("I7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("I7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("I7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("I7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("I7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("J7").Value = "(1)*12";
ws.Cell("J7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("J7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("J7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("J7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("J7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("K7").Value = "(2)";
ws.Cell("K7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("K7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("K7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("K7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("K7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("L7").Value = "(2)*12";
ws.Cell("L7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("L7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("L7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("L7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("L7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("M7").Value = "(3)";
ws.Cell("M7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("M7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("M7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("M7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("M7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("N7").Value = "(3)*12";
ws.Cell("N7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("N7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("N7").Style.Border.BottomBorder = XLBorderStyleValues.Thin;
ws.Cell("N7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("N7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("O7").Value = "(4)";
ws.Cell("O7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("O7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("O7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("O7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("O7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("P7").Value = "(4)*12";
ws.Cell("P7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("P7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("P7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("P7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("P7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("R7").Value = "(5)";
ws.Cell("R7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("R7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("R7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("R7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("R7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("S7").Value = "(6) = (2) ถึง (5)";
ws.Cell("S7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("S7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("S7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("S7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("S7").Style.Font.SetBold().Font.FontSize = 12;
ws.Cell("T7").Value = "(7) = (1) + (6)";
ws.Cell("T7").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("T7").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("T7").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("T7").Style.Font.FontName = "TH SarabunPSK";
ws.Cell("T7").Style.Font.SetBold().Font.FontSize = 12;
ws.Range("A4:T7").Style.Alignment.WrapText = true;
ws.Row(4).Height = 40;
ws.Row(5).Height = 40;
ws.Row(6).Height = 40;
ws.Column(1).Width = 10;
ws.Column(2).Width = 10;
ws.Column(3).Width = 20;
ws.Column(4).Width = 20;
ws.Column(5).Width = 30;
ws.Column(6).Width = 30;
ws.Column(7).Width = 20;
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;
int row = 8;
int no = 1;
if (_personnel != null)
{
foreach (var detail in _personnel.personnel_salary_temporary)
{
ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Merge().Value = detail.agency_category_name;
ws.Cell(row, 7).Value = detail.salary;
ws.Cell(row, 8).Value = detail.salary_12;
ws.Cell(row, 9).Value = detail.salary2;
ws.Cell(row, 10).Value = detail.salary2_12;
ws.Cell(row, 11).Value = detail.house_rent;
ws.Cell(row, 12).Value = detail.house_rent_12;
ws.Cell(row, 13).Value = detail.fund_contribution;
ws.Cell(row, 14).Value = detail.fund_contribution_12;
ws.Cell(row, 15).Value = detail.contribution;
ws.Cell(row, 16).Value = detail.contribution_12;
ws.Cell(row, 17).Value = detail.other;
ws.Cell(row, 18).Value = detail.other_price;
ws.Cell(row, 19).Value = detail.total2;
ws.Cell(row, 20).Value = detail.total_wage;
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;
ws.Cell(row, 20).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.SetBold().Font.FontSize = 16;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Cell(row, 1).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Fill.BackgroundColor = XLColor.LightYellow;
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.NumberFormat.SetFormat("#,#");
ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
row++;
foreach (var detail2 in detail.personnel_salary_temporary_deltail)
{
if (detail2.first_name_th != "รวม")
{
ws.Cell(row, 1).Value = no;
no++;
ws.Cell(row, 2).Value = detail2.first_name_th;
ws.Cell(row, 3).Value = detail2.last_name_th;
ws.Cell(row, 4).Value = detail2.position;
ws.Cell(row, 5).Value = detail2.parent_agency_name;
ws.Cell(row, 6).Value = detail2.area;
ws.Cell(row, 7).Value = detail2.salary;
ws.Cell(row, 8).Value = detail2.salary_12;
ws.Cell(row, 9).Value = detail2.salary2;
ws.Cell(row, 10).Value = detail2.salary2_12;
ws.Cell(row, 11).Value = detail2.house_rent;
ws.Cell(row, 12).Value = detail2.house_rent_12;
ws.Cell(row, 13).Value = detail2.fund_contribution;
ws.Cell(row, 14).Value = detail2.fund_contribution_12;
ws.Cell(row, 15).Value = detail2.contribution;
ws.Cell(row, 16).Value = detail2.contribution_12;
ws.Cell(row, 17).Value = detail2.other;
ws.Cell(row, 18).Value = detail2.other_price;
ws.Cell(row, 19).Value = detail2.total2;
ws.Cell(row, 20).Value = detail2.total_wage;
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;
ws.Cell(row, 20).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Cell(row, 1).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
//ws.Range(ws.Cell(row, 8), ws.Cell(row, 21)).SetDataType(XLDataType.Number);
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.NumberFormat.SetFormat("#,#0");
row++;
}
if (detail2.first_name_th == "รวม")
{
ws.Range(ws.Cell(row, 1), ws.Cell(row, 3)).Merge().Value = "รวม";
ws.Cell(row, 7).Value = detail2.salary;
ws.Cell(row, 8).Value = detail2.salary_12;
ws.Cell(row, 9).Value = detail2.salary2;
ws.Cell(row, 10).Value = detail2.salary2_12;
ws.Cell(row, 11).Value = detail2.house_rent;
ws.Cell(row, 12).Value = detail2.house_rent_12;
ws.Cell(row, 13).Value = detail2.fund_contribution;
ws.Cell(row, 14).Value = detail2.fund_contribution_12;
ws.Cell(row, 15).Value = detail2.contribution;
ws.Cell(row, 16).Value = detail2.contribution_12;
ws.Cell(row, 17).Value = detail2.other;
ws.Cell(row, 18).Value = detail2.other_price;
ws.Cell(row, 19).Value = detail2.total2;
ws.Cell(row, 20).Value = detail2.total_wage;
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;
ws.Cell(row, 20).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Cell(row, 1).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 6)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
//ws.Range(ws.Cell(row, 8), ws.Cell(row, 21)).SetDataType(XLDataType.Number);
ws.Range(ws.Cell(row, 7), ws.Cell(row, 20)).Style.NumberFormat.SetFormat("#,#0");
}
}
}
}
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",
"personnel_temporary_" + date + ".xlsx");
}
}
[HttpPost, Route("reports/personnel_salary_university/{type}")]
[ApiExplorerSettings(GroupName = "reports")]