SELECT
q.id,
q.ref,
q.job_desc,
q.roof_size,
q.roof_height,
q.job_type,
(SELECT status
FROM tracker_quote_status
WHERE id = q.quote_status) AS job_status,
CONCAT(c.fname, ' ', c.sname) AS customer_name,
TRIM(REGEXP_REPLACE(
CASE
WHEN q.existing = 0 THEN
CONCAT_WS(' ', c.street, c.street2, c.town, c.county)
ELSE
CONCAT_WS(' ', q.street, q.street2, q.town, q.county)
END,
'^[0-9]+\s*',
''
)) AS address,
CASE
WHEN q.existing = 0 THEN c.town
ELSE q.town
END AS service_place,
CASE
WHEN q.existing = 0 THEN
(SELECT region FROM places_uk WHERE place = c.town LIMIT 1)
ELSE
(SELECT region FROM places_uk WHERE place = q.town LIMIT 1)
END AS region,
CASE
WHEN JSON_CONTAINS(q.rooferID, '417') THEN 'Mayowa Olaleye Surveyor'
WHEN JSON_CONTAINS(q.rooferID, '428') THEN 'DSI Services (Reports)'
ELSE ''
END AS user
FROM tracker_quotes q
INNER JOIN tracker_customers c
ON q.customerID = c.id
WHERE
(
JSON_CONTAINS(q.rooferID, '417')
OR JSON_CONTAINS(q.rooferID, '428')
)
AND q.deleted_at IS NULL
AND q.job_type IN (13,36)
AND q.quote_status=4 HAVING region='Kent' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Shadoxhurst - Kent
[region] => Kent
)
Array
(
[0] => Array
(
[id] => 4108
[ref] => B689UJ-SHA-4108
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Nouman Shafiq
[address] => a Victoria Rd, Oldbury
[service_place] => Oldbury
[region] => Kent
[user] => DSI Services (Reports)
)
[1] => Array
(
[id] => 4096
[ref] => LS64HW-POO-4096
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Jonathan Poole
[address] => Monk Bridge Terrace, Meanwood, Leeds
[service_place] => Leeds
[region] => Kent
[user] => Mayowa Olaleye Surveyor
)
[2] => Array
(
[id] => 3987
[ref] => CT88FH-DAH-3987
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flats (2+)
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Jon Dahms
[address] => Sea Sky House, 8 Westfield Road, Westgate On Sea
[service_place] => Westgate On Sea
[region] => Kent
[user] => DSI Services (Reports)
)
[3] => Array
(
[id] => 3524
[ref] => LS158PA-NEE-3524
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Michelle Needham
[address] => Lulworth Cres, Leeds
[service_place] => Leeds
[region] => Kent
[user] => DSI Services (Reports)
)
[4] => Array
(
[id] => 3457
[ref] => B688PE-GRI-3457
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Paul Griffin
[address] => Leahouse Rd, Oldbury
[service_place] => Oldbury
[region] => Kent
[user] => Mayowa Olaleye Surveyor
)
[5] => Array
(
[id] => 3391
[ref] => LS252EW-LLE-3391
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Andrew Llewellyn
[address] => The Garth, Garforth, Leeds
[service_place] => Leeds
[region] => Kent
[user] => DSI Services (Reports)
)
[6] => Array
(
[id] => 3288
[ref] => OX201UN-GRI-3288
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 5 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Carl Giffen
[address] => Oxford Rd Woodstock
[service_place] => Woodstock
[region] => Kent
[user] => Mayowa Olaleye Surveyor
)
[7] => Array
(
[id] => 3016
[ref] => CT92EB-HIN-3016
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flats
[roof_height] => Other
[job_type] => 13
[job_status] => Completed
[customer_name] => Rebecca Hindmarsh
[address] => Flat 5 4 Edgar Road Cliftonville
[service_place] => Cliftonville
[region] => Kent
[user] => DSI Services (Reports)
)
[8] => Array
(
[id] => 2697
[ref] => CT51PG-DAW-2697
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Small Commercial
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => STEPHEN DAWSON
[address] => The Scout Hut All Saints Churchyard Whitstable
[service_place] => Whitstable
[region] => Kent
[user] => DSI Services (Reports)
)
[9] => Array
(
[id] => 2598
[ref] => CT117DF-VAN-2598
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Navarapman Vanitharan
[address] => a W Dumpton Ln, Ramsgate
[service_place] => Ramsgate
[region] => Kent
[user] => Mayowa Olaleye Surveyor
)
[10] => Array
(
[id] => 2050
[ref] => DA12HJ-WAT-2050
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Brian Wates
[address] => West Hill, Dartford
[service_place] => Dartford
[region] => Kent
[user] => DSI Services (Reports)
)
[11] => Array
(
[id] => 2048
[ref] => LS158ED-WIL-2048
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Scott Williams
[address] => Chestnut Ave Leeds
[service_place] => Leeds
[region] => Kent
[user] => Mayowa Olaleye Surveyor
)
)
Kent - Shadoxhurst - Kent
3 bedrooms/2 storeys - a Victoria Rd, Oldbury
Inspection: Pre-Purchase Roof Inspections
Kent - Shadoxhurst - Kent
4 bedrooms/3 storeys - Monk Bridge Terrace, Meanwood, Leeds
Inspection: Pre-Purchase Roof Inspections
Kent - Shadoxhurst - Kent
Flats (2+)/3 storeys - Sea Sky House, 8 Westfield Road, Westgate On Sea
Inspection: Pre-Purchase Roof Inspections