<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title><?= $title ?></title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
    <style>
        body { font-family: 'Courier New', Courier, monospace; color: black; background-color: white; padding: 10px; max-width: 450px; margin: 0 auto; }
        .struk-header { text-align: center; border-bottom: 1px dashed black; padding-bottom: 10px; margin-bottom: 10px; }
        .struk-footer { border-top: 1px dashed black; padding-top: 10px; margin-top: 15px; text-align: center; font-size: 12px; }
        .table-nota td { padding: 3px 0; border: none !important; font-size: 13px; }
        .text-right { text-align: right; }
    </style>
</head>
<body>

    <div class="struk-header">
        <h5 class="mb-0"><b>POKTAN SARI RASA</b></h5>
        <small>Penyaluran Pupuk Bersubsidi e-RDKK</small><br>
        <small>Desa Trahean, Barito Utara</small>
    </div>

    <table class="table table-nota w-100 mb-2">
        <tr>
            <td width="35%">No. Invoice</td>
            <td>: <b><?= $t['no_invoice'] ?></b></td>
        </tr>
        <tr>
            <td>Tanggal</td>
            <td>: <?= date('d/m/Y H:i', strtotime($t['tanggal_transaksi'])) ?></td>
        </tr>
        <tr>
            <td>NIK / Petani</td>
            <td>: <?= $t['nik'] ?> / <?= $t['nama_petani'] ?></td>
        </tr>
    </table>

    <div style="border-bottom: 1px dashed black; margin-bottom: 8px;"></div>

    <table class="table table-nota w-100">
        <thead>
            <tr style="font-weight: bold;">
                <td>Item Pupuk</td>
                <td class="text-right">Total</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <?= $t['nama_pupuk'] ?><br>
                    <small><?= number_format($t['jumlah_beli'], 1) ?> Kg x Rp <?= number_format($t['harga_het'], 0, ',', '.') ?></small>
                </td>
                <td class="text-right valign-middle" style="vertical-align: middle;">
                    <b>Rp <?= number_format($t['total_bayar'], 0, ',', '.') ?></b>
                </td>
            </tr>
            <tr style="border-top: 1px dashed black !important; font-weight: bold;">
                <td>TOTAL BAYAR</td>
                <td class="text-right text-success" style="font-size: 15px;">Rp <?= number_format($t['total_bayar'], 0, ',', '.') ?></td>
            </tr>
        </tbody>
    </table>

    <div class="row mt-4" style="font-size: 12px;">
        <div class="col-6 text-center">
            <p>Penerima (Petani),</p>
            <br><br>
            <p>( ________________ )</p>
        </div>
        <div class="col-6 text-center">
            <p>Petugas Kasir,</p>
            <br><br>
            <p>( <?= session()->get('nama_lengkap') ?> )</p>
        </div>
    </div>

    <div class="struk-footer">
        <p>Terima Kasih Atas Kerjasamanya.<br>Gunakan Pupuk Subsidi Sesuai Aturan Anjuran!</p>
    </div>

    <script>
        window.onload = function() {
            window.print();
        }
    </script>
</body>
</html>