prepare("SELECT COUNT(*) FROM service_requests WHERE dealer_id = ? AND status = 'pending'"); $stmt_pending_requests->execute([$dealer_id]); $pending_requests_count = $stmt_pending_requests->fetchColumn(); // Fetch unactivated warranties $stmt_unactivated_warranties = $pdo->prepare("SELECT COUNT(*) FROM sold_serials WHERE dealer_id = ? AND is_activated = FALSE"); $stmt_unactivated_warranties->execute([$dealer_id]); $unactivated_warranties_count = $stmt_unactivated_warranties->fetchColumn(); // Fetch total products $stmt_products = $pdo->query("SELECT COUNT(*) FROM products"); $products_count = $stmt_products->fetchColumn(); } catch (PDOException $e) { // For simplicity, we'll just display 0 if there's a db error. $pending_requests_count = 0; $unactivated_warranties_count = 0; $products_count = 0; $open_invoices_count = 0; $total_due = 0; } // Fetch open invoices summary try { $user_id = $_SESSION['user_id']; $is_admin = $_SESSION['is_admin'] ?? false; $sql = "SELECT COUNT(*) as count, SUM(total_amount) as total FROM invoices WHERE status = 'open'"; $params = []; if (!$is_admin) { $sql .= " AND dealer_id = ?"; $params[] = $user_id; } $stmt_invoices = $pdo->prepare($sql); $stmt_invoices->execute($params); $invoices_summary = $stmt_invoices->fetch(); $open_invoices_count = $invoices_summary['count'] ?? 0; $total_due = $invoices_summary['total'] ?? 0; } catch (PDOException $e) { $open_invoices_count = 0; $total_due = 0; } ?>
Pending Service Requests

View Details
Unactivated Warranties

Register Now
Total Products

Browse Catalog
Open Invoices

Total Due: $

View Invoices

Sensa Core Dealer Portal

Welcome to the central hub for sales, service, and finance operations. Manage your orders, register warranties, and track service requests all in one place.