@php use Carbon\Carbon; $namaPerush = $profile->nama_perusahaan ?? 'IDEMEDIKA'; $alamat = $profile->alamat ?? ''; $logoPath = ($profile->logo_desktop && \Storage::disk('public')->exists($profile->logo_desktop)) ? storage_path('app/public/' . $profile->logo_desktop) : null; $totalKurang = $itemsKurang->count() + $stoksBelumDiscan->count(); $ttdFoto = $ttdFoto ?? null; @endphp {{-- KOP --}}
@if($logoPath) @endif
{{ $namaPerush }}
@if($alamat)
{{ $alamat }}
@endif @if($profile->no_telp_1 ?? null)
Telp: {{ $profile->no_telp_1 }}
@endif
Laporan Stok Opname
Rekap Per Barang
{{ $so->nomor_opname }}
Selesai
{{-- META --}}
Gudang
{{ $so->gudang->nama }}
Diselesaikan
{{ $so->diselesaikan_at ? Carbon::parse($so->diselesaikan_at)->format('d-m-Y H:i') : '—' }}
Tanggal
{{ $so->tanggal_opname->format('d-m-Y') }}
Oleh
{{ $so->diselesaikanOleh?->nama ?? '—' }}
{{-- TABEL REKAP PER BARANG --}} @foreach($rekap as $i => $row) @php $selisih = $row['fisik'] - $row['sistem']; $statuses = array_unique($row['status']); if (in_array('belum_discan', $statuses) && count($statuses) === 1) { $statusLabel = 'belum_discan'; } elseif (in_array('anomali_barang', $statuses) || in_array('tidak_ada_di_sistem', $statuses)) { $statusLabel = 'anomali'; } elseif ($selisih < 0 || in_array('kurang', $statuses) || in_array('belum_discan', $statuses)) { $statusLabel = 'kurang'; } elseif ($selisih > 0 || in_array('lebih', $statuses)) { $statusLabel = 'lebih'; } else { $statusLabel = 'cocok'; } @endphp @endforeach
No Nama Barang Qty Sistem Qty Fisik Selisih Status
{{ $i + 1 }} {{ $row['nama'] }} {{ $row['sistem'] }} {{ $row['fisik'] ?: '—' }} @if($row['fisik'] > 0) {{ $selisih > 0 ? '+' : '' }}{{ $selisih }} @else — @endif @if($statusLabel === 'cocok') Cocok @elseif($statusLabel === 'kurang') Kurang @elseif($statusLabel === 'lebih') Lebih @elseif($statusLabel === 'belum_discan') Belum Discan @else Anomali @endif
{{-- CATATAN --}}
Catatan:
{{-- TTD --}}
Dibuat oleh
{{ $so->dibuatOleh?->nama ?? '—' }}
Kepala Gudang
(................................)
Pihak Rumah Sakit
@if($ttdFoto)@endif
@if($so->nama_petugas_rs)({{ $so->nama_petugas_rs }})@else(................................)@endif