นับ || x.LeaveStatus == "DELETING" เข้าไปในรายการ Approve ด้วย
This commit is contained in:
parent
dff98272dd
commit
7e3ae58b33
1 changed files with 16 additions and 19 deletions
|
|
@ -1,8 +1,6 @@
|
|||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Messaging;
|
||||
using BMA.EHR.Application.Responses.Leaves;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||
using BMA.EHR.Domain.Models.Leave.Requests;
|
||||
using BMA.EHR.Domain.Models.Notifications;
|
||||
|
|
@ -10,8 +8,6 @@ using BMA.EHR.Domain.Shared;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Nest;
|
||||
using System.Drawing;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
|
|
@ -415,7 +411,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.Type.Id == leaveType.Id)
|
||||
//.Where(x => x.LeaveStartDate.Year == year)
|
||||
.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.Sum(x => x.LeaveTotal);
|
||||
|
||||
return data;
|
||||
|
|
@ -444,7 +440,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
//.Where(x => x.LeaveStartDate.Year == year)
|
||||
.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
.ToListAsync();
|
||||
|
||||
|
|
@ -470,7 +466,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
.OrderByDescending(x => x.LeaveStartDate.Date)
|
||||
.Select(x => x.LeaveStartDate.Date)
|
||||
|
|
@ -486,7 +482,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.LeaveStartDate.Date < beforeDate.Date)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
.OrderByDescending(x => x.LeaveStartDate.Date)
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
@ -1366,7 +1362,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStartDate.Year == year)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
if (data.Count > 0)
|
||||
|
|
@ -1382,7 +1378,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
if (data.Count > 0)
|
||||
|
|
@ -1397,7 +1393,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
if (data.Count > 0)
|
||||
|
|
@ -1411,7 +1407,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING").ToListAsync();
|
||||
|
||||
var res = (from d in data
|
||||
group d by new { d.KeycloakUserId, LeaveTypeId = d.Type.Id, LeaveTypeCode = d.Type.Code } into grp
|
||||
|
|
@ -1438,7 +1434,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 => node == 4 ? x.Child4Id == Guid.Parse(nodeId) : (node == 3 ? x.Child3Id == Guid.Parse(nodeId) : (node == 2 ? x.Child2Id == Guid.Parse(nodeId) : (node == 1 ? x.Child1Id == Guid.Parse(nodeId) : (node == 0 ? x.RootId == Guid.Parse(nodeId) : (node == null ? true : true))))))
|
||||
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING").ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1448,7 +1444,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => node == 4 ? x.Child4Id == Guid.Parse(nodeId) : (node == 3 ? x.Child3Id == Guid.Parse(nodeId) : (node == 2 ? x.Child2Id == Guid.Parse(nodeId) : (node == 1 ? x.Child1Id == Guid.Parse(nodeId) : (node == 0 ? x.RootId == Guid.Parse(nodeId) : (node == null ? true : 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 => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING").ToListAsync();
|
||||
}
|
||||
|
||||
var res = (from d in data
|
||||
|
|
@ -1504,7 +1500,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
var res = (from d in data
|
||||
group d by new { d.KeycloakUserId, LeaveTypeId = d.Type.Id, LeaveTypeCode = d.Type.Code } into grp
|
||||
|
|
@ -1527,7 +1524,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
if (data.Count > 0)
|
||||
|
|
@ -1543,7 +1540,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.ToListAsync();
|
||||
|
||||
return data.Count;
|
||||
|
|
@ -1628,7 +1625,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
.Where(x => x.LeaveStartDate.Date <= date.Date && x.LeaveEndDate >= date.Date)
|
||||
.FirstOrDefaultAsync();
|
||||
return data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue