@php $totalDistance = collect($timelines)->sum(fn ($timeline) => $timeline->distance ?? 0); $totalOilCost = collect($timelines)->sum(fn ($timeline) => $timeline->oil_cost ?? 0); $chunkSize = 20; $timelineChunks = collect($timelines)->chunk($chunkSize); $chunksCount = $timelineChunks->count(); $globalIndex = 0; @endphp

รายงาน Timeline การเดินทาง

วันที่ออกรายงาน: {{ date('d/m/Y H:i:s') }}
จำนวนรายการทั้งหมด: {{ count($timelines) }} รายการ
@foreach($timelineChunks as $chunkIndex => $chunk)
@foreach($chunk as $timeline) @php $globalIndex++; @endphp @endforeach @if($chunkIndex === $chunksCount - 1) @endif
ลำดับ สมาชิก สถานที่ปัจจุบัน สถานที่จะไป ระยะทาง (กม.) ค่าน้ำมัน (บาท) วันที่ เช็คอิน เช็คเอาท์ สถานะ
{{ $globalIndex }} {{ $timeline->member->name ?? '-' }} {{ $timeline->current_place ?? '-' }} {{ $timeline->target_place ?? '-' }} {{ $timeline->distance ? number_format($timeline->distance, 2) : '-' }} {{ $timeline->oil_cost ? number_format($timeline->oil_cost, 2) : '-' }} {{ $timeline->date ? date('d/m/Y', strtotime($timeline->date)) : '-' }} {{ $timeline->time ? date('H:i', strtotime($timeline->time)) : '-' }} {{ $timeline->checkout_time ? date('H:i', strtotime($timeline->checkout_time)) : '-' }} {{ $timeline->status_request ? $timeline->status_request : '-' }}
รวมทั้งหมด: {{ number_format($totalDistance, 2) }} {{ number_format($totalOilCost, 2) }}
@endforeach @if(count($timelines) === 0)
ลำดับ สมาชิก สถานที่ปัจจุบัน สถานที่จะไป ระยะทาง (กม.) ค่าน้ำมัน (บาท) วันที่ เช็คอิน เช็คเอาท์ สถานะ
ไม่พบข้อมูล
@endif @if($chunkIndex === $chunksCount - 1)
สรุปข้อมูล1

ระยะทางรวม: {{ number_format($totalDistance, 2) }} กิโลเมตร
ค่าน้ำมันรวม: {{ number_format($totalOilCost, 2) }} บาท
@endif