query("SELECT COUNT(*) FROM clients")->fetchColumn(); $staff_count = db()->query("SELECT COUNT(*) FROM care_staff")->fetchColumn(); $booking_count = db()->query("SELECT COUNT(*) FROM bookings")->fetchColumn(); // Fetch upcoming compliance alerts (e.g., expiring in 90 days) $ninety_days_from_now = date('Y-m-d', strtotime('+90 days')); $compliance_alerts = db()->query("SELECT COUNT(*) FROM clients WHERE ndis_plan_end_date <= '$ninety_days_from_now'")->fetchColumn(); $worker_alerts = db()->query("SELECT COUNT(*) FROM care_staff WHERE ndis_worker_screening_expiry <= '$ninety_days_from_now' OR first_aid_expiry <= '$ninety_days_from_now'")->fetchColumn(); $total_alerts = $compliance_alerts + $worker_alerts; // Chart Data // Clients per month $clients_per_month_q = db()->query("SELECT DATE_FORMAT(created_at, '%Y-%m') as month, COUNT(*) as count FROM clients GROUP BY month ORDER BY month"); $clients_per_month = $clients_per_month_q->fetchAll(PDO::FETCH_ASSOC); $client_months = json_encode(array_column($clients_per_month, 'month')); $client_counts = json_encode(array_column($clients_per_month, 'count')); // Bookings per month $bookings_per_month_q = db()->query("SELECT DATE_FORMAT(service_date, '%Y-%m') as month, COUNT(*) as count FROM bookings GROUP BY month ORDER BY month"); $bookings_per_month = $bookings_per_month_q->fetchAll(PDO::FETCH_ASSOC); $booking_months = json_encode(array_column($bookings_per_month, 'month')); $booking_counts = json_encode(array_column($bookings_per_month, 'count')); // Billing status $billing_status_q = db()->query("SELECT billing_status, COUNT(*) as count FROM bookings GROUP BY billing_status"); $billing_status = $billing_status_q->fetchAll(PDO::FETCH_ASSOC); $billing_status_labels = json_encode(array_column($billing_status, 'billing_status')); $billing_status_counts = json_encode(array_column($billing_status, 'count')); ?>

Dashboard

Log a New Booking

Total Clients

Manage Clients →

Total Care Staff

Manage Care Staff →

Bookings Logged

View Bookings →

Compliance Alerts

View Alerts →

Clients Added Per Month

Bookings Per Month

Booking Billing Status