<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>Export PDF - Laporan Perpustakaan</title>
    <style>
        body { font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
        h2, h3, p { text-align: center; margin: 2px; }
        table { width: 100%; border-collapse: collapse; margin-top: 15px; }
        table th, table td { border: 1px solid black; padding: 4px; }
        table th { background: #e0e0e0; }
        .text-center { text-align: center; }
        .text-right { text-align: right; }
    </style>
</head>
<body>
    <h2>PERPUSTAKAAN</h2>
    <h3>LAPORAN PEMINJAMAN BUKU (PDF)</h3>
    <p>Tanggal Cetak: <?= date('d-m-Y H:i'); ?></p>
    <hr>

    <table>
        <thead>
            <tr>
                <th>No</th>
                <th>NISN</th>
                <th>Nama</th>
                <th>Kelas</th>
                <th>Total Pinjam</th>
                <th>Sudah Kembali</th>
                <th>Belum Kembali</th>
                <th>Total Denda</th>
            </tr>
        </thead>
        <tbody>
        <?php $no=1; foreach($laporan as $row): ?>
            <tr>
                <td class="text-center"><?= $no++ ?></td>
                <td><?= $row['nisn'] ?></td>
                <td><?= $row['nama'] ?></td>
                <td><?= $row['kelas'] ?></td>
                <td class="text-center"><?= $row['total_pinjam'] ?></td>
                <td class="text-center"><?= $row['sudah_kembali'] ?></td>
                <td class="text-center"><?= $row['belum_kembali'] ?></td>
                <td class="text-right">Rp <?= number_format($row['total_denda'],0,',','.') ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</body>
</html>
