update GetLastEffectRound method to accept effectiveDate parameter and adjust usage in LeaveReportController
This commit is contained in:
parent
a540912202
commit
99accd44e3
2 changed files with 5 additions and 4 deletions
|
|
@ -101,12 +101,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId)
|
||||
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId, DateTime? effectiveDate = null)
|
||||
{
|
||||
effectiveDate ??= DateTime.Now;
|
||||
var data = await _dbContext.Set<UserDutyTime>()
|
||||
.Where(x => x.ProfileId == profileId)
|
||||
.Where(x => x.IsProcess)
|
||||
.Where(x => x.EffectiveDate.Value.Date <= DateTime.Now.Date)
|
||||
.Where(x => x.EffectiveDate.Value.Date <= effectiveDate.Value.Date)
|
||||
.OrderByDescending(x => x.EffectiveDate)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -1768,7 +1768,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
// return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
|
||||
//}
|
||||
|
||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
|
||||
// ให้ใช้วันที่จาก loop date แทน
|
||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
|
||||
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue