dashboard จำนวนคนยืนยันสมัครสอบ

This commit is contained in:
Kittapath 2023-09-23 18:10:12 +07:00
parent 818fb0e219
commit ab4c5988e8

View file

@ -1243,36 +1243,42 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 2, Id = 2,
Name = "จำนวนผู้ยืนยันการสมัครคัดเลือก",
Count = periodExam.Candidate.Where(x=>x.Status!="register").Count()
},
new DashboardResponseItem
{
Id = 3,
Name = "จำนวนผู้มีสิทธิ์เข้ารับคัดเลือกทั้งหมด", Name = "จำนวนผู้มีสิทธิ์เข้ารับคัดเลือกทั้งหมด",
Count = periodExam.Candidate.Where(x=>x.ExamIdenNumber != null).Count() Count = periodExam.Candidate.Where(x=>x.ExamIdenNumber != null).Count()
}, },
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 3, Id = 4,
Name = "จำนวนผู้เข้ารับการคัดเลือกทั้งหมด", Name = "จำนวนผู้เข้ารับการคัดเลือกทั้งหมด",
Count = periodExam.Candidate.Where(x=>x.SeatNumber != null).Count() Count = periodExam.Candidate.Where(x=>x.SeatNumber != null).Count()
}, },
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 4, Id = 5,
Name = "ผ่านการสอบ", Name = "ผ่านการสอบ",
Count = periodExam.Candidate.Where(x=>x.Pass=="ผ่าน" || x.Pass=="ได้").Count() Count = periodExam.Candidate.Where(x=>x.Pass=="ผ่าน" || x.Pass=="ได้").Count()
}, },
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 5, Id = 6,
Name = "ไม่ผ่านการสอบ", Name = "ไม่ผ่านการสอบ",
Count = periodExam.Candidate.Where(x=>x.Pass!=null && x.Pass!="ผ่าน" && x.Pass!="ได้").Count() Count = periodExam.Candidate.Where(x=>x.Pass!=null && x.Pass!="ผ่าน" && x.Pass!="ได้").Count()
}, },
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 6, Id = 7,
Name = "เพศชาย", Name = "เพศชาย",
Count = periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName=="นาย").Count() Count = periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName=="นาย").Count()
}, },
new DashboardResponseItem new DashboardResponseItem
{ {
Id = 7, Id = 8,
Name = "เพศหญิง", Name = "เพศหญิง",
Count = periodExam.Candidate.Where(x=>x.PrefixName != null && (x.PrefixName=="นาง" || x.PrefixName=="นางสาว")).Count() Count = periodExam.Candidate.Where(x=>x.PrefixName != null && (x.PrefixName=="นาง" || x.PrefixName=="นางสาว")).Count()
}, },
@ -1687,10 +1693,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.TabColor = System.Drawing.Color.Black; summarySheet.TabColor = System.Drawing.Color.Black;
// summarySheet.DefaultRowHeight = 17; // summarySheet.DefaultRowHeight = 17;
summarySheet.Column(1).Style.Font.Bold = true; summarySheet.Column(1).Style.Font.Bold = true;
summarySheet.Row(4).Style.Font.Bold = true; summarySheet.Row(5).Style.Font.Bold = true;
summarySheet.Row(6).Style.Font.Bold = true;
summarySheet.Cells[1, 3].Style.Font.Bold = true; summarySheet.Cells[1, 3].Style.Font.Bold = true;
int rowName = 2; int rowName = 2;
int rowCount = 2; int rowCount = 2;
int fixMerge = 2;
summarySheet.Cells[1, 1].Value = "ตั้งแต่"; summarySheet.Cells[1, 1].Value = "ตั้งแต่";
summarySheet.Cells[1, 2].Value = item.DateStart.Date.ToThaiShortDate(); summarySheet.Cells[1, 2].Value = item.DateStart.Date.ToThaiShortDate();
summarySheet.Cells[1, 3].Value = "ถึง"; summarySheet.Cells[1, 3].Value = "ถึง";
@ -1699,9 +1707,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[2, 2].Value = periodExam.Name; summarySheet.Cells[2, 2].Value = periodExam.Name;
summarySheet.Cells[3, 1].Value = "ครั้งที่"; summarySheet.Cells[3, 1].Value = "ครั้งที่";
summarySheet.Cells[3, 2].Value = $"{periodExam.Round}/{periodExam.Year + 543}"; summarySheet.Cells[3, 2].Value = $"{periodExam.Round}/{periodExam.Year + 543}";
summarySheet.Cells[4, 1].Value = "จำนวนผู้สมัคร";
summarySheet.Cells[4, 2].Value = candidates.Count();
if (candidates.Count() > 0) if (candidates.Count() > 0)
{ {
summarySheet.Cells[5, 1].Value = "จำนวน"; summarySheet.Cells[7, 1].Value = "จำนวน";
// summarySheet.Cells[1, 6].Value = "คะแนนภาค ข"; // summarySheet.Cells[1, 6].Value = "คะแนนภาค ข";
// summarySheet.Cells[1, 7].Value = "ผลสอบภาค ข"; // summarySheet.Cells[1, 7].Value = "ผลสอบภาค ข";
// summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ค"; // summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ค";
@ -1723,11 +1733,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
foreach (var education in educations) foreach (var education in educations)
{ {
summarySheet.Cells[4, rowName].Value = education.Name; summarySheet.Cells[6, rowName].Value = education.Name;
summarySheet.Cells[5, rowCount].Value = education.Count; summarySheet.Cells[7, rowCount].Value = education.Count;
rowName++; rowName++;
rowCount++; rowCount++;
} }
summarySheet.Cells[5, fixMerge, 5, rowName].Value = "วุฒิการศึกษา";
summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true;
fixMerge = rowCount;
var careers = await _context.Careers var careers = await _context.Careers
.AsQueryable() .AsQueryable()
.Where(x => x.Candidate.PeriodExam == periodExam) .Where(x => x.Candidate.PeriodExam == periodExam)
@ -1742,39 +1755,44 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.ToListAsync(); .ToListAsync();
foreach (var career in careers) foreach (var career in careers)
{ {
summarySheet.Cells[4, rowName].Value = career.Name; summarySheet.Cells[6, rowName].Value = career.Name;
summarySheet.Cells[5, rowCount].Value = career.Count; summarySheet.Cells[7, rowCount].Value = career.Count;
rowName++; rowName++;
rowCount++; rowCount++;
} }
summarySheet.Cells[4, rowName].Value = "อายุ 1-20 ปี"; summarySheet.Cells[5, fixMerge, 5, rowName].Value = "สถานที่ทำงาน/ฝึกงาน";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 1 && x.Age <= 20).Count(); summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true;
fixMerge = rowCount;
summarySheet.Cells[6, rowName].Value = "อายุ 1-20 ปี";
summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 1 && x.Age <= 20).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[4, rowName].Value = "อายุ 21-45 ปี"; summarySheet.Cells[6, rowName].Value = "อายุ 21-45 ปี";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 21 && x.Age <= 45).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 21 && x.Age <= 45).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[4, rowName].Value = "อายุ 46-60 ปี"; summarySheet.Cells[6, rowName].Value = "อายุ 46-60 ปี";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 46 && x.Age <= 60).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 46 && x.Age <= 60).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[4, rowName].Value = "อายุ 61-70 ปี"; summarySheet.Cells[6, rowName].Value = "อายุ 61-70 ปี";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 61 && x.Age <= 70).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 61 && x.Age <= 70).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[4, rowName].Value = "อายุ 71-80 ปี"; summarySheet.Cells[6, rowName].Value = "อายุ 71-80 ปี";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 71 && x.Age <= 80).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 71 && x.Age <= 80).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[4, rowName].Value = "อายุ 80 ปีขึ้นไป"; summarySheet.Cells[6, rowName].Value = "อายุ 80 ปีขึ้นไป";
summarySheet.Cells[5, rowCount].Value = candidates.Where(x => x.Age >= 81).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 81).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[5, fixMerge, 5, rowName].Value = "ช่วงอายุ";
summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true;
} }
else else
{ {
summarySheet.Cells[5, 1].Value = "ไม่มีผู้สมัครสอบในช่วงเวลานี้"; summarySheet.Cells[7, 1].Value = "ไม่มีผู้สมัครสอบในช่วงเวลานี้";
} }
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns(); summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
package.Save(); package.Save();