<!DOCTYPE html>
<html>
<head>
    <title>Bukti Bawa Uang</title>
    <meta charset="UTF-8">
    <?php
    include "../../config/conn.php";
    include "../../lib/function.php";
    include "../../config/rupiah.php";
    $query = mysqli_query($conn, "SELECT * FROM transaksi_bawauang WHERE id_transaksi='$_GET[id_tran]'");
    $row = mysqli_fetch_array($query);
    $adm = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM pegawai WHERE id_pegawai='$row[id_pegawai_pemberi]'"));
    $pek = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM pekerja WHERE id_pekerja='$row[id_pekerja]'"));
    $rp = rupiah($row['jumlah_bawa']);
    ?>
</head>
<body style="font-family: Arial, sans-serif; margin: 2mm; padding: 2mm; width: 95mm; font-size: 14px; line-height: 1.3;">
    <div style="text-align: center; margin-bottom: 3mm;">
        <h2 style="margin: 0; font-size: 18px;">BUKTI BAWA UANG</h2>
        <p style="margin: 1mm 0; font-size: 13px;">ID: <?= $row['id_transaksi'] ?> | <?= date('d-M-Y', strtotime($row['tgl_bawa'])) ?></p>
    </div>
    
    <div style="display: flex; margin-bottom: 2mm;">
        <div style="flex:1;"><strong>Pemberi:</strong><br>(<?= $adm['id_pegawai'] ?>) <?= $adm['nama'] ?></div>
        <div style="flex:1;text-align:right;"><strong>Pembawa:</strong><br><?= $row['id_pekerja'] ?>-<?= $pek['nama_pekerja'] ?></div>
    </div>
    
    <div style="background: #f5f5f5; padding: 3mm; margin-bottom: 3mm; border-radius: 3px;">
        <div style="font-size: 16px; text-align: center;"><strong>JUMLAH: Rp. <?= $rp ?></strong></div>
        <div style="margin-top: 2mm;"><strong>Keterangan:</strong> <?= $row['keterangan'] ?></div>
    </div>
    
    <div style="display: flex; text-align: center; margin-top: 5mm; font-size: 13px;">
        <div style="flex:1; padding:0 5mm;">
            <div style="border-bottom:1px solid #000; height:15mm;"></div>
            <div>Pemberi</div>
        </div>
        <div style="flex:1; padding:0 5mm;">
            <div style="border-bottom:1px solid #000; height:15mm;"></div>
            <div>Pembawa</div>
        </div>
    </div>
    
    <div style="text-align: center; margin-top: 5mm; font-size: 13px;">
        <div style="border-bottom:1px solid #000; height:15mm; width:60%; margin:0 auto;"></div>
        <div>Penerima Totalan</div>
        <p style="margin:2mm 0;"><strong>Tgl Laporan: ___________</strong></p>
    </div>
</body>
<script>window.print();window.onafterprint=window.close;</script>
</html>