Refactor checkout status logic in LeaveController for improved clarity and handling of check-in dates
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m46s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m46s
This commit is contained in:
parent
3e3bfff7ba
commit
7ba429bb64
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();
|
||||
if (leaveRange == "AFTERNOON" || leaveRange == "ALL")
|
||||
{
|
||||
if(DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {endTimeMorning}"))
|
||||
checkOutStatus = "ABSENT";
|
||||
else
|
||||
if (checkout.CheckIn.Date < currentDate.Date)
|
||||
{
|
||||
// ถ้า check-out เป็นวันถัดไป สถานะปกติเสมอ
|
||||
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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue