ปรับการเอาวันที่ใช้ไป และยอดวันลาพักผ่อนยกมา มาใช้งาน
Some checks failed
release-dev / release-dev (push) Failing after 11s
Some checks failed
release-dev / release-dev (push) Failing after 11s
This commit is contained in:
parent
a7b8c2786c
commit
04b17729e0
4 changed files with 56 additions and 19 deletions
|
|
@ -280,6 +280,18 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
{
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(keycloakUserId, AccessToken);
|
||||
if (pf == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var beginningLeave = await _dbContext.Set<LeaveBeginning>().AsNoTracking()
|
||||
.Where(x => x.ProfileId == pf.Id)
|
||||
.Where(x => x.LeaveYear == year)
|
||||
.Where(x => x.LeaveTypeId == leaveTypeId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
|
||||
|
||||
var startFiscalDate = new DateTime(year - 1, 10, 1);
|
||||
var endFiscalDate = new DateTime(year, 9, 30);
|
||||
|
||||
|
|
@ -293,7 +305,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
.ToListAsync();
|
||||
|
||||
return data.Sum(x => x.LeaveTotal);
|
||||
return data.Sum(x => x.LeaveTotal) + (beginningLeave == null ? 0 : beginningLeave.LeaveDaysUsed);
|
||||
}
|
||||
|
||||
//public async Task<double> GetSumApproveLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue