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 In

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

Batch {{ $selectedBatch->encode_number ?: '#' . $selectedBatch->id }}

@else

List of Stock In 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 in batch.

@else
@csrf
@foreach($batches as $b) @endforeach
DATE ENC DR DATE SOURCE ENCODE # DR/OR # SUPPLIER PAYMENT MODE PAID STATUS TOTAL AMOUNT ORDERED BY RECEIVED BY
{{ $b->date_enc->format('M j, Y') }} {{ ($b->dr_date ?? $b->date_enc)->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) : '-' }} {{ strtoupper($b->supplier) }} {{ $b->payment_mode === 'bank2bank' ? 'BANK TO BANK' : strtoupper($b->payment_mode) }} {{ strtoupper(str_replace('_', ' ', $b->paid_status)) }} {{ ($b->total_amount ?? 0) > 0 ? number_format($b->total_amount, 2) : '—' }} {{ $b->ordered_by ? strtoupper($b->ordered_by) : '-' }} {{ $b->received_by ? strtoupper($b->received_by) : '-' }}
@endif
@else
Back
@php $stockIns = $stockIns ?? collect(); @endphp @if($stockIns->isEmpty())

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

@else
@csrf
@php $unitsByName = ($units ?? collect())->keyBy(fn($u) => strtoupper(trim($u->name ?? ''))); @endphp @foreach($stockIns as $si) @php $p = $si->product; $cost = (float) ($p ? ($p->costing ?? 0) : ($si->cost ?? 0)); $totalCost = $si->quantity * $cost; $barcode = $p ? ($p->barcode ?? '') : ''; $barcodeDisplay = $barcode !== null && $barcode !== '' ? (strlen($barcode) < 5 ? str_pad($barcode, 5, '0', STR_PAD_LEFT) : $barcode) : '-'; $retail = $p ? (float)($p->retail ?? 0) : 0; $wholesale = $p ? (float)($p->wholesale ?? 0) : 0; $promoPrice = $p ? (float)($p->promo_price ?? 0) : 0; $promoFlag = $p && ($p->promo ?? false); $pUnitCode = $p ? (optional($unitsByName[strtoupper(trim($p->unit ?? ''))] ?? null)->code) : null; @endphp @endforeach
PRODUCT ID PRODUCT NAME BARCODE UNIT QUANTITY COST PRICE RETAIL WHOLESALE PROMO TOTAL COST DATE ADDED
{{ $si->id }} {{ $si->product ? strtoupper($si->product->product_name ?? '-') : '-' }} {{ $barcodeDisplay }} {{ $pUnitCode ? strtoupper($pUnitCode) : '-' }} {{ $si->quantity }} {{ number_format($cost, 2) }} ₱{{ number_format($retail, 2) }} ₱{{ number_format($retail, 2) }} ₱{{ number_format($wholesale, 2) }} ₱{{ number_format($promoPrice, 2) }} {{ number_format($totalCost, 2) }} {{ $si->created_at->format('M j, Y H:i') }}
@endif
@endif
@include('admin.partials.inbox')
@php $stockInProductsJson = 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, '.', ''), 'unit' => strtoupper($p->unit ?? ''), 'retail' => number_format((float)($p->retail ?? 0), 2), 'wholesale' => number_format((float)($p->wholesale ?? 0), 2), 'promo_price' => number_format((float)($p->promo_price ?? 0), 2), 'promo' => $p->promo ? '1' : '0', ]; })->values()->all(); @endphp