update LeaveReportController to pass date parameter to GetLastEffectRound method
This commit is contained in:
parent
99accd44e3
commit
95cd49ecbc
2 changed files with 60 additions and 12 deletions
|
|
@ -877,7 +877,28 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
else
|
||||
startTime = duty.StartTimeMorning;
|
||||
|
||||
var checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||
string checkInStatus = "NORMAL";
|
||||
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(userId, currentDate.Date);
|
||||
if (leaveReq != null)
|
||||
{
|
||||
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||
if (leaveRange == "MORNING")
|
||||
checkInStatus = "NORMAL";
|
||||
else
|
||||
{
|
||||
checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {startTime}") ?
|
||||
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"LATE" :
|
||||
"NORMAL";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {startTime}") ?
|
||||
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||
|
|
@ -885,6 +906,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
"ABSENT" :
|
||||
"LATE" :
|
||||
"NORMAL";
|
||||
}
|
||||
|
||||
|
||||
// process - รอทำใน queue
|
||||
var checkin_process = new ProcessUserTimeStamp
|
||||
|
|
@ -959,16 +982,41 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
}
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
||||
var checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
"ABSENT" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL";
|
||||
|
||||
string checkOutStatus = "NORMAL";
|
||||
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(userId, currentDate.Date);
|
||||
if (leaveReq != null)
|
||||
{
|
||||
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||
if (leaveRange == "AFTERNOON")
|
||||
checkOutStatus = "NORMAL";
|
||||
else
|
||||
{
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
||||
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
"ABSENT" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
||||
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
||||
"ABSENT" :
|
||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL";
|
||||
}
|
||||
|
||||
if (checkout_process != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2099,7 +2099,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
||||
|
||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
|
||||
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