{{-- ===== HEADER ===== --}} {{-- BARIS LOGO + NAMA PT --}} {{-- LOGO --}} {{-- TEXT PT --}} {{-- SPACER --}} {{-- JUDUL REPORT --}} {{-- JUDUL REPORT --}} {{-- SPASI LOGO --}} {{-- SUBTITLE --}} {{-- SPASI LOGO --}} {{-- SPACER --}}
PT MULTI SPUNINDO JAYA Tbk
Nonwovens Manufacturer
REPORT ANALISA NCR
{{ strtoupper($auditType ?? '') }} AUDIT | Thn {{ $lastYear ?? '' }} vs {{ $year ?? '' }}
{{-- ===== TABEL TEMUAN TAHUN LALU ===== --}}
Temuan Thn {{ $lastYear }}
@foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach @php $deptMapL = collect($deptLastYear)->keyBy('department'); @endphp @foreach($departments as $no => $dept) @php $row = $deptMapL->get($dept->name); $tot = (int)(optional($row)->total ?? 0); @endphp @foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach @endforeach @foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach
No Departemen{{ $cat->name }}Jml{{ $iso->code }}Jml
{{ $no+1 }} {{ $dept->name }}{{ (int)(optional($row)->{'cat_'.$cat->idcategories} ?? 0) ?: '-' }}{{ $tot ?: '-' }}{{ (int)(optional($row)->{'iso_'.$iso->idstandards} ?? 0) ?: '-' }}{{ $tot ?: '-' }}
Total{{ $totalLastYear['cat_'.$cat->idcategories] ?? 0 }}{{ $totalLastYear['total'] ?? 0 }}{{ $totalLastYear['iso_'.$iso->idstandards] ?? 0 }}{{ $totalLastYear['total'] ?? 0 }}

{{-- ===== TABEL TEMUAN TAHUN INI ===== --}}
Temuan Thn {{ $year }}
@foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach @php $deptMapC = collect($deptCurrentYear)->keyBy('department'); @endphp @foreach($departments as $no => $dept) @php $row = $deptMapC->get($dept->name); $tot = (int)(optional($row)->total ?? 0); @endphp @foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach @endforeach @foreach($categoryList->sortBy('severity_level') as $cat) @endforeach @foreach($isoList as $iso) @endforeach
No Departemen{{ $cat->name }}Jml{{ $iso->code }}Jml
{{ $no+1 }} {{ $dept->name }}{{ (int)(optional($row)->{'cat_'.$cat->idcategories} ?? 0) ?: '-' }}{{ $tot ?: '-' }}{{ (int)(optional($row)->{'iso_'.$iso->idstandards} ?? 0) ?: '-' }}{{ $tot ?: '-' }}
Total{{ $totalCurrentYear['cat_'.$cat->idcategories] ?? 0 }}{{ $totalCurrentYear['total'] ?? 0 }}{{ $totalCurrentYear['iso_'.$iso->idstandards] ?? 0 }}{{ $totalCurrentYear['total'] ?? 0 }}

{{-- ===== SEBARAN KLAUSUL ===== --}} @foreach(['L' => $lastYear, 'C' => $year] as $mode => $thn) @php $isLast = $mode === 'L'; $clauseByDept = $isLast ? ($clauseByDeptLastYear ?? collect()) : ($clauseByDeptCurrentYear ?? collect()); $klPdca = $isLast ? ($klPdcaL ?? []) : ($klPdcaC ?? []); @endphp
Temuan Thn {{ $thn }} — Sebaran Klausul
@php $getCl = function($map, $deptName, $prefix) { $total = 0; foreach ($map->get($deptName, collect()) as $cn => $row) { if ((int)explode('.', (string)$cn)[0] === (int)$prefix) $total += (int)($row->total ?? 0); } return $total; }; @endphp @foreach($departments as $no => $dept) @php $rv = []; $rt = 0; foreach([4,5,6,7,8,9,10] as $p) { $v = $getCl($clauseByDept, $dept->name, $p); $rv[$p] = $v; $rt += $v; } @endphp @foreach([4,5,6,7,8,9,10] as $p) @endforeach @endforeach @foreach([4,5,6,7,8,9,10] as $p) @endforeach
No Departemen Plan Do Check Action Total
Kl 4 Kl 5 Kl 6 Kl 7 Kl 8 Kl 9 Kl 10
{{ $no+1 }} {{ $dept->name }}{{ $rv[$p] ?: '-' }}{{ $rt ?: '-' }}
Total{{ $klPdca[$p] ?? 0 ?: '-' }}{{ array_sum($klPdca) ?: '-' }}

@endforeach {{-- ===== CHART ===== --}} @if(!empty($chartKategoriPath))
Grafik Perbandingan — Kategori
Chart Kategori
Kategori Temuan per Departemen — {{ $lastYear }} vs {{ $year }}
@endif @if(!empty($chartIsoPath))
Grafik Perbandingan — Standar ISO
Chart ISO
Temuan per Standar ISO — {{ $lastYear }} vs {{ $year }}
@endif @if(!empty($chartKlausulPath))
Grafik Perbandingan — Klausul
Chart Klausul
Perbandingan Temuan per Klausul — {{ $lastYear }} vs {{ $year }}
@endif {{-- ===== KESIMPULAN ===== --}} @if(!empty($kesimpulan)) @foreach(explode("\n", $kesimpulan) as $line) @if(trim($line)) @endif @endforeach
Kesimpulan
{{ trim($line) }}

@endif {{-- ===== TANDA TANGAN ===== --}} @php $signatureFile = null; if (!empty($approver_signature)) { $signatureFile = public_path( 'storage/' . $approver_signature ); } $hasSign = $signatureFile && file_exists($signatureFile); @endphp {{-- KIRI --}} {{-- TTD --}}
Pelaksanaan : tgl {{ $audit_date_range ?? '-' }} {{-- TEXT --}} {{-- TTD --}} {{-- NAMA --}}
Disetujui oleh,
@if($hasSign) @endif
{{ $approved_by ?? '' }}
Penyelesaian : tgl {{ !empty($completion_date) ? \Carbon\Carbon::parse($completion_date)->translatedFormat('d F Y') : '-' }}
{{-- ===== FOOTER ===== --}}
A00.LSA.017.2.3