BỔ SUNG CHECK THÊM điều kiện user ticket nguyên ngày #97
|
|
@ -125,8 +125,15 @@ class CheckUserAttendanceJob implements ShouldQueue
|
|||
|
||||
$type = 'ONLEAVE';
|
||||
$reason = 'KHONG PHEP';
|
||||
|
||||
//Check ngày hợp lệ nếu có check và check out của user khác
|
||||
$dateNow = Tracking::whereBetween('time_string', [$startTime, $endTime])
|
||||
->get();
|
||||
$hasCheckIndateNow = $dateNow->where('status', 'check in')->isNotEmpty();
|
||||
$hasCheckOutdateNow = $dateNow->where('status', 'check out')->isNotEmpty();
|
||||
|
||||
// Nếu không có check-in hoặc check-out, và chưa có ticket, tạo ticket mới
|
||||
if (!$hasCheckIn && !$hasCheckOut && !$existingTicket) {
|
||||
if (($hasCheckIndateNow && $hasCheckOutdateNow) && !$hasCheckIn && !$hasCheckOut && !$existingTicket) {
|
||||
Ticket::create([
|
||||
'user_id' => $userId,
|
||||
'start_date' => $today->format('Y-m-d'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue