<style>

body{
font-family:Arial;
}
@media print {
    button{
        display:none;
    }
}
.invoice-box{
width:900px;
margin:auto;
padding:20px;
border:1px solid #eee;
}

table{
width:100%;
border-collapse:collapse;
}
.btn.disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}
table th,table td{
border:1px solid #ddd;
padding:8px;
}

.total{
text-align:right;
font-weight:bold;
}

</style>

<div class="invoice-box">

<h2>Invoice</h2>

<p>

<strong>Invoice No:</strong> <?php echo $invoice->invoice_number; ?><br>

<strong>Date:</strong> <?php echo $invoice->invoice_date; ?><br>

<strong>Customer:</strong> <?php echo $invoice->customer_name; ?>

</p>

<hr>

<table>

<thead>

<tr>
<th>Product</th>
<th>SKU</th>
<th>Qty</th>
<th>Unit Price</th>
<th>Total</th>
</tr>

</thead>

<tbody>

<?php foreach($items as $item): ?>

<tr>

<td><?php echo $item->product_name; ?></td>

<td><?php echo $item->sku; ?></td>

<td><?php echo $item->quantity; ?></td>

<td><?php echo number_format($item->unit_price,2); ?></td>

<td><?php echo number_format($item->total_price,2); ?></td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

<br>

<table>

<tr>
<td class="total">Subtotal</td>
<td width="150"><?php echo number_format($invoice->total_amount,2); ?></td>
</tr>

<tr>
<td class="total">VAT 5%</td>
<td><?php echo number_format($invoice->tax_amount,2); ?></td>
</tr>

<tr>
<td class="total">Grand Total</td>
<td><?php echo number_format($invoice->grand_total,2); ?></td>
</tr>

</table>

<br>
<?php if(!empty($warning)): ?>
    <div style="color:red;font-weight:bold;margin-bottom:10px;">
        <?php echo $warning; ?>
    </div>
<?php endif; ?>

<button onclick="window.print()" 
        class="btn btn-primary"
        <?php echo ($invoice->status != 'Paid') ? 'disabled' : ''; ?>>
    Print Invoice
</button>


</div>