{{ Auth::user()->company_profile->name }}

{{ Auth::user()->company_profile->address }}

ItemWise Packing Print

@if($export_type == 'pdf')
From Date: {{ $from_date }}     To Date: {{ $to_date }}     Staff Name:{{ $staffname }}             Route:{{ $route }}
@else
From Date: {{ $from_date }}     To Date: {{ $to_date }}     Staff Name:{{ $staffname }}             Route:{{ $route }}
@endif @foreach($units as $unit) @endforeach @foreach ($orderItems as $orderItem) @php $totalBaseQty = $orderItem->total_qty; $total_qty = $orderItem->total_qty; $itemUnits = collect(); $stockItem = $orderItem->stockItem; $itemUnitIds = $stockItem->itemUnits->pluck('unit_id')->toArray(); $stockItemUnits = $stockItem->stockItemUnits()->orderBy('unit_qty', 'desc')->get(); foreach ($stockItemUnits as $itemUnit) { $unit_qty = $itemUnit->unit_qty; if ($unit_qty == 0) { continue; } $remaining_qty = $total_qty % $unit_qty; $whole_qty = ($total_qty - $remaining_qty) / $unit_qty; if ($whole_qty > 0) { $itemUnits->push([ 'unit_id' => $itemUnit->unit_id, 'base_qty' => $whole_qty, ]); $total_qty = $total_qty - $whole_qty * $unit_qty; } } $baseUnitId = $stockItem->baseStockItemUnit->unit_id; $itemUnits->push([ 'unit_id' => $baseUnitId, 'base_qty' => $total_qty, ]); @endphp @foreach ($units as $unit) @if (in_array($unit->id, $itemUnitIds)) {{-- @php $unitQty = App\Models\StockItemUnits::where('stock_item_id', $item->stock_item_id) ->where('unit_id', $unit->id) ->first(); @endphp --}} @else @endif @endforeach @endforeach
Sl Pr Code Item Name Mrp{{ $unit->name }}Total Base Qty Total
{{ $loop->iteration }} {{ $orderItem->stockItem->item_code }} {{ $orderItem->stockItem->name }} {{ $orderItem->stockItem->mrp }} {{ $itemUnits->where('unit_id', $unit->id)->first() != null ? $itemUnits->where('unit_id', $unit->id)->first()['base_qty'] : '' }} {{ $totalBaseQty }} {{ number_format($orderItem->totalAmount, 2) }}