'Unauthorized access.']); exit; } try { // إحصائيات مالية عامة $stmt = $con->prepare(" SELECT SUM(price_for_passenger) as total_revenue, SUM(price_for_driver) as total_driver_pay, SUM(price_for_passenger - price_for_driver) as total_platform_commission, 0 as cash_payments, 0 as digital_payments FROM ride WHERE status = 'Finished' "); $stmt->execute(); $stats = $stmt->fetch(PDO::FETCH_ASSOC); echo json_encode([ 'status' => 'success', 'data' => $stats ]); } catch (Exception $e) { http_response_code(500); echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); } ?>