<?php
$sql="SELECT bookings.pickup_date,bookings.id AS booking_id,bookings.comments, bookings.parking,bookings.driver_id, bookings.drop_address,bookings.drop_post_code,bookings.pickup_address,bookings.pickup_post_code, bookings.waiting_charges,bookings.fare,bookings.total_fare,bookings.waiting_time, bookings.hours,bookings.mins,bookings.other,
bookings.job_status,
customers.id AS customer_id, customers.name AS customer_name,customers.address1,customers.post_code,customers.city, customers.mobile, payment_type.name AS payment_type, employees.first_name AS driver,employees.id as driver_id, vehicles.make as vehicle, company_contact.name as company_contact,company_contact.email
FROM bookings 
LEFT JOIN customers ON bookings.customer_id = customers.id 
LEFT JOIN payment_type ON bookings.payment_type = payment_type.id 
LEFT JOIN employees ON bookings.driver_id = employees.id 
LEFT JOIN vehicles ON bookings.vehicle_id = vehicles.id 
LEFT JOIN company_contact ON bookings.passenger_id = company_contact.id 
WHERE bookings.job_status=2 ORDER BY bookings.id DESC
";
?>