LAPORAN ALOKASI ANGSURAN

SIMA - Sistem Informasi Mahasiswa

Tanggal Cetak: {{ $tanggal_cetak->format('d/m/Y H:i') }}

@if ($filter['tahun_ajaran'] ?? null) @endif @if ($filter['kampus_id'] ?? null) @endif
Dicetak Oleh : {{ auth()->user()->name ?? 'System' }} Total Mahasiswa : {{ number_format($statistik['total_mahasiswa']) }}
Tahun Ajaran : {{ $filter['tahun_ajaran'] }} Periode : {{ $bulan }}/{{ $tahun }}
Kampus : {{ \App\Models\Kampus::find($filter['kampus_id'])?->nama ?? '-' }} Prodi : {{ \App\Models\Prodi::find($filter['prodi_id'])?->nama ?? '-' }}

Ringkasan per Kampus

@php $firstKampus = $ringkasanData->first(); if ($firstKampus && isset($firstKampus['biaya_lainnya'])) { foreach ($firstKampus['biaya_lainnya'] as $biaya) { if ($biaya['nama'] != 'BT') { echo ''; } } } @endphp @php $no = 1; @endphp @foreach ($ringkasanData as $item) @foreach ($item['biaya_lainnya'] as $biaya) @if ($biaya['nama'] != 'BT') @endif @endforeach @endforeach @foreach ($totalBiayaLainnyaPerJenis as $jenis => $total) @if ($jenis != 'BT') @endif @endforeach
No Kampus Jml Mhs Total Angsuran' . $biaya['nama'] . 'Total Biaya Bagi Kampus Bagi K2
{{ $no++ }} {{ $item['kampus']->nama }} {{ number_format($item['jumlah_mahasiswa']) }} Rp {{ number_format($item['total_angsuran']['total'], 0, ',', '.') }} Rp {{ number_format($biaya['total'], 0, ',', '.') }}Rp {{ number_format($item['total_biaya'], 0, ',', '.') }} Rp {{ number_format($item['total_bagi_hasil_kampus'], 0, ',', '.') }} Rp {{ number_format($item['total_bagi_hasil_k2'], 0, ',', '.') }}
TOTAL Rp {{ number_format($totalPembayaran, 0, ',', '.') }}Rp {{ number_format($total, 0, ',', '.') }}Rp {{ number_format($totalSemuaBiaya, 0, ',', '.') }} Rp {{ number_format($totalKeseluruhanBagiKampus, 0, ',', '.') }} Rp {{ number_format($totalBagiHasilK2, 0, ',', '.') }}

Detail Mahasiswa per Tahun Ajaran

