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='Cornwall' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Sharptor - Cornwall
[region] => Cornwall
)
Array
(
[0] => Array
(
[id] => 3807
[ref] => TR112NB-PET-3807
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Camilla Peters
[address] => Frobisher Terrace, Falmouth
[service_place] => Falmouth
[region] => Cornwall
[user] => DSI Services (Reports)
)
[1] => Array
(
[id] => 3482
[ref] => S80XF-PUL-3482
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Medium Commercial
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Leigh Pullen
[address] => Bestway Wholesalers 5 Broadfield Ct, Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => DSI Services (Reports)
)
[2] => Array
(
[id] => 3438
[ref] => S62WY-SEY-3438
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Sally Seymour
[address] => Carr Road Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[3] => Array
(
[id] => 3437
[ref] => S62PS-SEY-3437
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Sally Seymour
[address] => Lonsdale Rd, Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[4] => Array
(
[id] => 3369
[ref] => S80BE-HOL-3369
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Kevan Holden
[address] => Strelley Avenue Beauchief Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[5] => Array
(
[id] => 3356
[ref] => N183BA-HYL-3356
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Large Commercial
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Ellen Hyland
[address] => B1- B4 Edmonton Ind Estate Nobel Road Edmonton
[service_place] => Edmonton
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[6] => Array
(
[id] => 3114
[ref] => BD30PR-MCC-3114
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Garage
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Rebecca Mccreath
[address] => Heath Rd, Bradford
[service_place] => Bradford
[region] => Cornwall
[user] => DSI Services (Reports)
)
[7] => Array
(
[id] => 2640
[ref] => PL145DA-KEE-2640
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Deborah Keeble
[address] => Eastleigh Fore St, St Cleer, Liskeard
[service_place] => Liskeard
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[8] => Array
(
[id] => 2499
[ref] => S50GF-AKT-2499
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Sharmeem Akter
[address] => 114 Beck Road Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => DSI Services (Reports)
)
[9] => Array
(
[id] => 2450
[ref] => S64LG-WIL-2450
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Vicky Wilkins
[address] => Hawthorn Road Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => DSI Services (Reports)
)
[10] => Array
(
[id] => 2409
[ref] => S72EN-PET-2409
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Gemma Petty
[address] => Glenorchy Road Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[11] => Array
(
[id] => 2332
[ref] => S72QD-BRO-2332
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 1 bedroom
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Leigh Brown
[address] => Abbeydale Road Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => Mayowa Olaleye Surveyor
)
[12] => Array
(
[id] => 2257
[ref] => BD157NQ-MAM-2257
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Small Commercial
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Usman Mamood
[address] => Saffron Drive Allerton Bradford
[service_place] => Bradford
[region] => Cornwall
[user] => DSI Services (Reports)
)
[13] => Array
(
[id] => 2157
[ref] => S61HX-OSM-2157
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Ilir Osmani
[address] => Lyminster Rd Sheffield
[service_place] => Sheffield
[region] => Cornwall
[user] => DSI Services (Reports)
)
[14] => Array
(
[id] => 2115
[ref] => CF312HL-THO-2115
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Hayley Thomas
[address] => Hunters Ridge Brackla Bridgend
[service_place] => Bridgend
[region] => Cornwall
[user] => DSI Services (Reports)
)
)
Cornwall - Sharptor - Cornwall
4 bedrooms/2 storeys - Frobisher Terrace, Falmouth
Inspection: Pre-Purchase Roof Inspections
Cornwall - Sharptor - Cornwall
Medium Commercial/2 storeys - Bestway Wholesalers 5 Broadfield Ct, Sheffield
Inspection: Pre-Purchase Roof Inspections
Cornwall - Sharptor - Cornwall
3 bedrooms/2 storeys - Carr Road Sheffield
Inspection: Pre-Purchase Roof Inspections