<?php require_once __DIR__ . '/../includes/auth.php'; requireLogin(['admin','staff']); $user=currentUser(); ?>
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Billing</title><link rel="stylesheet" href="../assets/style.css"></head><body>
<div class="layout"><aside class="sidebar"><div class="brand">SHAHANA VEGitables<small>Billing</small></div><nav class="nav"><a href="dashboard.php">Dashboard</a><a href="items.php">Items</a><a class="active" href="billing.php">Billing</a><a href="expenses.php">Expenses</a><a href="users.php">Staff & Customers</a><a href="reports.php">Reports</a></nav></aside>
<main class="main"><div class="topbar"><h1>Billing & Invoices</h1></div>
<div class="grid grid-2"><div class="card"><h3>Create Bill</h3><form>
<label>Customer Type</label><select><option>Retail</option><option>Wholesale</option></select>
<label>Registered Customer</label><select><option>Select customer</option></select>
<label>Billed By</label><input type="text" value="<?php echo htmlspecialchars($user['full_name']); ?>" readonly>
<label>Items</label><textarea rows="6" placeholder="Add item lines with qty/kg and price"></textarea>
<label>Apply installment against previous balance</label><input type="number" step="0.01" placeholder="0.00">
<button class="btn btn-primary" type="button">Generate Invoice</button>
</form></div>
<div class="card"><h3>Invoice Rules</h3><ul><li>Wholesale customers get wholesale price only.</li><li>Retail customers get retail price only.</li><li>Only admin can delete invoices.</li><li>Admin and staff can create invoices; editing can be permission-controlled in final rollout.</li></ul></div></div>
<div class="card" style="margin-top:20px;"><h3>Invoice Preview</h3><div class="invoice">
<h2>SHAHANA VEGETABLES</h2><p>near police station, courtroad, alathur, palakkad - 678541</p><p>Phone: +918089535189 | Email: shahanastoresalathur@gmail.com</p><hr>
<p><strong>Customer Name:</strong> ____________________</p><p><strong>Phone:</strong> ____________________</p><p><strong>Billed By:</strong> <?php echo htmlspecialchars($user['full_name']); ?></p>
<div class="table-wrap"><table><tr><th>Item</th><th>Qty/Kg</th><th>Price</th><th>Total</th></tr><tr><td>Tomato</td><td>10 Kg</td><td>₹45</td><td>₹450</td></tr></table></div>
</div></div>
</main></div></body></html>