Keterangan: SPB (Sumbangan Pengembangan Bangunan) | SPP (Sumbangan Pembinaan Pendidikan) | UKT (Uang Kuliah Tunggal) | RUTIN (Biaya Rutin) | BL (Biaya Lain-lain) | SP (Semester Pendek) | CUTI = Mahasiswa cuti pada semester tersebut | Potongan = Nilai potongan yang telah diajukan | UKT2_1 = UKT Angsuran ke-2 Semester 1, SPP2_1 = SPP Angsuran ke-2 Semester 1, SPB_2 = SPB Angsuran ke-2
@php function getCodeRange($items) { if (!count($items)) { return '-'; } // Ubah items menjadi array kode biaya $codes = []; foreach ($items as $item) { $kode = $item['kode_biaya']; // Skip angsuran pertama semester 1 if ($kode === 'UKT1_1' || $kode === 'SPB_1' || $kode === 'SPP1_1') { continue; } $codes[] = $kode; } if (!count($codes)) { return '-'; } // Sorting dengan logika yang benar untuk semua jenis usort($codes, function ($a, $b) { // Extract data untuk SPB $jenisA = ''; $jenisB = ''; $nomorA = 0; $nomorB = 0; $semesterA = 0; $semesterB = 0; // Parse SPB (format: SPB_{nomor}) if (preg_match('/^SPB_(\d+)$/', $a, $matches)) { $jenisA = 'SPB'; $nomorA = (int) $matches[1]; $semesterA = 1; // SPB dianggap semester 1 } // Parse SPP (format: SPP{nomor}_{semester}) elseif (preg_match('/^SPP(\d+)_(\d+)$/', $a, $matches)) { $jenisA = 'SPP'; $nomorA = (int) $matches[1]; $semesterA = (int) $matches[2]; } // Parse UKT (format: UKT{nomor}_{semester}) elseif (preg_match('/^UKT(\d+)_(\d+)$/', $a, $matches)) { $jenisA = 'UKT'; $nomorA = (int) $matches[1]; $semesterA = (int) $matches[2]; } if (preg_match('/^SPB_(\d+)$/', $b, $matches)) { $jenisB = 'SPB'; $nomorB = (int) $matches[1]; $semesterB = 1; } elseif (preg_match('/^SPP(\d+)_(\d+)$/', $b, $matches)) { $jenisB = 'SPP'; $nomorB = (int) $matches[1]; $semesterB = (int) $matches[2]; } elseif (preg_match('/^UKT(\d+)_(\d+)$/', $b, $matches)) { $jenisB = 'UKT'; $nomorB = (int) $matches[1]; $semesterB = (int) $matches[2]; } // Urutkan berdasarkan jenis (SPB, SPP, UKT) $urutanJenis = ['SPB' => 1, 'SPP' => 2, 'UKT' => 3]; $orderA = $urutanJenis[$jenisA] ?? 99; $orderB = $urutanJenis[$jenisB] ?? 99; if ($orderA != $orderB) { return $orderA <=> $orderB; } // Untuk SPB: urut berdasarkan nomor angsuran if ($jenisA === 'SPB') { return $nomorA <=> $nomorB; } // Untuk SPP dan UKT: urut berdasarkan semester dulu, baru nomor angsuran // Urutan yang diinginkan: semester 1 angsuran 2-6 dulu, baru semester 2 angsuran 1-6, dst if ($semesterA != $semesterB) { return $semesterA <=> $semesterB; } return $nomorA <=> $nomorB; }); $first = $codes[0]; $last = $codes[count($codes) - 1]; if ($first === $last) { return $first; } return $first . ' sd ' . $last; } function getTotalPaid($items) { return collect($items)->sum('dibayar'); } function getTotalPotongan($items) { return collect($items)->sum('potongan'); } function ensureArray($data) { if (is_null($data)) { return []; } if (is_array($data)) { return $data; } if (is_string($data)) { $decoded = json_decode($data, true); if (is_array($decoded)) { return $decoded; } if (str_contains($data, ',')) { return array_map('intval', explode(',', $data)); } $cleaned = trim($data, '[]'); if (!empty($cleaned)) { return array_map('intval', explode(',', $cleaned)); } return []; } return []; } @endphp @foreach ($groupedByTahun as $tahun => $mahasiswaGroup)

Tahun Ajaran: {{ $tahun ?? 'Tidak Diketahui' }} ({{ $mahasiswaGroup->count() }} Mahasiswa)

@php $jenisLainnyaList = []; foreach ($mahasiswaGroup as $mhs) { if (!empty($mhs->grouped_angsuran)) { foreach ($mhs->grouped_angsuran as $jenis => $items) { if ( !in_array($jenis, ['SPB', 'SPP', 'UKT']) && $jenis != 'BT' && count($items) && !in_array($jenis, $jenisLainnyaList) ) { $jenisLainnyaList[] = $jenis; } } } } sort($jenisLainnyaList); $hasGroupCuti = false; foreach ($mahasiswaGroup as $mhs) { $cutiSemesters = ensureArray($mhs->cuti_semester ?? []); if (!empty($cutiSemesters)) { $hasGroupCuti = true; break; } } @endphp
@if ($hasGroupCuti) @else @endif @if ($hasSpb) @endif @if ($hasSpp) @endif @if ($hasUkt) @endif @foreach ($jenisLainnyaList as $jenis) @endforeach @if ($hasSpb) @endif @if ($hasSpp) @endif @if ($hasUkt) @endif @foreach ($mahasiswaGroup as $index => $mhs) @php $spb = $mhs->grouped_angsuran['SPB'] ?? []; $spp = $mhs->grouped_angsuran['SPP'] ?? []; $ukt = $mhs->grouped_angsuran['UKT'] ?? []; $spbTotal = getTotalPaid($spb); $sppTotal = getTotalPaid($spp); $uktTotal = getTotalPaid($ukt); $spbPotongan = getTotalPotongan($spb); $sppPotongan = getTotalPotongan($spp); $uktPotongan = getTotalPotongan($ukt); $lainnyaTotal = 0; foreach ($jenisLainnyaList as $jenis) { $data = $mhs->grouped_angsuran[$jenis] ?? []; $lainnyaTotal += getTotalPaid($data); } $totalDibayar = $spbTotal + $sppTotal + $uktTotal + $lainnyaTotal; $spbRange = getCodeRange($spb); $sppRange = getCodeRange($spp); $uktRange = getCodeRange($ukt); $cutiSemesters = ensureArray($mhs->cuti_semester ?? []); $cutiInfo = !empty($cutiSemesters) ? 'Cuti Semester: ' . implode(', ', $cutiSemesters) : '-'; $rowClass = $mhs->is_cuti ? 'cuti-row' : ''; @endphp @if ($hasGroupCuti) @else @endif @if ($hasSpb) @endif @if ($hasSpp) @endif @if ($hasUkt) @endif @foreach ($jenisLainnyaList as $jenis) @php $data = $mhs->grouped_angsuran[$jenis] ?? []; $total = getTotalPaid($data); $potongan = getTotalPotongan($data); @endphp @endforeach @endforeach @php $totalColspan = $hasGroupCuti ? 6 : 5; if ($hasSpb) { $totalColspan += 3; } if ($hasSpp) { $totalColspan += 3; } if ($hasUkt) { $totalColspan += 3; } $totalColspan += count($jenisLainnyaList); @endphp
No NIM Nama Kampus Prodi Info CutiNo NIM Nama Kampus ProdiSPBSPPUKT{{ $jenis }}Total Dibayar Status
Angs Nominal PotonganAngs Nominal PotonganAngs Nominal Potongan
{{ $index + 1 }} {{ $mhs->nim ?? '-' }} {{ $mhs->nama ?? '-' }} {{ $mhs->kampus->nama ?? '-' }} @if ($mhs->prodi) [{{ $mhs->prodi->jenjang ?? '-' }}] {{ $mhs->prodi->nama }} @else - @endif {{ $cutiInfo }}{{ $index + 1 }} {{ $mhs->nim ?? '-' }} {{ $mhs->nama ?? '-' }} {{ $mhs->kampus->nama ?? '-' }} @if ($mhs->prodi) [{{ $mhs->prodi->jenjang ?? '-' }}] {{ $mhs->prodi->nama }} @else - @endif {{ $spbRange }} {{ $spbTotal > 0 ? 'Rp ' . number_format($spbTotal, 0, ',', '.') : '-' }} @if ($spbPotongan > 0) -Rp {{ number_format($spbPotongan, 0, ',', '.') }} @else - @endif {{ $sppRange }} {{ $sppTotal > 0 ? 'Rp ' . number_format($sppTotal, 0, ',', '.') : '-' }} @if ($sppPotongan > 0) -Rp {{ number_format($sppPotongan, 0, ',', '.') }} @else - @endif {{ $uktRange }} {{ $uktTotal > 0 ? 'Rp ' . number_format($uktTotal, 0, ',', '.') : '-' }} @if ($uktPotongan > 0) -Rp {{ number_format($uktPotongan, 0, ',', '.') }} @else - @endif @if ($total > 0) Rp {{ number_format($total, 0, ',', '.') }} @if ($potongan > 0) (-Rp {{ number_format($potongan, 0, ',', '.') }}) @endif @else - @endif Rp {{ number_format($totalDibayar, 0, ',', '.') }} @if ($mhs->is_cuti) Cuti @elseif($totalDibayar == 0) Belum Bayar @elseif($mhs->total_sisa <= 0 && $mhs->total_tagihan > 0) Lunas @else Cicilan @endif
TOTAL Rp {{ number_format( $mahasiswaGroup->sum(function ($mhs) { $spbTotal = collect($mhs->grouped_angsuran['SPB'] ?? [])->sum('dibayar'); $sppTotal = collect($mhs->grouped_angsuran['SPP'] ?? [])->sum('dibayar'); $uktTotal = collect($mhs->grouped_angsuran['UKT'] ?? [])->sum('dibayar'); $lainnyaTotal = 0; foreach ($mhs->grouped_angsuran ?? [] as $jenis => $items) { if (!in_array($jenis, ['SPB', 'SPP', 'UKT', 'BT'])) { $lainnyaTotal += collect($items)->sum('dibayar'); } } return $spbTotal + $sppTotal + $uktTotal + $lainnyaTotal; }), 0, ',', '.', ) }} -
@endforeach

Ringkasan Bagi Hasil

@foreach ($totalBiayaLainnyaPerJenis as $jenis => $total) @if ($jenis != 'BT') @endif @endforeach
Komponen Total Persen Kampus / K2 Bagi Hasil Kampus Bagi Hasil K2
Angsuran (SPB/SPP/UKT) Rp {{ number_format($totalPembayaran, 0, ',', '.') }} {{ $persenKampus }}% / {{ $persenK2 }}% Rp {{ number_format($totalBagiHasilKampus, 0, ',', '.') }} Rp {{ number_format($totalBagiHasilK2, 0, ',', '.') }}
{{ $jenis }} Rp {{ number_format($total, 0, ',', '.') }} 100% / 0% Rp {{ number_format($total, 0, ',', '.') }} Rp 0
TOTAL KESELURUHAN Rp {{ number_format($totalSemuaBiaya, 0, ',', '.') }} - Rp {{ number_format($totalKeseluruhanBagiKampus, 0, ',', '.') }} Rp {{ number_format($totalBagiHasilK2, 0, ',', '.') }}

Kesimpulan Total

RINCIAN PENDAPATAN
Total SPB Rp {{ number_format($totalSpb ?? 0, 0, ',', '.') }}
Total SPP Rp {{ number_format($totalSpp ?? 0, 0, ',', '.') }}
Total UKT Rp {{ number_format($totalUkt ?? 0, 0, ',', '.') }}
Total Angsuran (SPB + SPP + UKT) Rp {{ number_format($totalPembayaran, 0, ',', '.') }}
Total Potongan -Rp {{ number_format($totalPotonganKeseluruhan ?? 0, 0, ',', '.') }}
Total Biaya Non Tetap (RUTIN, BL, SP, DLL) Rp {{ number_format($totalBiayaLainnya, 0, ',', '.') }}
TOTAL PENDAPATAN KESELURUHAN Rp {{ number_format($totalSemuaBiaya, 0, ',', '.') }}
TOTAL PENDAPATAN SETELAH POTONGAN Rp {{ number_format($totalSemuaBiaya - ($totalPotonganKeseluruhan ?? 0), 0, ',', '.') }}
ALOKASI BAGI HASIL
Hak Kampus ({{ $persenKampus }}% dari Angsuran + 100% Biaya Non Tetap) Rp {{ number_format($totalKeseluruhanBagiKampus, 0, ',', '.') }}
Hak K2 ({{ $persenK2 }}% dari Angsuran) Rp {{ number_format($totalBagiHasilK2, 0, ',', '.') }}
PPh 23 (10% × Total Angsuran × 2%) Rp {{ number_format($pph23, 0, ',', '.') }}
GRAND TOTAL (Kampus + K2) Rp {{ number_format($totalKeseluruhanBagiKampus + $totalBagiHasilK2, 0, ',', '.') }}

Mengetahui,

Bagian Keuangan

(______________________)