Fix รายงานให้แสดงรายชื่อตรงสังกัดที่เลือก issue #1606
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
parent
c348dae155
commit
e58bda8e9e
4 changed files with 45 additions and 9 deletions
|
|
@ -1461,7 +1461,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type, string role, string? nodeId, int? node)
|
||||
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type, string role, string? nodeId, int? node, string? nodeIdByReq, int? nodeByReq)
|
||||
{
|
||||
// var _nodeId = Guid.Parse(nodeId);
|
||||
var data = new List<LeaveRequest>();
|
||||
|
|
@ -1489,7 +1489,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING").ToListAsync();
|
||||
|
||||
// กรองตามสิทธิ์ admin ก่อน
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
|
|
@ -1519,7 +1519,13 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
true
|
||||
).ToList();
|
||||
}
|
||||
|
||||
// กรองตามที่ fe ส่งมา
|
||||
if (role == "ROOT" || role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
data = data
|
||||
.Where(x => nodeByReq == 4 ? x.Child4Id == Guid.Parse(nodeIdByReq) : nodeByReq == 3 ? x.Child3Id == Guid.Parse(nodeIdByReq) : nodeByReq == 2 ? x.Child2Id == Guid.Parse(nodeIdByReq) : nodeByReq == 1 ? x.Child1Id == Guid.Parse(nodeIdByReq) : nodeByReq == 0 ? x.RootId == Guid.Parse(nodeIdByReq) : true)
|
||||
.ToList();
|
||||
}
|
||||
var res = (from d in data
|
||||
group d by new { d.Root, d.Child1, d.Child2, d.Child3, d.Child4 } into grp
|
||||
orderby grp.Key.Root, grp.Key.Child1, grp.Key.Child2, grp.Key.Child3, grp.Key.Child4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue