report leave
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
moss 2025-04-08 17:03:33 +07:00
parent 0bc0fb2c99
commit 221f700722
2 changed files with 6 additions and 4 deletions

View file

@ -139,7 +139,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
return data; return data;
} }
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int node) public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int node, DateTime StartDate, DateTime EndDate)
{ {
var _nodeId = Guid.Parse(nodeId); var _nodeId = Guid.Parse(nodeId);
var data = new List<ProcessUserTimeStamp>(); var data = new List<ProcessUserTimeStamp>();
@ -147,6 +147,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
{ {
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable() data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
.Where(x => x.CheckInStatus == "LATE") .Where(x => x.CheckInStatus == "LATE")
.Where(u => u.CheckIn.Date >= StartDate && u.CheckIn.Date <= EndDate)
.Where(x => x.ProfileType == type.Trim().ToUpper()) .Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true))))) .Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.ToListAsync(); .ToListAsync();
@ -155,6 +156,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
{ {
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable() data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
.Where(x => x.CheckInStatus == "LATE") .Where(x => x.CheckInStatus == "LATE")
.Where(u => u.CheckIn.Date >= StartDate && u.CheckIn.Date <= EndDate)
.Where(x => x.ProfileType == type.Trim().ToUpper()) .Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true))))) .Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true)))) .Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true))))

View file

@ -197,7 +197,7 @@ namespace BMA.EHR.Leave.Service.Controllers
// approver = list.First().Name; // approver = list.First().Name;
//} //}
return new return new
{ {
@ -1357,7 +1357,7 @@ namespace BMA.EHR.Leave.Service.Controllers
count++; count++;
} }
} }
employees = employees.OrderBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList(); employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
for (int i = 0; i < employees.Count; i++) for (int i = 0; i < employees.Count; i++)
{ {
employees[i].no = i + 1; employees[i].no = i + 1;
@ -1421,7 +1421,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var employees = new List<dynamic>(); var employees = new List<dynamic>();
var count = 1; var count = 1;
var userTimeStamps = await _processUserTimeStampRepository.GetTimestampByDateLateAsync(type.Trim().ToUpper(), jsonData["result"]?.ToString(), req.nodeId, req.node); var userTimeStamps = await _processUserTimeStampRepository.GetTimestampByDateLateAsync(type.Trim().ToUpper(), jsonData["result"]?.ToString(), req.nodeId, req.node, req.StartDate, req.EndDate);
foreach (var p in userTimeStamps) foreach (var p in userTimeStamps)
{ {
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}"; var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";