subMonths(1)->format('%B');
$employeeTotals = [];
foreach ($data as $employee) {
$recordsGrouped = is_array($employee->records) ? $employee->records : (array)$employee->records;
$monthlyTotals = [];
foreach ($recordsGrouped as $month => $attendances) {
$tsec = 0;
foreach ($attendances as $attendance) {
if (!empty($attendance->duration)) {
[$h, $m, $s] = explode(':', $attendance->duration);
$tsec += (int)$h * 3600 + (int)$m * 60 + (int)$s;
}
}
$hours = floor($tsec / 3600);
$minutes = floor(($tsec % 3600) / 60);
$monthlyTotals[$month] = sprintf('%02d:%02d', $hours, $minutes);
}
$employeeTotals[$employee->id] = $monthlyTotals;
}
?>
@extends('app')
@section('style')
@endsection
@section('content')
@if(empty($data) || count($data) == 0)
اطلاعاتی موجود نمیباشد
@else
@foreach($data as $employee)
@endforeach
@foreach($data as $employee)
@php
$recordsGrouped = is_array($employee->records) ? $employee->records : (array)$employee->records;
@endphp
@if(empty($recordsGrouped))
رکورد ترددی برای این شخص ثبت نشده است.
@else
@foreach(array_keys($recordsGrouped) as $month)
@endforeach
@foreach($recordsGrouped as $month => $records)
| تاریخ |
روز |
ورود |
خروج |
مدت |
@foreach($records as $row)
| {{ \App\Support\JalaliHelper::format($row->entered_at, 'm/d') }} |
{{ \App\Support\JalaliHelper::format($row->entered_at, '%A') }} |
{{ Carbon::parse($row->entered_at)->format('H:i') ?? '-' }} |
{{ $row->exited_at ? Carbon::parse($row->exited_at)->format('H:i') : '-' }} |
{{ $row->duration ? Carbon::parse($row->duration)->format('H:i') : '-' }} |
@endforeach
|
مجموع کارکرد این ماه: {{ $employeeTotals[$employee->id][$month] ?? '00:00' }}
|
@endforeach
@endif
@endforeach
@endif
@endsection