<?php
$islem_tarih = $_GET['islem_tarih'] ?? date('Y-m-d');
$tc = $_GET['tc'] ?? '';
$gonderen_iban = $_GET['gonderen_iban'] ?? '';
$gonderen_adsoyad = $_GET['gonderen_adsoyad'] ?? '';
$alacakli_adsoyad = $_GET['alacakli_adsoyad'] ?? '';
$alacakli_iban = $_GET['alacakli_iban'] ?? '';
$alacakli_banka = $_GET['alacakli_banka'] ?? '';
$tutar = $_GET['tutar'] ?? '0';

$islem_tarihi_fmt = date('d.m.Y H:i:s', strtotime($islem_tarih . ' ' . date('H:i:s')));
$valor_tarihi = date('d.m.Y 00:00:00', strtotime($islem_tarih));
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>Denizbank 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: 10px; padding: 20px; max-width: 210mm; margin: 0 auto; background: #fff; }
        .header { border-bottom: 3px solid #0077b6; padding-bottom: 15px; margin-bottom: 20px; }
        .logo { color: #0077b6; font-size: 22px; font-weight: bold; }
        .fast-badge { display: inline-block; background: #0077b6; color: #fff; padding: 5px 15px; border-radius: 5px; font-weight: bold; }
        .section { margin-bottom: 20px; }
        .section-title { font-weight: bold; color: #0077b6; margin-bottom: 8px; font-size: 11px; }
        .info-table { width: 100%; border-collapse: collapse; }
        .info-table td { padding: 8px 10px; border: 1px solid #e0e0e0; background: #fafafa; }
        .info-table td:first-child { color: #666; width: 150px; }
        .footer { margin-top: 30px; border-top: 2px solid #0077b6; padding-top: 15px; }
        .print-btn { position: fixed; top: 20px; right: 20px; background: #0077b6; 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%" class="header">
        <tr>
            <td width="25%"><div class="logo">Dekont</div></td>
            <td width="25%" style="text-align:center;"><span class="fast-badge">FAST</span></td>
            <td width="50%" style="text-align:right; font-size:8px; color:#0077b6;">
                <div style="font-weight:bold;">Denizbank A.Ş.</div>
                <div>Büyükdere Cad. No:141 34394 Esentepe, İstanbul</div>
                <div>Ticaret Sicil No: 368587 | Vergi No: 2920084496</div>
            </td>
        </tr>
    </table>
    
    <div class="section">
        <div class="section-title">Müşteri Bilgisi</div>
        <table class="info-table">
            <tr><td>Adı Soyadı</td><td><?php echo htmlspecialchars($gonderen_adsoyad); ?></td></tr>
            <tr><td>VKN / TCKN</td><td><?php echo htmlspecialchars($tc); ?></td></tr>
            <tr><td>IBAN</td><td><?php echo htmlspecialchars($gonderen_iban); ?></td></tr>
        </table>
    </div>
    
    <div class="section">
        <div class="section-title">İşlem Bilgisi</div>
        <table class="info-table">
            <tr><td>İşlem Türü</td><td><span style="color:#0077b6; font-weight:bold;">Giden FAST</span></td></tr>
            <tr><td>İşlem Tarihi</td><td><?php echo $islem_tarihi_fmt; ?></td></tr>
            <tr><td>Valör Tarihi</td><td><?php echo $valor_tarihi; ?></td></tr>
        </table>
    </div>
    
    <div class="section">
        <div class="section-title">İşlem Açıklaması</div>
        <table class="info-table">
            <tr><td>Alıcı Banka</td><td><?php echo htmlspecialchars($alacakli_banka); ?></td></tr>
            <tr><td>Kolay Adres</td><td>-</td></tr>
            <tr><td>Alıcı IBAN</td><td><?php echo htmlspecialchars($alacakli_iban); ?></td></tr>
            <tr><td>Alıcı Adı Soyadı</td><td><?php echo htmlspecialchars($alacakli_adsoyad); ?></td></tr>
            <tr><td>Tutar</td><td><strong><?php echo htmlspecialchars($tutar); ?> TL</strong></td></tr>
            <tr><td>Masraf</td><td>0,00 TL</td></tr>
            <tr><td>Ödeme İste Ref</td><td>-</td></tr>
            <tr><td>Güvenli Ödeme Ref.</td><td>-</td></tr>
            <tr><td>İşlem Yapılan Kanal</td><td>9300 - Mobil Deniz</td></tr>
            <tr><td>Açıklama</td><td></td></tr>
            <tr><td>KMH Kullanımı</td><td></td></tr>
        </table>
    </div>
    
    <div class="footer">
        <table width="100%">
            <tr>
                <td style="font-size:9px; color:#666;">denizbank.com | 0 850 222 0 800</td>
                <td style="text-align:center;">
                    <span style="background:#0077b6; color:#fff; padding:3px 8px; font-weight:bold;">ENBD</span>
                    &nbsp;&nbsp; <span style="color:#666;">İlerisi Deniz ›</span>
                </td>
                <td style="text-align:right; color:#e31837; font-weight:bold; font-size:12px;">DenizBank ✿</td>
            </tr>
        </table>
    </div>
</body>
</html>
