MIF_E31230680/resources/views/perhitungan/pdf.blade.php

235 lines
8.6 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Laporan Perhitungan F-AHP Kriteria Global</title>
<style>
/* 1. PENGATURAN DASAR & FONT */
body {
font-family: "Times New Roman", Times, serif;
font-size: 10pt;
color: #000;
line-height: 1.4;
margin: 0; padding: 0;
}
h2, h3, h4 { text-align: center; margin: 2px 0; text-transform: uppercase; }
.header { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 20px; }
/* 2. PENGATURAN TABEL */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
table-layout: fixed;
word-wrap: break-word;
}
th, td {
border: 1px solid #000;
padding: 5px;
text-align: center;
vertical-align: middle;
}
thead { display: table-header-group; }
tr { page-break-inside: avoid !important; }
/* 3. STYLING KHUSUS JUDUL SEKSI */
th.section-title {
background-color: #e9e9e9 !important;
text-align: left;
font-size: 10.5pt;
padding: 8px;
border-bottom: 2px solid #000;
}
th.col-header { background-color: #f5f5f5 !important; font-weight: bold; }
/* 4. HELPER */
.text-left { text-align: left; padding-left: 8px; }
.text-right { text-align: right; padding-right: 8px; }
.font-bold { font-weight: bold; }
.keep-together { page-break-inside: avoid !important; }
.bg-valid { background-color: #d4edda !important; }
</style>
</head>
<body>
<div class="header">
<h2>LAPORAN HASIL PERHITUNGAN SISTEM PENDUKUNG KEPUTUSAN</h2>
<h3>METODE FUZZY ANALYTICAL HIERARCHY PROCESS (F-AHP)</h3>
<h4>Pembobotan Kriteria Utama (Global)</h4>
</div>
{{-- TAHAP 1: MATRIKS KONSENSUS --}}
<table>
<thead>
<tr>
<th colspan="{{ count($kodes) + 1 }}" class="section-title">Tahap 1: Matriks Konsensus Multi-Pakar (Geometric Mean)</th>
</tr>
<tr>
<th class="col-header" style="width: 60px;">Kode</th>
@foreach ($kodes as $k)
<th class="col-header">{{ $k }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($kodes as $i)
<tr>
<th class="col-header">{{ $i }}</th>
@foreach ($kodes as $j)
@php
$val = $crispMatrix[$i][$j];
$cetak = ($val == 1) ? "1" : (($val < 1 && $val > 0) ? "1/" . round(1/$val) : number_format($val, 2));
@endphp
<td>{{ $cetak }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
{{-- TAHAP VALIDASI: CR (PENTING UNTUK SIDANG) --}}
<div class="keep-together">
<table>
<thead>
<tr>
<th colspan="3" class="section-title">Tahap Validasi: Uji Konsistensi (AHP Klasik)</th>
</tr>
<tr>
<th class="col-header" style="width: 20%;">Kriteria</th>
<th class="col-header" style="width: 40%;">Total Kolom Matriks</th>
<th class="col-header" style="width: 40%;">Nilai Eigen (Priority Vector)</th>
</tr>
</thead>
<tbody>
@foreach ($kodes as $k)
<tr>
<td class="font-bold">{{ $k }}</td>
<td>{{ number_format($colSums[$k], 4) }}</td>
<td class="font-bold">{{ number_format($priorityVector[$k], 4) }}</td>
</tr>
@endforeach
<tr class="bg-valid">
<td colspan="2" class="text-right font-bold">Consistency Ratio (CR)</td>
<td class="font-bold">{{ number_format($cr * 100, 2) }}% (VALID)</td>
</tr>
</tbody>
</table>
</div>
{{-- TAHAP 2: MATRIKS FUZZY --}}
<table>
<thead>
<tr>
<th colspan="{{ count($kodes) + 1 }}" class="section-title">Tahap 2: Matriks Perbandingan Berpasangan Fuzzy (TFN)</th>
</tr>
<tr>
<th class="col-header" style="width: 60px;">Kode</th>
@foreach ($kodes as $k)
<th class="col-header">{{ $k }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($kodes as $i)
<tr>
<th class="col-header">{{ $i }}</th>
@foreach ($kodes as $j)
@php $v = $matrix[$i][$j]; @endphp
<td>({{ number_format($v[0],3) }}, {{ number_format($v[1],3) }}, {{ number_format($v[2],3) }})</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
{{-- TAHAP 3: NILAI SINTESIS --}}
<div class="keep-together">
<table>
<thead>
<tr>
<th colspan="2" class="section-title">Tahap 3: Nilai Sintesis Fuzzy (S<sub>i</sub>)</th>
</tr>
<tr>
<th class="col-header" style="width: 40%;">Kriteria</th>
<th class="col-header" style="width: 60%;">Vektor S<sub>i</sub> (l, m, u)</th>
</tr>
</thead>
<tbody>
@foreach ($si as $kode => $v)
<tr>
<td class="text-left font-bold">{{ $kode }} - {{ $kriterias->where('kode', $kode)->first()->nama }}</td>
<td>({{ number_format($v[0],4) }}, {{ number_format($v[1],4) }}, {{ number_format($v[2],4) }})</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{-- TAHAP 4: V MATRIX --}}
<table>
<thead>
<tr>
<th colspan="{{ count($kodes) + 1 }}" class="section-title">Tahap 4: Derajat Kemungkinan (V Matrix)</th>
</tr>
<tr>
<th class="col-header" style="width: 80px;">V(S<sub>i</sub> &ge; S<sub>k</sub>)</th>
@foreach ($kodes as $k)
<th class="col-header">{{ $k }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($vMatrix as $i => $rows)
<tr>
<th class="col-header">{{ $i }}</th>
@foreach ($rows as $val)
<td>{{ number_format($val, 3) }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
{{-- HASIL AKHIR --}}
<div class="keep-together">
<table>
<thead>
<tr>
<th colspan="4" class="section-title">Tahap Akhir: Bobot Normalisasi (W) & Skala 1000</th>
</tr>
<tr>
<th class="col-header" style="width: 40%;">Kriteria Utama</th>
<th class="col-header" style="width: 20%;">Min Degree (d')</th>
<th class="col-header" style="width: 20%;">Bobot Normalisasi (W)</th>
<th class="col-header" style="width: 20%;">Bobot Skala 1000</th>
</tr>
</thead>
<tbody>
@php $sumDPrime = array_sum($dPrime); @endphp
@foreach ($dPrime as $kode => $minV)
@php
$w = ($sumDPrime > 0) ? ($minV / $sumDPrime) : 0;
$namaKriteria = $kriterias->where('kode', $kode)->first()->nama ?? '-';
@endphp
<tr>
<td class="text-left font-bold">{{ $kode }} - {{ $namaKriteria }}</td>
<td>{{ number_format($minV, 4) }}</td>
<td>{{ number_format($w, 4) }}</td>
<td class="font-bold">{{ $bobot1000[$kode] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th class="text-right col-header">TOTAL</th>
<th class="col-header">{{ number_format($sumDPrime, 4) }}</th>
<th class="col-header">1.0000</th>
<th class="col-header">{{ array_sum($bobot1000) }}</th>
</tr>
</tfoot>
</table>
</div>
</body>
</html>