<?php
$musteri_no = $_GET['musteri_no'] ?? '';
$hesap_no = $_GET['hesap_no'] ?? '';
$islem_tarih = $_GET['islem_tarih'] ?? date('Y-m-d');
$tc = $_GET['tc'] ?? '';
$islem_yeri = $_GET['islem_yeri'] ?? 'MOBIL';
$gonderen_iban = $_GET['gonderen_iban'] ?? '';
$gonderen_adsoyad = $_GET['gonderen_adsoyad'] ?? '';
$gonderen_adres = $_GET['gonderen_adres'] ?? '';
$gonderen_sube = $_GET['gonderen_sube'] ?? 'fast';
$alacakli_adsoyad = $_GET['alacakli_adsoyad'] ?? '';
$alacakli_iban = $_GET['alacakli_iban'] ?? '';
$tutar = $_GET['tutar'] ?? '0';
$tutar_yazilis = $_GET['tutar_yazilis'] ?? '';
$fast_no = rand(1000000000, 9999999999);

$islem_tarihi_fmt = date('d.m.Y', strtotime($islem_tarih));
$sira_no = '2024-' . rand(100, 255) . '.' . rand(10, 99) . '.' . rand(10, 99) . '.' . rand(100000, 999999);
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>Garanti BBVA Dekont</title>
    <style>
        @media print { .no-print { display: none !important; } body { padding: 0; } }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: Arial, sans-serif; font-size: 10px; padding: 0; max-width: 210mm; margin: 0 auto; background: #fff; }
        .header { background: linear-gradient(to right, #006747, #00a36c); color: #fff; padding: 15px 25px; }
        .logo { font-size: 20px; font-weight: bold; }
        .title { text-align: center; font-size: 14px; font-weight: bold; margin: 20px 0; }
        .content { padding: 20px; }
        .main-table { width: 100%; border-collapse: collapse; }
        .main-table td { padding: 12px; border: 1px solid #ccc; vertical-align: top; }
        .label { display: inline-block; width: 110px; }
        .info-box { border: 1px solid #ccc; border-radius: 5px; padding: 15px; margin: 15px 0; }
        .footer-box { border: 1px solid #ccc; padding: 10px; margin-top: 15px; }
        .print-btn { position: fixed; top: 20px; right: 20px; background: #006747; color: #fff; border: none; padding: 10px 20px; cursor: pointer; border-radius: 5px; font-weight: bold; }
    </style>
</head>
<body>
    <button class="print-btn no-print" onclick="window.print()">PDF Kaydet</button>
    
    <div class="header">
        <table width="100%">
            <tr>
                <td><div class="logo">● Garanti BBVA</div></td>
                <td style="text-align:center;"><div style="font-size:16px; font-weight:bold;">Dekont</div></td>
                <td style="text-align:right; font-size:8px;">
                    <div>T. Garanti Bankası A.Ş.</div>
                    <div>Nispetiye Mah. Aytar Cad. No:2</div>
                    <div>Beşiktaş, Levent, 34340, İstanbul</div>
                </td>
            </tr>
        </table>
    </div>
    
    <div class="content">
        <div class="title">HESAPTAN FAST</div>
        
        <table class="main-table">
            <tr>
                <td width="50%">
                    <div><span class="label">ŞUBE ADI</span> : <?php echo htmlspecialchars($gonderen_sube); ?></div>
                    <div><span class="label">MÜŞTERİ NO</span> : <?php echo htmlspecialchars($musteri_no); ?></div>
                    <div><span class="label">HESAP NO</span> : <?php echo htmlspecialchars($hesap_no); ?></div>
                    <div><span class="label">İŞLEM TARİHİ</span> : <?php echo $islem_tarihi_fmt; ?></div>
                    <div><span class="label">TC KİMLİK NO</span> : <?php echo htmlspecialchars($tc); ?></div>
                    <div><span class="label">İŞLEM YERİ</span> : <?php echo htmlspecialchars($islem_yeri); ?></div>
                    <div><span class="label">IBAN</span> : <?php echo htmlspecialchars($gonderen_iban); ?></div>
                </td>
                <td width="50%">
                    <div><strong>SAYIN</strong></div>
                    <div><strong><?php echo htmlspecialchars($gonderen_adsoyad); ?></strong></div>
                    <br>
                    <div><?php echo htmlspecialchars($gonderen_adres); ?></div>
                </td>
            </tr>
        </table>
        
        <div class="info-box">
            <div><span class="label" style="font-weight:bold;">FAST REF NO</span> : <?php echo $fast_no; ?></div>
            <div><span class="label" style="font-weight:bold;">ALACAKLI</span> : <?php echo htmlspecialchars($alacakli_adsoyad); ?></div>
            <div><span class="label" style="font-weight:bold;">ALACAKLI IBAN</span> : <?php echo htmlspecialchars($alacakli_iban); ?></div>
            <div><span class="label" style="font-weight:bold;">MASRAF</span> : 8,44</div>
            <div><span class="label" style="font-weight:bold;">BSMV</span> : 0,42 TL</div>
            <div><span class="label" style="font-weight:bold;">KOMİSYON TOPLAMI</span> : 8,86 TL</div>
        </div>
        
        <div class="info-box">
            <div style="font-weight:bold;">YALNIZ <?php echo htmlspecialchars($tutar_yazilis); ?>.</div>
        </div>
        
        <table class="footer-box" width="100%">
            <tr>
                <td>SIRA NO : <?php echo $sira_no; ?></td>
                <td style="text-align:right;">TUTAR : - <?php echo htmlspecialchars($tutar); ?> TL</td>
            </tr>
        </table>
    </div>
</body>
</html>
