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='Cheshire' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Shaw Heath - Cheshire
[region] => Cheshire
)
Array
(
[0] => Array
(
[id] => 4148
[ref] => CW82BD-CAD-4148
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => William Cadwaladr
[address] => Cherry Trees Sutton Fields Whitegate, Northwich
[service_place] => Northwich
[region] => Cheshire
[user] => Mayowa Olaleye Surveyor
)
[1] => Array
(
[id] => 3917
[ref] => CW25LP-WAR-3917
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Michael Warren
[address] => Crotia Ave, Weston, Crewe
[service_place] => Crewe
[region] => Cheshire
[user] => DSI Services (Reports)
)
[2] => Array
(
[id] => 3876
[ref] => SK44BU-WHI-3876
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Kenneth Whittick
[address] => Clifton Rd, Stockport
[service_place] => Stockport
[region] => Cheshire
[user] => DSI Services (Reports)
)
[3] => Array
(
[id] => 3574
[ref] => WA86QX-CON-3574
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Matthew Connor
[address] => Knowles St, Widnes
[service_place] => Widnes
[region] => Cheshire
[user] => DSI Services (Reports)
)
[4] => Array
(
[id] => 3548
[ref] => SK72DW-RRO-3548
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Claire Rrowbottom
[address] => Bramley Rd, Bramhall Stockport
[service_place] => Stockport
[region] => Cheshire
[user] => DSI Services (Reports)
)
[5] => Array
(
[id] => 3400
[ref] => EX165FE-HAM-3400
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Tanya Hamlett
[address] => Winder Cresent Tiverton
[service_place] => Tiverton
[region] => Cheshire
[user] => DSI Services (Reports)
)
[6] => Array
(
[id] => 3163
[ref] => SK43LD-TOO-3163
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Jess Tootle
[address] => Thornfield Road Stockport
[service_place] => Stockport
[region] => Cheshire
[user] => DSI Services (Reports)
)
[7] => Array
(
[id] => 2886
[ref] => SK44PB-THO-2886
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flats
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Mike Thorpe
[address] => Heaton Moor Rd, Stockport
[service_place] => Stockport
[region] => Cheshire
[user] => Mayowa Olaleye Surveyor
)
[8] => Array
(
[id] => 2841
[ref] => LS278DQ-KNO-2841
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => David Knox
[address] => Middleton Road, Morley
[service_place] => Morley
[region] => Cheshire
[user] => Mayowa Olaleye Surveyor
)
[9] => Array
(
[id] => 2771
[ref] => CH658HA-ROH-2771
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flats
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Amin Rohman (Homegroup)
[address] => 370 & 372 Princes Road Ellesmere Port
[service_place] => Ellesmere Port
[region] => Cheshire
[user] => Mayowa Olaleye Surveyor
)
[10] => Array
(
[id] => 2574
[ref] => SK116TG-MAC-2574
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Fraser MacFarlene
[address] => St George's Street Macclesfield
[service_place] => Macclesfield
[region] => Cheshire
[user] => DSI Services (Reports)
)
[11] => Array
(
[id] => 2359
[ref] => CH35TL-WAT-2359
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Andrea Waterman
[address] => Brookside, Great Boughton Chester
[service_place] => Chester
[region] => Cheshire
[user] => DSI Services (Reports)
)
[12] => Array
(
[id] => 2308
[ref] => CW100AT-HES-2308
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Zoe Hession
[address] => Long Lane South Middlewich
[service_place] => Middlewich
[region] => Cheshire
[user] => DSI Services (Reports)
)
)
Cheshire - Shaw Heath - Cheshire
4 bedrooms/2 storeys - Cherry Trees Sutton Fields Whitegate, Northwich
Inspection: Pre-Purchase Roof Inspections
Cheshire - Shaw Heath - Cheshire
2 bedrooms/Single level building - Crotia Ave, Weston, Crewe
Inspection: Pre-Purchase Roof Inspections
Cheshire - Shaw Heath - Cheshire
3 bedrooms/2 storeys - Clifton Rd, Stockport
Inspection: Pre-Purchase Roof Inspections