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

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

ItemWise Packing Print

From Date: {{ $from_date }}     To Date: {{ $to_date }}     Staff Name:{{ $sale_executive_names }}             Route:{{ $routes_names }}
Packing Staff Name:{{ $packing_person_names }}             Sub Routes:{{ $sub_routes_names }}             Delivery Staff Name:{{ $delivery_staff_names }}
{{-- --}} {{-- --}} @foreach ($units as $unit) @endforeach @php $oldGroupId = null; $totalColumn = count($units) + 4; @endphp @foreach ($orderItems as $item) @if ($oldGroupId != $item->stock_group_id) @php $group = App\Models\StockGroup::find($item->stock_group_id); $oldGroupId = $item->stock_group_id; @endphp @endif @php $stockItem = App\Models\StockItem::find($item->stock_item_id); @endphp @php $totalBaseQty = $item->total_qty; $total_qty = $item->total_qty; $itemUnits = collect(); @endphp @php $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
s.no Product NameGroupQty Unit Taxable Value AmountBatch{{ $unit->name }}Total Base Qty
{{ $group->name }}
{{ $loop->iteration }} {{ $stockItem->name }} MRP: {{ $stockItem->mrp }} @if ($item->batch_id != null) @php $batch = App\Models\Batch::find($item->batch_id); $lastInward = App\Models\StockLedger::where([ 'business_key' => Auth::user()->business_key, 'stock_item_id' => $item->stock_item_id, 'batch_id' => $batch->id, ]) ->where(function ($query) { $query ->where('batch_price', '!=', null) ->orWhere('batch_mrp', '!=', null) ->orWhere('batch_discount', '!=', null); }) ->orderBy('date', 'desc') ->first(); @endphp @if ($lastInward) {{ $batch->name }} Mrp: {{ $lastInward->batch_mrp }} @endif @endif {{ $itemUnits->where('unit_id', $unit->id)->first() != null ? $itemUnits->where('unit_id', $unit->id)->first()['base_qty'] : '' }} {{ $totalBaseQty }}
Total {{ $orderItems->sum('total_qty') }}