This commit is contained in:
AdisakKanthawilang 2025-05-29 17:46:42 +07:00
parent dc2603d107
commit 25f6ebcdd7
2 changed files with 104 additions and 5 deletions

View file

@ -1253,6 +1253,104 @@ namespace BMA.EHR.Application.Repositories.Reports
return resultList;
}
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี NEW
public async Task<dynamic> GetEvaluationResult5YearReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
{
var period = await _dbContext.Set<InsigniaPeriod>()
.FirstOrDefaultAsync(x => x.Id == id);
if (period == null)
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
.Where(x => x.Request.Period.Id == period.Id)
.Where(x => x.IsApprove == true)
.Where(x => x.Status == "PENDING")
.Where(x => x.RequestInsignia.InsigniaType != null);
if (type == "officer")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
}
else if (type == "employee")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
}
switch (node)
{
case 0:
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
break;
case 1:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
break;
case 2:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
break;
case 3:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
break;
case 4:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
break;
default:
break;
}
var data = await data_insigniaQuery
.Select(x => new
{
ProfileId = x.ProfileId,
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
Reason = x.Reason,
Agency = x.Root,
ResultAPR1 = x.APR1,
ResultOCT1 = x.OCT1,
ResultAPR2 = x.APR2,
ResultOCT2 = x.OCT2,
ResultAPR3 = x.APR3,
ResultOCT3 = x.OCT3,
ResultAPR4 = x.APR4,
ResultOCT4 = x.OCT4,
ResultAPR5 = x.APR5,
ResultOCT5 = x.OCT5
})
.ToListAsync();
var seq = 1;
var resultList = new List<object>();
foreach (var d in data)
{
resultList.Add(new
{
rowNo = seq++.ToString().ToThaiNumber(),
d.ProfileId,
d.FullName,
d.RequestInsigniaName,
Agency = d.Agency,
ResultAPR1 = d.ResultAPR1 ?? "-",
ResultOCT1 = d.ResultOCT1 ?? "-",
ResultAPR2 = d.ResultAPR2 ?? "-",
ResultOCT2 = d.ResultOCT2 ?? "-",
ResultAPR3 = d.ResultAPR3 ?? "-",
ResultOCT3 = d.ResultOCT3 ?? "-",
ResultAPR4 = d.ResultAPR4 ?? "-",
ResultOCT4 = d.ResultOCT4 ?? "-",
ResultAPR5 = d.ResultAPR5 ?? "-",
ResultOCT5 = d.ResultOCT5 ?? "-",
Remark = d.Reason ?? "-"
});
}
return resultList;
}
//noti ยื่นเสนอคน
public async Task NotifyInsignia()
{