Kembali

Pembelian

{{ $isReceived ? 'Received' : ($isCancelled ? 'Cancelled' : 'Draft') }}
@if (! $isLocked) @canany(['inventory.purchases.create', 'inventory.purchases.edit', 'inventory.purchases.manage', 'inventory.manage']) @if (($purchaseId ? $canEdit : $canCreate)) @endif @endcanany @canany(['inventory.purchases.receive', 'inventory.purchases.manage', 'inventory.manage']) @if ($canReceive) @endif @endcanany @canany(['inventory.purchases.cancel', 'inventory.purchases.manage', 'inventory.manage']) @if ($purchaseId && $canCancel) @endif @endcanany @endif

Penerimaan

Saat diterima, stok bertambah dan harga pokok bahan diperbarui.

Metode Cost

Harga pokok bahan mengikuti rata-rata tertimbang (moving average).

Catatan

Jika ada stok minus sebelum penerimaan, sistem memberi peringatan karena costing bisa bias.

@php $estTotal = 0.0; foreach ($items as $row) { $qty = (float) (\App\Support\Number\QuantityParser::parse($row['input_quantity'] ?? null) ?? 0); $unitCost = $row['input_unit_cost'] === null || $row['input_unit_cost'] === '' ? null : (float) $row['input_unit_cost']; if ($unitCost !== null && $qty > 0) { $estTotal += $qty * $unitCost; } } $itemsCount = count($items); @endphp
Total item: {{ number_format($itemsCount, 0, ',', '.') }}
Estimasi total: Rp{{ number_format($estTotal, 0, ',', '.') }}
@forelse ($items as $i => $row) @php $ingredientId = (int) ($row['ingredient_id'] ?? 0); $units = []; $baseUnit = '-'; $unitFactors = []; foreach ($ingredients as $ingredient) { if ((int) $ingredient['id'] === $ingredientId) { $units = (array) ($ingredient['units'] ?? []); $baseUnit = (string) ($ingredient['base_unit'] ?? '-'); $unitFactors = (array) ($ingredient['unit_factors'] ?? []); break; } } $inputQty = (float) (\App\Support\Number\QuantityParser::parse($row['input_quantity'] ?? null) ?? 0); $inputUnit = (string) ($row['input_unit'] ?? ''); $inputUnitCost = $row['input_unit_cost'] === null || $row['input_unit_cost'] === '' ? null : (float) $row['input_unit_cost']; $factor = (float) ($unitFactors[$inputUnit] ?? 0); $baseQty = $factor > 0 ? $inputQty * $factor : null; $baseUnitCost = $inputUnitCost !== null && $factor > 0 ? $inputUnitCost / $factor : null; $subtotal = $inputUnitCost === null ? 0 : $inputQty * $inputUnitCost; @endphp

Item {{ number_format($i + 1, 0, ',', '.') }}

@if (! $isLocked) @endif
@if ($baseQty !== null && $baseUnit !== '-' && $factor > 0)
Masuk stok: {{ \App\Support\Number\QuantityFormatter::format($baseQty) }} {{ $baseUnit }}
@endif
@if ($baseUnitCost !== null && $baseUnit !== '-' && $factor > 0)

≈ Rp{{ number_format($baseUnitCost, 0, ',', '.') }}/{{ $baseUnit }}

@endif

Subtotal

{{ $subtotal > 0 ? 'Rp'.number_format($subtotal, 0, ',', '.') : '-' }}

@empty

Belum ada item pembelian. Klik “Tambah Item”.

@endforelse
@if (!$isLocked) @canany(['inventory.purchases.create', 'inventory.purchases.edit', 'inventory.purchases.manage', 'inventory.manage']) @if (($purchaseId ? $canEdit : $canCreate)) @endif @endcanany @endif @if ($receiveConfirmOpen && ! $isLocked) @endif @if ($cancelConfirmOpen && ! $isLocked) @endif