ADMIN MANAGEMENT
@php $adminAvatar = $adminAvatar ?? asset('images/bzmtch_logo.png'); $adminFullName = $adminFullName ?? $adminUsername ?? 'Admin'; @endphp
@if($errors->any())
    @foreach($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif @if(session('error'))
{{ session('error') }}
@endif

Stock Out

| > @if(isset($selectedBatch) && $selectedBatch) List of Stock Out by Batch >

Batch {{ $selectedBatch->encode_number ?: '#' . $selectedBatch->id }}@if($selectedBatch->consignee || $selectedBatch->reference) — {{ strtoupper($selectedBatch->consignee ?? $selectedBatch->reference) }}@endif

@else

List of Stock Out by Batch

@endif
@php $batches = $batches ?? collect(); $selectedBatch = $selectedBatch ?? null; @endphp @if(!$selectedBatch)
@if($batches->isEmpty())

No batches yet. Click "ADD" to create your first stock out batch.

@else
@csrf
@foreach($batches as $b) @php $dateEnc = $b->date_enc ?? $b->date_out; $outDate = $b->date_out; @endphp @endforeach
DATE ENC OUT DATE SOURCE ENCODE # DR/OR # CONSIGNEE TOTAL AMOUNT PAID STATUS PAYMENT MODE ORDERED BY RECEIVED BY
{{ $dateEnc ? $dateEnc->format('M j, Y') : '-' }} {{ $outDate ? $outDate->format('M j, Y') : '-' }} {{ $b->source ? strtoupper($b->source) : '-' }} {{ $b->encode_number ? strtoupper($b->encode_number) : '-' }} {{ $b->dr_or_number ? strtoupper($b->dr_or_number) : '-' }} {{ ($b->consignee ?? $b->reference) ? strtoupper($b->consignee ?? $b->reference) : '-' }} {{ (($b->total_amount ?? 0) > 0) ? number_format($b->total_amount, 2) : '—' }} {{ strtoupper(str_replace('_', ' ', $b->paid_status ?? 'unpaid')) }} {{ ($b->payment_mode ?? 'cash') === 'bank2bank' ? 'BANK TO BANK' : strtoupper($b->payment_mode ?? 'cash') }} {{ $b->ordered_by ? strtoupper($b->ordered_by) : '-' }} {{ $b->received_by ? strtoupper($b->received_by) : '-' }}
@endif
@else
Back
@php $stockOuts = $stockOuts ?? collect(); @endphp @if($stockOuts->isEmpty())

No products in this batch yet. Click "ADD" to add products to stock out in this batch.

@else
@csrf
@php $unitsByName = ($units ?? collect())->keyBy(fn($u) => strtoupper(trim($u->name ?? ''))); @endphp @foreach($stockOuts as $so) @php $cost = (float) ($so->product ? ($so->product->costing ?? 0) : ($so->cost ?? 0)); $totalCost = $so->quantity * $cost; $soUnitCode = $so->product ? (optional($unitsByName[strtoupper(trim($so->product->unit ?? ''))] ?? null)->code) : null; @endphp @endforeach
PRODUCT ID PRODUCT NAME UNIT QUANTITY COST TOTAL COST REASON DATE REMOVED
{{ $so->id }} {{ $so->product ? strtoupper($so->product->product_name ?? '-') : '-' }} {{ $soUnitCode ? strtoupper($soUnitCode) : '-' }} {{ $so->quantity }} {{ number_format($cost, 2) }} {{ number_format($totalCost, 2) }} {{ strtoupper($so->reason) }} {{ $so->created_at->format('M j, Y H:i') }}
@endif
@endif
@include('admin.partials.inbox')
@php $stockOutProductsJson = collect($products ?? [])->map(function($p) { $b = $p->barcode ?? ''; $bDisplay = $b !== null && $b !== '' ? (strlen($b) < 5 ? str_pad($b, 5, '0', STR_PAD_LEFT) : $b) : ''; return [ 'id' => $p->id, 'product_name' => $p->product_name ?? '', 'barcode' => $bDisplay, 'costing' => number_format((float)($p->costing ?? 0), 2, '.', ''), 'stock_quantity' => (int) ($p->stock_quantity ?? 0), ]; })->values()->all(); @endphp