@php $addline = 0 @endphp @php $total = count($data) @endphp @foreach($data as $page => $item) @if ($item["driver"] != "") @endif
This document was printed on: {{$item['now']}}

Delivery Method: {{$item["method_name"]}}

Truck {{$item["truck_no"]}} {{$item["driver"] != ""?"(".$item["driver"].")":""}} {{-- Remove this when there is no driver assigned --}}

Delivery Date: {{$item["date"]}}

@foreach($item["data"] as $index => $stop)
{{--

Stop #{{$stop["stop_no"]}}

--}} @if (count($stop["order"]) > 0) @php $total_item = collect($stop["order"])->pluck('detail_order')->flatten(1)->count(); @endphp @if ($total_item > 0) @foreach($stop["order"] as $order) @php $total_item = $order["total"] @endphp @php $total_model = 0 @endphp @foreach($order["detail_order"] as $key => $detail) @for($j = 1; $j <= $detail["qty"];$j++) @php $total_model ++; @endphp @if($key == 0 && $j == 1) {{-- rowspan value based on length of models --}} {{-- rowspan value based on length of models --}} {{-- @else @if ($key == 2) @php $addline ++; @endphp @endif {{-- rowspan value based on length of models --}} @endif @endfor @endforeach @endforeach

Stop #{{$stop["stop_no"]}}

Order# Model Inv. Location Brand Detail Category Install {{ $stop['is_custom'] ? 'Stop Description' : 'Note'}}
{{$detail["order_no"]}}{{$detail["order_no"]}}{{$detail["model"]}} @if (!$stop['is_custom']) ({{$detail["condition"]}}) @endif {{$detail["inventory_location"]}} {{$detail["brand"]}} {{$detail["detail_category"]}} @if (count($detail['installs'])) @foreach ($detail["installs"] as $install)

{{$install['install_name']}}

@endforeach @else - @endif
rowspan value based on length of models --}} @if ($stop['is_custom'])

{{$order["notes"]}}

@else @foreach($order["notes"] as $note)

{{$note['note']}}

@endforeach @endif
{{$detail["order_no"]}}{{$detail["model"]}} ({{$detail["condition"]}}) {{$detail["inventory_location"]}} {{$detail["brand"]}} {{$detail["detail_category"]}} @if (count($detail['installs'])) @foreach ($detail["installs"] as $install) @if ($j <= $install['quantity'])

{{$install['install_name']}}

@endif @endforeach @else - @endif
@if ($stop['is_custom'])

{{$order["notes"]}}

@else @foreach($order["notes"] as $note)

{{$note['note']}}

@endforeach @endif
@endif @endif @if (count($stop["service_call"]) > 0) @if (count($stop['order']) > 0)
@php $addline++; @endphp @endif @foreach($stop["service_call"] as $key => $service) @if($key == 0) {{-- rowspan value based on length of models --}} @else {{-- --}} @endif @endforeach

Stop #{{$stop["stop_no"]}}

Order# Home Visit Description
{{$service["order_no"]}}{{$service["description"]}}
{{$service["description"]}}
@endif
@php $line = fmod($index + $addline + 1, 4); @endphp @if($line == 0) {{-- @if($index != count($item["data"]) + $addline - 1) --}} {{--
--}} {{-- @endif --}} @endif @endforeach @if($page != $total - 1)
@endif @endforeach