<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Struk #<?php echo e($sale->invoice_number); ?></title>
    <style>
        body {
            font-family: 'Courier New', Courier, monospace;
            font-size: 12px;
            color: #000;
            margin: 0;
            padding: 20px;
            width: 300px; /* Thermal printer width approx */
        }
        .text-center { text-align: center; }
        .text-right { text-align: right; }
        .font-bold { font-weight: bold; }
        .border-top { border-top: 1px dashed #000; margin-top: 10px; padding-top: 10px; }
        .border-bottom { border-bottom: 1px dashed #000; margin-bottom: 10px; padding-bottom: 10px; }
        table { width: 100%; border-collapse: collapse; }
        td { vertical-align: top; padding: 2px 0; }
        .qty-col { width: 30px; text-align: center; }
        .price-col { width: 80px; text-align: right; }
        @media  print {
            body { padding: 0; }
            .no-print { display: none; }
        }
    </style>
</head>
<body>
    <div class="text-center border-bottom">
        <h2 style="margin: 0; font-size: 16px;">APOTEKKU</h2>
        <p style="margin: 5px 0;">Jl. Sehat Selalu No. 123<br>Telp: 0812-3456-7890</p>
    </div>

    <div>
        <table style="margin-bottom: 10px;">
            <tr>
                <td>No</td>
                <td>: <?php echo e($sale->invoice_number); ?></td>
            </tr>
            <tr>
                <td>Tgl</td>
                <td>: <?php echo e(\Carbon\Carbon::parse($sale->created_at)->format('d/m/Y H:i')); ?></td>
            </tr>
            <tr>
                <td>Ksr</td>
                <td>: <?php echo e($sale->user->name); ?></td>
            </tr>
        </table>
    </div>

    <div class="border-top border-bottom">
        <table>
            <?php $__currentLoopData = $sale->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td colspan="3" class="font-bold"><?php echo e($item->medicine->name); ?></td>
            </tr>
            <tr>
                <td class="qty-col"><?php echo e($item->qty); ?>x</td>
                <td class="text-right"><?php echo e(number_format($item->price, 0, ',', '.')); ?></td>
                <td class="price-col font-bold"><?php echo e(number_format($item->subtotal, 0, ',', '.')); ?></td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </table>
    </div>

    <div>
        <table>
            <tr>
                <td class="font-bold">TOTAL</td>
                <td class="font-bold text-right" style="font-size: 14px;">Rp <?php echo e(number_format($sale->total_amount, 0, ',', '.')); ?></td>
            </tr>
            <tr>
                <td>Tunai</td>
                <td class="text-right">Rp <?php echo e(number_format($sale->paid_amount, 0, ',', '.')); ?></td>
            </tr>
            <tr>
                <td>Kembali</td>
                <td class="text-right">Rp <?php echo e(number_format($sale->change_amount, 0, ',', '.')); ?></td>
            </tr>
        </table>
    </div>

    <div class="text-center border-top">
        <p style="margin: 10px 0;">Terima kasih atas kunjungan Anda.<br>Semoga lekas sembuh.</p>
    </div>

    <div class="no-print" style="margin-top: 30px; text-align: center;">
        <button onclick="window.print()" style="padding: 10px 20px; font-size: 14px; cursor: pointer;">Print Struk</button>
    </div>

    <script>
        // Auto print when page loads
        window.onload = function() {
            window.print();
        }
    </script>
</body>
</html>
<?php /**PATH D:\PROJECT\xampp\htdocs\apoteks\resources\views/transactions/pos/receipt.blade.php ENDPATH**/ ?>