fix calculate work time

This commit is contained in:
dbdbd9 2025-07-31 09:14:33 +07:00
parent 4f6f3dd803
commit b52537cfe4
2 changed files with 5 additions and 5 deletions

View File

@ -1125,7 +1125,7 @@ class TicketController extends Controller
if ($type == 'S') { if ($type == 'S') {
$end = $date->copy()->setTime(11, 30, 0); $end = $date->copy()->setTime(11, 30, 0);
} else if ($type == 'C') { } else if ($type == 'C') {
$start = $date->copy()->setTime(11, 30, 0); $start = $date->copy()->setTime(13, 0, 0);
} }
Tracking::insert([ Tracking::insert([
@ -1134,14 +1134,14 @@ class TicketController extends Controller
'user_id' => $user->id, 'user_id' => $user->id,
'status' => 'check in', 'status' => 'check in',
'time_string' => $start->format('Y-m-d H:i:s'), 'time_string' => $start->format('Y-m-d H:i:s'),
'created_at' => $start->setTimezone('UTC') 'created_at' => $start->setTimezone(env('TIME_ZONE'))
], ],
[ [
'name' => $user->name, 'name' => $user->name,
'user_id' => $user->id, 'user_id' => $user->id,
'status' => 'check out', 'status' => 'check out',
'time_string' => $end->format('Y-m-d H:i:s'), 'time_string' => $end->format('Y-m-d H:i:s'),
'created_at' => $end->setTimezone('UTC') 'created_at' => $end->setTimezone(env('TIME_ZONE'))
] ]
]); ]);
//WFH - end tracking //WFH - end tracking

View File

@ -78,14 +78,14 @@ class TimekeepingController extends Controller
'user_id' => $user->id, 'user_id' => $user->id,
'status' => 'check in', 'status' => 'check in',
'time_string' => $start->format('Y-m-d H:i:s'), 'time_string' => $start->format('Y-m-d H:i:s'),
'created_at' => $start->setTimezone('UTC') 'created_at' => $start->setTimezone(env('TIME_ZONE'))
], ],
[ [
'name' => $user->name, 'name' => $user->name,
'user_id' => $user->id, 'user_id' => $user->id,
'status' => 'check out', 'status' => 'check out',
'time_string' => $end->format('Y-m-d H:i:s'), 'time_string' => $end->format('Y-m-d H:i:s'),
'created_at' => $end->setTimezone('UTC') 'created_at' => $end->setTimezone(env('TIME_ZONE'))
] ]
]); ]);
} }