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='Staffordshire' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Shareshill - Staffordshire
[region] => Staffordshire
)
Array
(
[0] => Array
(
[id] => 3904
[ref] => ST162EH-BAI-3904
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Jane Bailey
[address] => North Castle St, Stafford
[service_place] => Stafford
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[1] => Array
(
[id] => 3818
[ref] => ST170QD-FEA-3818
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => David Fearnley
[address] => Bridle Rd, Stafford
[service_place] => Stafford
[region] => Staffordshire
[user] => Mayowa Olaleye Surveyor
)
[2] => Array
(
[id] => 3718
[ref] => ST73LD-DUN-3718
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Kathleen Dunn-Smith
[address] => Mill Lane Scholar Green Stoke-on-Trent
[service_place] => Stoke-on-Trent
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[3] => Array
(
[id] => 3463
[ref] => ST86QN-SHE-3463
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Margaret Shenton
[address] => Congleton Rd Biddulph Stoke-on-Trent
[service_place] => Stoke-on-Trent
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[4] => Array
(
[id] => 3433
[ref] => DY90JZ-PAR-3433
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Nicky Parker
[address] => Brookland Rd Hagley, Stourbridge
[service_place] => Stourbridge
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[5] => Array
(
[id] => 3108
[ref] => ST47DZ-PAT-3108
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Thomas Patrick
[address] => Richmond St Stoke-on-Trent
[service_place] => Stoke-on-Trent
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[6] => Array
(
[id] => 2827
[ref] => DY83HP-POS-2827
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Miss Jayne Postings
[address] => The Broadway Stourbridge
[service_place] => Stourbridge
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[7] => Array
(
[id] => 2613
[ref] => WS110DA-JAR-2613
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Leigh Jarratt
[address] => Broad St, Cannock
[service_place] => Cannock
[region] => Staffordshire
[user] => Mayowa Olaleye Surveyor
)
[8] => Array
(
[id] => 2600
[ref] => ST27ND-GRI-2600
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Susan Griffiths
[address] => Lambourne Dr, Light Oaks, Light Oaks, Stoke-on-Trent
[service_place] => Stoke-on-Trent
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[9] => Array
(
[id] => 2583
[ref] => B773AS-THO-2583
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Lindsay Thomas
[address] => Fog Cottage. Moor Lane Amington, Tamworth
[service_place] => Tamworth
[region] => Staffordshire
[user] => DSI Services (Reports)
)
[10] => Array
(
[id] => 2470
[ref] => B775PP-SPI-2470
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Josh Spies
[address] => Brambling, Wilnecote Tamworth
[service_place] => Tamworth
[region] => Staffordshire
[user] => Mayowa Olaleye Surveyor
)
[11] => Array
(
[id] => 2464
[ref] => B772RA-BOO-2464
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Alan Booth
[address] => Allard Tamworth
[service_place] => Tamworth
[region] => Staffordshire
[user] => Mayowa Olaleye Surveyor
)
)
Staffordshire - Shareshill - Staffordshire
2 bedrooms/2 storeys - North Castle St, Stafford
Inspection: Pre-Purchase Roof Inspections
Staffordshire - Shareshill - Staffordshire
4 bedrooms/2 storeys - Bridle Rd, Stafford
Inspection: Pre-Purchase Roof Inspections
Staffordshire - Shareshill - Staffordshire
3 bedrooms/Single level building - Mill Lane Scholar Green Stoke-on-Trent
Inspection: Pre-Purchase Roof Inspections