@extends('layouts/base_view') @section('title') {!! $variables['header_routes'] !!} @endsection @section('content')

Stock Opname

@csrf
User : {{ $logged_name }} ( {{ $logged_role_name }}) Status : @if(isset($data->id) && $data->status) {{ $data->status }} @else - @endif Notes :
Store : @if(session('store_selected')) {{ $store_name }} @else No Store Selected @endif LSM Date : @php $hariIndo = ['Sunday'=>'Minggu','Monday'=>'Senin','Tuesday'=>'Selasa','Wednesday'=>'Rabu','Thursday'=>'Kamis','Friday'=>'Jumat','Saturday'=>'Sabtu']; $soDate = $data->so_date ?? now(); $namaHari = $hariIndo[$soDate->format('l')] ?? $soDate->format('l'); @endphp {{ $namaHari }}, {{ $soDate->format('d M Y') }}

Informasi

Panduan Usulan SPB
Tipe Item Konfigurasi DC Formula Qty Kondisi Usulan Muncul Catatan
Rumus Normal = Ya
normal_rumus = true
DO HARIAN
Shipment DC, Tipe: Harian
(Fc H+1 + Fc H+2 + TSM H+2) - LSM - Open SPB H+1 bukan libur (sesuai konfigurasi DC) & H+2 jatuh di delivery day.
Usulan 2: H+2 libur. Usulan 3: H+3 libur.
Pakai TSM. Forecast 2 hari. Libur sesuai konfigurasi DC (jika ada flag Holiday di kolom Hari Libur SPB, Libur Nasional ikut dicek).
DO PERIODIK
Shipment DC, Tipe: Periodik
Total Fc (Coverage) - LSM - Open SPB H+1 bukan libur (sesuai konfigurasi DC) & H+2 jatuh di delivery day.
Usulan 2: H+2 libur. Usulan 3: H+3 libur.
TIDAK pakai TSM. Forecast coverage H+3 s/d shipment berikutnya (INCLUSIVE). Libur sesuai konfigurasi DC (jika ada flag Holiday di kolom Hari Libur SPB, Libur Nasional ikut dicek).
PR SAYURAN
Shipment Suppliers
(Fc H+1 + Fc H+2 + TSM H+2) - LSM - Open SPB H+1 bukan libur & H+2 jatuh di shift day.
Usulan 2: H+2 libur. Usulan 3: H+3 libur.
Pakai TSM. Cek libur di H+1 (hari SPB). Libur sesuai konfigurasi DC (jika ada flag Holiday di kolom Hari Libur SPB, Libur Nasional ikut dicek). Jika H+1 libur → tidak ada usulan.
PR PERIODIK
Shipment Suppliers
Total Fc (Coverage) - LSM - Open SPB H+1 bukan libur & H+2 jatuh di shift day.
Usulan 2: H+2 libur. Usulan 3: H+3 libur.
TIDAK pakai TSM. Forecast coverage. Cek libur di H+1. Libur sesuai konfigurasi DC (jika ada flag Holiday di kolom Hari Libur SPB, Libur Nasional ikut dicek). Jika H+1 libur → tidak ada usulan.
Rumus Normal = Tidak (normal_rumus = false) → Sistem cek rule berdasarkan hari SO hari ini.
Tidak ada rule untuk hari ini → tidak ada usulan.  |  Cek SPB = PPIC Libur → tidak ada usulan.  |  Cek SPB > 0tetap cek H+1 dulu: jika H+1 masuk di Hari Libur SPB → tidak ada usulan. Jika H+1 bukan libur → Usulan 1 muncul. Usulan 2 muncul jika H+2 libur, Usulan 3 jika H+3 libur. Qty tiap usulan dibaca dari rule hari SO usulan tersebut (Usulan 1 = rule hari SO hari ini, Usulan 2 = rule hari SO+1, Usulan 3 = rule hari SO+2). Hari libur tetap mengacu ke kolom Hari Libur SPB di konfigurasi DC.
Tidak ada konfigurasi SPB Holiday di Master DCUsulan SPB tidak akan muncul sama sekali. Wajib isi konfigurasi di Master DC → Rumus & SPB Holiday Configuration.
Tidak ada data jadwal shipmentUsulan SPB tidak muncul meskipun konfigurasi sudah ada. DO cek Shipment Deliveries, PR cek Shipment Suppliers.
Konversi & Pembulatan: Hasil dalam UOM PakaiUOM Kirim via Pakai → Utuh → Kirim. Smart Rounding: sisa ≥ % SPB ROP → bulatkan ke atas. Order Constraints: minimal order & multiple order diterapkan setelah konversi.
@if($data->id > 0) @endif
Suggested 0 items
Adjusted 0 items
Confirmed 0 items
Slot SPB 0 usulan
@foreach($variables['raw_materials'] as $index => $rm) @php $existingDetail = null; if(isset($data->details)) { $existingDetail = $data->details->where('raw_material_id', $rm->id)->first(); } // Get conversion data $hasConversion = $rm->conversion_factor_utuh_pakai && $rm->conversion_factor_utuh_pakai > 0; $conversionFactor = $hasConversion ? $rm->conversion_factor_utuh_pakai : 1; $uomUtuh = $rm->uom_utuh ?? $rm->uom; $uomPakai = $rm->uom_pakai ?? $rm->uom; // Get store raw material mapping for SPB suggestions $mapping = $variables['mappings']->get($rm->id); $hasMapping = $mapping && $mapping->is_active; $showSPB = $hasMapping && ($mapping->spb_flag ?? false); @endphp {{-- Adjustment Modal for this item --}} @if($hasAnyAdjustment) @endif {{-- FSTR Sub-lines: Display FSTR components (WIP items) for this RM --}} @php // Get all FSTR components (WIP items) that belong to this RM // Example: DRY0048 (parent) has WIP0029, WIP0030, WIP0031 (components) // Filter only components with input_lsm_flag = true to show in LSM input $fstrComponents = $rm->components() ->where('delete_flag', 0) ->where('input_lsm_flag', true) ->with('component') ->get() ->filter(function($comp) { return $comp->component !== null; // Remove components with null component }); @endphp @foreach($fstrComponents as $fstrComponent) @php $fstr = $fstrComponent->component; // Changed from parent to component // Skip if component is null (filtered out) if (!$fstr) continue; $componentQtyPerUnit = $fstrComponent->qty; // Check if this FSTR is also a FSTR (has components) $isFSTR = $fstr->components()->where('delete_flag', 0)->exists(); // Get existing FSTR qty_pakai from SO detail if exists $existingFstrQty = 0; if ($existingDetail && $existingDetail->fstr_qty_pakai) { $fstrQtyData = is_string($existingDetail->fstr_qty_pakai) ? json_decode($existingDetail->fstr_qty_pakai, true) : $existingDetail->fstr_qty_pakai; $existingFstrQty = $fstrQtyData[$fstr->id] ?? 0; } @endphp @endforeach @endforeach {{-- SUB Sub-lines: item substitusi yang dimiliki RM ini --}} @foreach($rm->substitutions->where('delete_flag', false) as $subRelation) @php $subItem = $subRelation->substitution; if (!$subItem) continue; $existingSubQty = 0; if ($existingDetail && $existingDetail->fstr_qty_pakai) { $fstrQtyData = is_string($existingDetail->fstr_qty_pakai) ? json_decode($existingDetail->fstr_qty_pakai, true) : $existingDetail->fstr_qty_pakai; $existingSubQty = $fstrQtyData['sub_' . $subItem->id] ?? 0; } @endphp @endforeach
No Item Previous Stock Sisa Utuh Sisa Pakai Adj LSM Aktual Status Stok SPB 1 - SPB 2 - SPB 3 - X
Final Qty Saran Qty Final Qty Saran Qty Final Qty Saran Qty
{{ $index + 1 }} @if(!$hasConversion)
@endif
{{ $rm->code }} | {{ $rm->name }}
UOM: {{ $uomPakai }} @if($hasConversion) (1 {{ $uomUtuh }} = {{ number_format($conversionFactor, 2, '.', '') }} {{ $uomPakai }}) @endif @if($hasMapping && $mapping->period) | {{ $mapping->tipe_dokumen.' '. $mapping->period->code }} @endif @if(!$hasConversion)
Tidak ada mapping @endif
-
@if($showSPB)
SPB : 0.00
@endif
@php $mapping = $variables['mappings']->get($rm->id); $hasRestan = $rm->adj_restan_flag; $hasExtras = $rm->adj_extras_flag; $hasRingkas = $rm->adj_ringkas_flag; $hasSelisih = $rm->adj_selisih_flag; $hasAnyAdjustment = $hasRestan || $hasExtras || $hasRingkas || $hasSelisih; // Calculate total adjustment $totalAdj = 0; if ($existingDetail) { $totalAdj = ($existingDetail->adj_ekstra ?? 0) + ($existingDetail->adj_restan ?? 0) + ($existingDetail->adj_ringkas ?? 0) + ($existingDetail->adj_selisih ?? 0); } @endphp @if($hasAnyAdjustment) @else @endif
{{ $existingDetail ? number_format($existingDetail->lsm_aktual, 2, '.', '') : '0.00' }}
@if($showSPB) - @else - @endif @if($showSPB) - @else @endif @if($showSPB) @else @endif @if($showSPB) - @else - @endif @if($showSPB) @else X @endif @if($showSPB) - @else - @endif @if($showSPB) @else @endif
FSTR: {{ $fstr->code }} - {{ $fstr->name }} - {{ $fstr->uom_pakai ?? $fstr->uom; }} {{-- FSTR qty_pakai input --}}
SUB: {{ $subItem->code }} - {{ $subItem->name }} - {{ $subItem->uom_pakai ?? $subItem->uom }}
Kembali @if(!isset($data->id) || $data->status == 'Draft') @endif
@endsection