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
|
else
|
||||||
startTime = duty.StartTimeMorning;
|
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")} {startTime}") ?
|
||||||
|
|
||||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
|
||||||
|
|
@ -885,6 +906,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
"ABSENT" :
|
"ABSENT" :
|
||||||
"LATE" :
|
"LATE" :
|
||||||
"NORMAL";
|
"NORMAL";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// process - รอทำใน queue
|
// process - รอทำใน queue
|
||||||
var checkin_process = new ProcessUserTimeStamp
|
var checkin_process = new ProcessUserTimeStamp
|
||||||
|
|
@ -959,16 +982,41 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
}
|
}
|
||||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
|
|
||||||
var checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
string checkOutStatus = "NORMAL";
|
||||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(userId, currentDate.Date);
|
||||||
// "ABSENT" :
|
if (leaveReq != null)
|
||||||
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
|
{
|
||||||
"ABSENT" :
|
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||||
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
if (leaveRange == "AFTERNOON")
|
||||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
checkOutStatus = "NORMAL";
|
||||||
"ABSENT" :
|
else
|
||||||
"NORMAL";
|
{
|
||||||
|
// 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)
|
if (checkout_process != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2099,7 +2099,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
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 roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||||
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue