NIM_E31220400/resources/views/laporan/pdf.blade.php

121 lines
3.9 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Laporan Keuangan Kas Masjid</title>
<style>
body {
font-family: sans-serif;
font-size: 13px;
margin: 20px;
}
table {
border-collapse: collapse;
width: 100%;
margin-top: 20px;
}
th, td {
border: 1px solid #444;
padding: 6px;
}
thead {
background-color: #f2f2f2;
}
tfoot {
background-color: #e0f7e0;
font-weight: bold;
}
</style>
</head>
<body>
<div align="center">
<h2>MASJID AL-HANNAN</h2>
<h3>Laporan Keuangan Kas (Pemasukan & Pengeluaran)</h3>
</div>
<table>
<thead>
<tr>
<th>No</th>
<th>Tanggal</th>
<th>Jenis</th>
<th>Nama</th>
<th>Kategori</th>
<th>Quantity</th>
<th>Harga Satuan</th>
<th>Jumlah</th>
<th>Masuk</th>
<th>Keluar</th>
<th>Keterangan</th>
</tr>
</thead>
<tbody>
@php
$no = 1;
$totalMasuk = 0;
$totalKeluar = 0;
@endphp
@foreach($gabungan as $item)
@php
$jumlah = 0;
if ($item->kategori === 'uang') {
$jumlah = $item->jumlah;
} elseif ($item->kategori === 'barang' && $item->quantity && $item->harga) {
$jumlah = $item->quantity * $item->harga;
}
$masuk = $item->jenis === 'Masuk' ? $jumlah : 0;
$keluar = $item->jenis === 'Keluar' ? $jumlah : 0;
$totalMasuk += $masuk;
$totalKeluar += $keluar;
@endphp
<tr>
<td align="center">{{ $no++ }}</td>
<td align="center">{{ \Carbon\Carbon::parse($item->tanggal)->format('d-m-Y') }}</td>
<td align="center">{{ $item->jenis }}</td>
<td>{{ $item->nama }}</td>
<td align="center">{{ ucfirst($item->kategori) }}</td>
<td align="center">{{ $item->quantity ?? '-' }}</td>
<td align="right">
{{ $item->harga ? 'Rp ' . number_format($item->harga, 0, ',', '.') : '-' }}
</td>
<td align="right">
{{ $jumlah ? 'Rp ' . number_format($jumlah, 0, ',', '.') : '-' }}
</td>
<td align="right">
{{ $masuk ? 'Rp ' . number_format($masuk, 0, ',', '.') : '-' }}
</td>
<td align="right">
{{ $keluar ? 'Rp ' . number_format($keluar, 0, ',', '.') : '-' }}
</td>
<td>{{ $item->keterangan ?? '-' }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="8" align="right">Total Pemasukan</td>
<td align="right">Rp {{ number_format($totalMasuk, 0, ',', '.') }}</td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="8" align="right">Total Pengeluaran</td>
<td></td>
<td align="right">Rp {{ number_format($totalKeluar, 0, ',', '.') }}</td>
<td></td>
</tr>
<tr>
<td colspan="8" align="right">Saldo Akhir</td>
<td colspan="2" align="right">Rp {{ number_format($totalMasuk - $totalKeluar, 0, ',', '.') }}</td>
<td></td>
</tr>
</tfoot>
</table>
</body>
</html>