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='Devon' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Shaldon - Devon
[region] => Devon
)
Array
(
[0] => Array
(
[id] => 4074
[ref] => PR16EL-PAT-4074
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Mehzabin Patel
[address] => Ramsey Avenue Preston
[service_place] => Preston
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[1] => Array
(
[id] => 3975
[ref] => EX24AS-THO-3975
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Ian Thomson
[address] => Colleton Hill, Exeter
[service_place] => Exeter
[region] => Devon
[user] => DSI Services (Reports)
)
[2] => Array
(
[id] => 3902
[ref] => PR16HX-HET-3902
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Nish Hetko
[address] => Manor House Cres, Preston
[service_place] => Preston
[region] => Devon
[user] => DSI Services (Reports)
)
[3] => Array
(
[id] => 3880
[ref] => TN240QW-DIL-3880
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Yvonne Dillon
[address] => Fir Ct, Hythe Rd, Willesborough, Ashford
[service_place] => Ashford
[region] => Devon
[user] => DSI Services (Reports)
)
[4] => Array
(
[id] => 3862
[ref] => EX153AR-KUT-3862
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Medium Commercial
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Muneer Kutty
[address] => Kent Farm Care Home Mill St, Uffculme, Cullompton
[service_place] => Cullompton
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[5] => Array
(
[id] => 3810
[ref] => TN240XD-DOU-3810
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Robert Doughty
[address] => Duckworth Close Willesborough Ashford
[service_place] => Ashford
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[6] => Array
(
[id] => 3730
[ref] => EX201EE-HAL-3730
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => James Hall
[address] => Leeze Park Okehampton
[service_place] => Okehampton
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[7] => Array
(
[id] => 3690
[ref] => EX215NW-CLA-3690
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Martin Clayton
[address] => The Old School East Street Sheepwash, Beaworthy
[service_place] => Beaworthy
[region] => Devon
[user] => DSI Services (Reports)
)
[8] => Array
(
[id] => 3676
[ref] => PL75HL-DAW-3676
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flat Roof
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Jan Dawson
[address] => , Trethewey Gardens. Wotter
[service_place] => Wotter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[9] => Array
(
[id] => 3616
[ref] => EX24LU-LEW-3616
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Tom Lewis
[address] => West Grove Rd, Exeter
[service_place] => Exeter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[10] => Array
(
[id] => 3368
[ref] => RH117BB-ZOR-3368
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flats
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Louise Zorgji
[address] => Wilton House Ifield Rd, Crawley
[service_place] => Crawley
[region] => Devon
[user] => DSI Services (Reports)
)
[11] => Array
(
[id] => 3270
[ref] => FY41HL-ENG-3270
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 6 Bedroom and above
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Chris Engel
[address] => Brighton Avenue Blackpool
[service_place] => Blackpool
[region] => Devon
[user] => DSI Services (Reports)
)
[12] => Array
(
[id] => 3268
[ref] => EX24AA-PRI-3268
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Edward Price
[address] => Victory House Exeter
[service_place] => Exeter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[13] => Array
(
[id] => 3263
[ref] => EX44DA-FAU-3263
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Tony Faust
[address] => St. Davids Hill, Exeter
[service_place] => Exeter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[14] => Array
(
[id] => 3166
[ref] => TQ26BB-FOL-3166
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Paul Follon
[address] => Goshen Rd, Torquay
[service_place] => Torquay
[region] => Devon
[user] => DSI Services (Reports)
)
[15] => Array
(
[id] => 2932
[ref] => TQ124SQ-PEA-2932
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Large Commercial
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Kara Pearson
[address] => M B Aerospace Newton Abbot
[service_place] => Newton Abbot
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[16] => Array
(
[id] => 2860
[ref] => PL52PJ-LAW-2860
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Ian Lawson
[address] => Budshead Rd, Plymouth
[service_place] => Plymouth
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[17] => Array
(
[id] => 2800
[ref] => PL34EQ-MUR-2800
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Sharlene Murdoch
[address] => 54 Whittington St, Plymouth
[service_place] => Plymouth
[region] => Devon
[user] => DSI Services (Reports)
)
[18] => Array
(
[id] => 2674
[ref] => TQ139YL-MOU-2674
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Helen Mouat
[address] => Kiln Cl, Bovey Tracey, Newton Abbot
[service_place] => Newton Abbot
[region] => Devon
[user] => DSI Services (Reports)
)
[19] => Array
(
[id] => 2601
[ref] => PL36BD-PAY-2601
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 3 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => December Payne
[address] => 49 Chesterfield Road Plymouth
[service_place] => Plymouth
[region] => Devon
[user] => DSI Services (Reports)
)
[20] => Array
(
[id] => 2584
[ref] => EX67LN-VOA-2584
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Ross Voaden
[address] => Plaistow Green Bridford, Exeter
[service_place] => Exeter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[21] => Array
(
[id] => 2564
[ref] => EX48LH-COL-2564
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 2 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Elena Collier
[address] => Excalibur Close Exeter
[service_place] => Exeter
[region] => Devon
[user] => DSI Services (Reports)
)
[22] => Array
(
[id] => 2097
[ref] => EX24TA-COS-2097
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Daniela Costantini
[address] => Magdalen Road Exeter
[service_place] => Exeter
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
[23] => Array
(
[id] => 2051
[ref] => TN234RH-BAR-2051
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Jacob Barker
[address] => Jemmett Rd Ashford
[service_place] => Ashford
[region] => Devon
[user] => Mayowa Olaleye Surveyor
)
)
Devon - Shaldon - Devon
4 bedrooms/2 storeys - Ramsey Avenue Preston
Inspection: Pre-Purchase Roof Inspections
Devon - Shaldon - Devon
3 bedrooms/3 storeys - Colleton Hill, Exeter
Inspection: Pre-Purchase Roof Inspections
Devon - Shaldon - Devon
3 bedrooms/2 storeys - Manor House Cres, Preston
Inspection: Pre-Purchase Roof Inspections