Refactor checkout status logic in LeaveController for improved clarity and handling of check-in dates
This commit is contained in:
parent
3e3bfff7ba
commit
bba6573ea8
1 changed files with 13 additions and 4 deletions
|
|
@ -1412,11 +1412,20 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var leaveRange = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
var leaveRange = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
if (leaveRange == "AFTERNOON" || leaveRange == "ALL")
|
if (leaveRange == "AFTERNOON" || leaveRange == "ALL")
|
||||||
{
|
{
|
||||||
if(DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
if (checkout.CheckIn.Date < currentDate.Date)
|
||||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}"))
|
{
|
||||||
checkOutStatus = "ABSENT";
|
// ถ้า check-out เป็นวันถัดไป สถานะปกติเสมอ
|
||||||
else
|
|
||||||
checkOutStatus = "NORMAL";
|
checkOutStatus = "NORMAL";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||||
|
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}"))
|
||||||
|
checkOutStatus = "ABSENT";
|
||||||
|
else
|
||||||
|
checkOutStatus = "NORMAL";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue