query("SELECT * FROM outlets ORDER BY name")->fetchAll(); } else { $stmt = $pdo->prepare(" SELECT o.* FROM outlets o JOIN user_outlets uo ON o.id = uo.outlet_id WHERE uo.user_id = ? ORDER BY o.name "); $stmt->execute([$currentUser['id']]); $outlets = $stmt->fetchAll(); } $outlet_id = isset($_GET['outlet_id']) ? (int)$_GET['outlet_id'] : (count($outlets) > 0 ? (int)$outlets[0]['id'] : 1); // Security check: ensure user has access to this outlet if (!has_permission('all')) { $has_access = false; foreach ($outlets as $o) { if ($o['id'] == $outlet_id) { $has_access = true; break; } } if (!$has_access && count($outlets) > 0) { $outlet_id = (int)$outlets[0]['id']; } } $categories = $pdo->query("SELECT * FROM categories ORDER BY sort_order")->fetchAll(); $all_products = $pdo->query("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id")->fetchAll(); $payment_types = $pdo->query("SELECT * FROM payment_types WHERE is_active = 1 ORDER BY id")->fetchAll(); // Fetch variants $variants_raw = $pdo->query("SELECT * FROM product_variants ORDER BY price_adjustment ASC")->fetchAll(); $variants_by_product = []; foreach ($variants_raw as $v) { $variants_by_product[$v['product_id']][] = $v; } $table_id = $_GET['table'] ?? '1'; // Default table $settings = get_company_settings(); $order_type = $_GET['order_type'] ?? 'takeaway'; $current_outlet_name = 'Unknown Outlet'; foreach ($outlets as $o) { if ($o['id'] == $outlet_id) { $current_outlet_name = $o['name']; break; } } // Fetch Loyalty Settings $loyalty_stmt = $pdo->query("SELECT * FROM loyalty_settings WHERE id = 1"); $loyalty_settings = $loyalty_stmt->fetch(PDO::FETCH_ASSOC); if (!$loyalty_settings) { $loyalty_settings = ['is_enabled' => 0, 'points_per_order' => 0, 'points_for_free_meal' => 0]; } ?> <?= htmlspecialchars($settings['company_name']) ?> - POS
Categories
...
SALE
Stock:

Options
> > >
Loyalty Points 0

Cart is empty

Subtotal
VAT (%)
+
Total
View Only Mode
Powered By Abidarcafe @2026