<!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";
    $hp1 = mysqli_query($conn, "SELECT * FROM pengaturan WHERE id_pengaturan='1'");
    $hp = mysqli_fetch_array($hp1); ?>

<?php
$query = mysqli_query($conn, "SELECT * FROM transaksi_bawauang WHERE id_transaksi='$_GET[id_tran]'");
$row = mysqli_fetch_array($query);
          //nama admin
    $adm1 = mysqli_query($conn, "SELECT * FROM pegawai WHERE id_pegawai='$row[id_pegawai_pemberi]'");
    $adm = mysqli_fetch_array($adm1);
    //nama pekerja
    $pek1 = mysqli_query($conn, "SELECT * FROM pekerja WHERE id_pekerja='$row[id_pekerja]'");
    $pek = mysqli_fetch_array($pek1);?>
</head>
<body style="font-family: 'Courier New', monospace; margin: 0; padding: 2mm; width: 95mm; font-size: 11px;">
    <!-- Header -->
    <div style="text-align: center; margin-bottom: 2mm; border-bottom: 1px dashed #000; padding-bottom: 2mm;">
        <h2 style="margin: 0; font-size: 13px; font-weight: bold;">BUKTI BAWA UANG</h2>
        <p style="margin: 1mm 0; font-size: 10px;">Id Trx: <?php echo $row['id_transaksi']; ?></p>
    </div>
    
    <!-- Info Utama -->
    <div style="display: flex; margin-bottom: 2mm;">
        <div style="flex: 1;">
            <div><strong>ID:</strong> <?php echo $row['id_transaksi']; ?></div>
            <div><strong>Tanggal:</strong> <?php echo date('d-M-Y', strtotime($row['tgl_bawa'])); ?></div>
        </div>
        <div style="flex: 1; text-align: right;">
            <div><strong>Pemberi:</strong> (<?php echo $adm['id_pegawai']; ?>)<?php echo $adm['nama']; ?></div>
            <div><strong>-</strong>-</div>
        </div>
    </div>
    
    <!-- Detail Pekerja -->
    <div style="border: 1px dashed #000; padding: 2mm; margin-bottom: 2mm;">
        <div style="display: flex; margin-bottom: 1mm;">
            <div style="width: 30mm;"><strong>Pembawa:</strong></div>
            <div><?php echo $row['id_pekerja']; ?> - <?php echo $pek['nama_pekerja']; ?></div>
        </div>
        <div style="display: flex;">
            <div style="width: 30mm;"><strong>Jumlah:</strong></div>
            <?php $rp = rupiah($row['jumlah_bawa']); ?>
            <div><strong>Rp. <?php echo $rp; ?></strong></div>
        </div>
    </div>
    
    <!-- Keterangan -->
    <div style="margin-bottom: 2mm;">
        <div><strong>Keterangan:</strong></div>
        <div style="border: 1px dashed #000; padding: 2mm; min-height: 8mm; margin-top: 1mm;">
        <?php echo $row['keterangan']; ?>
        </div>
    </div>
    
    <!-- Tanda Tangan Pertama -->
    <div style="display: flex; border-top: 1px dashed #000; padding-top: 2mm; margin-bottom: 3mm;">
        <div style="flex: 1; text-align: center;">
            <div style="height: 12mm; border-bottom: 1px dashed #000;"></div>
            <div style="font-size: 9px;">Pembawa</div>
        </div>
        <div style="flex: 1; text-align: center;">
            <div style="height: 12mm; border-bottom: 1px dashed #000;"></div>
            <div style="font-size: 9px;">Pemberi</div>
        </div>
    </div>
    
    <!-- Total dan Tanda Tangan Kedua -->
    <div style="border-top: 1px solid #000; padding-top: 2mm;">
        <div style="text-align: center; margin-bottom: 1mm;">
            <strong>TOTAL: Rp. <?php echo $rp; ?></strong>
        </div>
        <div style="display: flex; margin-top: 2mm;">
            <div style="flex: 1; text-align: center;">
                <div style="height: 12mm; border-bottom: 1px dashed #000;"></div>
                <div style="font-size: 9px;">Penerima Totalan</div>
            </div>
            <div style="flex: 1; text-align: center;">
                <div style="height: 12mm; border-bottom: 1px dashed #000;"></div>
                <div style="font-size: 9px;">Pembawa</div>
            </div>
        </div>
    </div>
</body>
</html>