<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Invoice - <?php echo e($invoice->invoice_no); ?></title>
    <style>
        @page {
            size: A4 portrait;
            margin: 10mm;
        }
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            font-size: 14px;
        }
        .invoice-box {
            max-width: 800px;
            margin: auto;
            padding: 20px;
            border: 1px solid #eee;
        }
        .header {
            text-align: center;
            border-bottom: 2px solid #333;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .header h1 { margin: 0; font-size: 24px; color: #6f42c1; }
        .header p { margin: 5px 0; }
        .info-table {
            width: 100%;
            margin-bottom: 20px;
        }
        .info-table td {
            vertical-align: top;
            width: 50%;
        }
        .items-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        .items-table th, .items-table td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        .items-table th {
            background: #f8f9fa;
        }
        .items-table .text-right {
            text-align: right;
        }
        .totals-table {
            width: 100%;
            border-collapse: collapse;
        }
        .totals-table td {
            padding: 5px;
            text-align: right;
        }
        .footer {
            margin-top: 50px;
            display: flex;
            justify-content: space-between;
        }
        .signature {
            border-top: 1px solid #000;
            padding-top: 5px;
            text-align: center;
            width: 200px;
        }
        @media print {
            .no-print { display: none; }
            .invoice-box { border: none; padding: 0; }
        }
    </style>
</head>
<body onload="window.print()">
    <div class="no-print" style="margin-bottom: 20px; text-align: center;">
        <button onclick="window.print()" style="padding: 10px 20px; font-size: 16px; cursor: pointer;">Print</button>
        <button onclick="window.close()" style="padding: 10px 20px; font-size: 16px; cursor: pointer;">Close</button>
    </div>

    <div class="invoice-box">
        <div class="header">
            <h1>RIYASRI SILKS</h1>
            <p><strong>Mrs. of High Class Fancy Sarees</strong></p>
            <p>107/B, Gandhi Nagar, Salem Main Road, Elampillai – 637502, Salem, Tamil Nadu</p>
            <p>Phone: 9244443777, 9244441999</p>
        </div>

        <table class="info-table">
            <tr>
                <td>
                    <strong>Billed To:</strong><br>
                    <?php echo e($invoice->customer->customer_name); ?><br>
                    <?php echo e($invoice->customer->address1); ?><br>
                    <?php if($invoice->customer->address2): ?> <?php echo e($invoice->customer->address2); ?><br> <?php endif; ?>
                    <?php echo e($invoice->customer->city); ?>, <?php echo e($invoice->customer->state); ?> <?php echo e($invoice->customer->pincode); ?><br>
                    Mobile: <?php echo e($invoice->customer->mobile); ?><br>
                    <?php if($invoice->customer->gst_number): ?> GST: <?php echo e($invoice->customer->gst_number); ?> <?php endif; ?>
                </td>
                <td style="text-align: right;">
                    <strong>Invoice No:</strong> <?php echo e($invoice->invoice_no); ?><br>
                    <strong>Date:</strong> <?php echo e($invoice->invoice_date->format('d-m-Y')); ?><br>
                </td>
            </tr>
        </table>

        <table class="items-table">
            <thead>
                <tr>
                    <th width="5%">S.No</th>
                    <th width="45%">Product Name</th>
                    <th width="15%" class="text-right">Qty</th>
                    <th width="15%" class="text-right">Rate</th>
                    <th width="20%" class="text-right">Amount</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $invoice->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($index + 1); ?></td>
                    <td><?php echo e($item->product_name); ?></td>
                    <td class="text-right"><?php echo e(number_format($item->qty, 2)); ?></td>
                    <td class="text-right"><?php echo e(number_format($item->rate, 2)); ?></td>
                    <td class="text-right"><?php echo e(number_format($item->amount, 2)); ?></td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>

        <table class="totals-table">
            <tr>
                <td width="70%"></td>
                <td width="15%"><strong>Sub Total:</strong></td>
                <td width="15%">₹<?php echo e(number_format($invoice->subtotal, 2)); ?></td>
            </tr>
            <tr>
                <td></td>
                <td><strong>Discount:</strong></td>
                <td>₹<?php echo e(number_format($invoice->discount, 2)); ?></td>
            </tr>
            <tr>
                <td></td>
                <td><strong>Grand Total:</strong></td>
                <td><strong>₹<?php echo e(number_format($invoice->grand_total, 2)); ?></strong></td>
            </tr>
        </table>

        <div class="footer">
            <div>
                <p><strong>Thank You Visit Again</strong></p>
            </div>
            <div style="text-align: right; margin-top: 30px;">
                <div class="signature">Authorized Signature</div>
            </div>
        </div>
    </div>
</body>
</html>
<?php /**PATH E:\xampp\htdocs\riya\billing\resources\views/invoices/print.blade.php ENDPATH**/ ?>