<?php
$hesap_no = $_GET['hesap_no'] ?? '';
$gonderen_iban = $_GET['gonderen_iban'] ?? '';
$gonderen_adsoyad = $_GET['gonderen_adsoyad'] ?? '';
$alacakli_adsoyad = $_GET['alacakli_adsoyad'] ?? '';
$alacakli_iban = $_GET['alacakli_iban'] ?? '';
$tutar = $_GET['tutar'] ?? '0';
$tutar_yazilis = $_GET['tutar_yazilis'] ?? '';
$fast_no = 'FAST.' . rand(1000, 9999) . '-' . rand(1000000, 9999999);
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>Akbank Dekont</title>
    <style>
        @media print { .no-print { display: none !important; } }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: Arial, sans-serif; font-size: 11px; padding: 20px; max-width: 210mm; margin: 0 auto; background: #fff; }
        .logo { color: #e4002b; font-size: 28px; font-weight: bold; font-style: italic; }
        .title { text-align: center; font-size: 14px; font-weight: bold; }
        .subtitle { text-align: center; font-size: 12px; }
        .section-header { background: #e4002b; color: #fff; padding: 6px 10px; font-weight: bold; margin-bottom: 10px; }
        .main-table { width: 100%; border-collapse: collapse; margin: 15px 0; }
        .main-table td { padding: 12px; border: 1px solid #ccc; vertical-align: top; }
        .label { color: #e4002b; text-decoration: underline; font-weight: bold; }
        .tutar-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
        .tutar-table td { padding: 8px; border: 1px solid #ccc; }
        .print-btn { position: fixed; top: 20px; right: 20px; background: #e4002b; 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>
    
    <table width="100%">
        <tr>
            <td width="30%"><div class="logo">AKBANK</div></td>
            <td width="40%" style="text-align:center;">
                <div class="title">DEKONT</div>
                <div class="subtitle">ÖDEME EMİRLERİ GİRİŞİ</div>
            </td>
            <td width="30%" style="text-align:right;">
                <div style="width:60px; height:60px; border:1px solid #ccc; display:inline-block; text-align:center; line-height:60px; font-size:9px; color:#999;">QR</div>
            </td>
        </tr>
    </table>
    
    <table class="main-table">
        <tr>
            <td width="50%">
                <div class="section-header">GÖNDERİCİ BİLGİLERİ</div>
                <div><span class="label">Düzenleyen Şube</span> : </div>
                <div><span class="label">Borçlu Hesap No</span> : <?php echo htmlspecialchars($hesap_no); ?></div>
                <div><span class="label">Müşteri No</span> : </div>
                <div><span class="label">VKN/Vergi Dairesi</span> : </div>
                <div><span class="label">Adı Soyadı/Unvan</span> : <?php echo htmlspecialchars($gonderen_adsoyad); ?></div>
                <div><span class="label">Adres</span> : </div>
            </td>
            <td width="50%">
                <div class="section-header">ALICI BİLGİLERİ</div>
                <div><span class="label">Alacaklı Hesap No</span> : <?php echo htmlspecialchars($alacakli_iban); ?></div>
                <div><span class="label">Karşı Şube</span> : </div>
                <div><span class="label">VKN/Vergi Dairesi</span> : </div>
                <div><span class="label">Adı Soyadı/Unvan</span> : <?php echo htmlspecialchars($alacakli_adsoyad); ?></div>
                <div><span class="label">Adres</span> : </div>
            </td>
        </tr>
    </table>
    
    <div style="padding:10px; border:1px solid #ccc; margin:15px 0;">
        <div><?php echo htmlspecialchars($gonderen_iban); ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?php echo htmlspecialchars($alacakli_iban); ?></div>
        <div><?php echo $fast_no; ?> <?php echo htmlspecialchars($alacakli_adsoyad); ?></div>
    </div>
    
    <table class="tutar-table">
        <tr style="background:#f5f5f5;">
            <td colspan="4" style="font-weight:bold;">TUTAR BİLGİLERİ</td>
        </tr>
        <tr>
            <td>MEVDUAT</td>
            <td style="text-align:right;"><?php echo htmlspecialchars($tutar); ?> TL</td>
            <td style="text-align:right;">0.00 TL</td>
            <td></td>
        </tr>
        <tr>
            <td>MEVDUAT</td>
            <td style="text-align:right;">0.00 TL</td>
            <td style="text-align:right;"><?php echo htmlspecialchars($tutar); ?> TL</td>
            <td></td>
        </tr>
    </table>
    
    <table class="tutar-table" style="margin-top:15px;">
        <tr>
            <td style="font-weight:bold;">TOPLAM</td>
            <td style="text-align:right; font-weight:bold;"><?php echo htmlspecialchars($tutar); ?> TL</td>
        </tr>
        <tr>
            <td colspan="2">YALNIZ <?php echo htmlspecialchars($tutar_yazilis); ?></td>
        </tr>
    </table>
</body>
</html>
