@extends('index') @section('content')
{{-- --}} {{-- --}}
Stock No: {{ $packingList->stock_no }}
Order No: {{ $packingList->order_no }}
Job No: {{ $packingList->job_no }}
{{-- --}} {{-- --}}
Customer: {{ $packingList->fname }} {{ $packingList->lname }}
Customer No: {{ $packingList->customer_no }}
Created: {{ \Carbon\Carbon::parse($packingList->created_at)->format('d M Y, h:i A') }}
@if($packingList->pallet_qty || $packingList->pallet_weight || $packingList->pallet_dimension)
Pallet Information
@if($packingList->pallet_qty)

Pallet Quantity: {{ $packingList->pallet_qty }}

@endif @if($packingList->pallet_weight)

Weight per Pallet: {{ $packingList->pallet_weight }} kg

@endif @if($packingList->pallet_dimension)

Pallet Dimension: {{ $packingList->pallet_dimension }}

@endif
@endif
Carton Groups
@foreach($cartons as $index => $carton)
@if($carton->carton_from == $carton->carton_to) Carton #{{ $carton->carton_from }} @else Cartons #{{ $carton->carton_from }} - #{{ $carton->carton_to }} @endif {{ $carton->carton_to - $carton->carton_from + 1 }} carton(s)
@if($carton->box_dimension || $carton->box_weight)
@if($carton->box_dimension)

Box Dimension: {{ $carton->box_dimension }}

@endif @if($carton->box_weight)

Weight per Box: {{ $carton->box_weight }} kg

@endif

@endif @foreach($carton->items as $itemIndex => $item) @endforeach
Sr. Article No Product Name Pcs Each Carton Total Pcs
{{ $itemIndex + 1 }} {{ $item->article_no }} {{ $item->name }} {{ $item->pcs_each_carton }} {{ $item->pcs_each_carton * ($carton->carton_to - $carton->carton_from + 1) }}
Group Total: {{ $carton->items->sum(function($item) use ($carton) { return $item->pcs_each_carton * ($carton->carton_to - $carton->carton_from + 1); }) }}
@endforeach @if($cartons->count() == 0)
No carton groups found.
@endif
@if($cartons->count() > 0)
Summary

Total Carton Groups: {{ $cartons->count() }}

Total Cartons: {{ $cartons->sum(function($c) { return $c->carton_to - $c->carton_from + 1; }) }}

Grand Total Pieces

{{ $cartons->sum(fn($c) => $c->items->sum(fn($item) => $item->pcs_each_carton * ($c->carton_to - $c->carton_from + 1))) }}

@endif
@endsection