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='Berkshire' ORDER BY q.id DESCArray
(
[keyword] => pre-purchase-roof-inspections
[location] => Shaw - Berkshire
[region] => Berkshire
)
Array
(
[0] => Array
(
[id] => 4055
[ref] => RG423UB-THO-4055
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flat Roof
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Dave Thorley
[address] => Kent Folly, Warfield
[service_place] => Warfield
[region] => Berkshire
[user] => DSI Services (Reports)
)
[1] => Array
(
[id] => 3937
[ref] => RG427AE-RED-3937
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Flat Roof
[roof_height] => Single level building
[job_type] => 13
[job_status] => Completed
[customer_name] => Michelle Reddick
[address] => Larkfield Close Winkfield Row Bracknell Ascot
[service_place] => Ascot
[region] => Berkshire
[user] => DSI Services (Reports)
)
[2] => Array
(
[id] => 3916
[ref] => SL15UH-FLI-3916
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Matthew Flint
[address] => Two Mile Dr, Slough
[service_place] => Slough
[region] => Berkshire
[user] => DSI Services (Reports)
)
[3] => Array
(
[id] => 3695
[ref] => RG145HP-HUG-3695
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 1 bedroom
[roof_height] => High rise
[job_type] => 13
[job_status] => Completed
[customer_name] => Ben Hughes
[address] => Flat 12 Nicholas Wharf West Mills Newbury
[service_place] => Newbury
[region] => Berkshire
[user] => Mayowa Olaleye Surveyor
)
[4] => Array
(
[id] => 3500
[ref] => RG424UR-DEA-3500
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Kevin Dean
[address] => Matthews Chase, Binfield, Bracknell
[service_place] => Bracknell
[region] => Berkshire
[user] => DSI Services (Reports)
)
[5] => Array
(
[id] => 3324
[ref] => GU149RP-WIL-3324
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Tony Willcox
[address] => The Birches Farnborough
[service_place] => Farnborough
[region] => Berkshire
[user] => DSI Services (Reports)
)
[6] => Array
(
[id] => 3019
[ref] => RG206NJ-BOS-3019
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => Small Commercial
[roof_height] => Other
[job_type] => 13
[job_status] => Completed
[customer_name] => Cat Boslem
[address] => COMPTON SURGERY Compton, Newbury
[service_place] => Newbury
[region] => Berkshire
[user] => DSI Services (Reports)
)
[7] => Array
(
[id] => 2629
[ref] => RG129PS-STE-2629
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 4 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Shelley Stephens
[address] => Pankhurst Dr, Bracknell
[service_place] => Bracknell
[region] => Berkshire
[user] => Mayowa Olaleye Surveyor
)
[8] => Array
(
[id] => 2555
[ref] => RG304NE-CRO-2555
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 3 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Duane Cronje
[address] => Combe Rd, Tilehurst, Reading
[service_place] => Reading
[region] => Berkshire
[user] => DSI Services (Reports)
)
[9] => Array
(
[id] => 2119
[ref] => RG72PR-OSB-2119
[job_desc] => Drone Roof Inspections and Surveys
[roof_size] => 5 bedrooms
[roof_height] => 2 storeys
[job_type] => 13
[job_status] => Completed
[customer_name] => Alan Osbourne
[address] => The Chestnuts Silchester, Reading
[service_place] => Reading
[region] => Berkshire
[user] => DSI Services (Reports)
)
)
Berkshire - Shaw - Berkshire
Flat Roof/Single level building - Kent Folly, Warfield
Inspection: Pre-Purchase Roof Inspections
Berkshire - Shaw - Berkshire
Flat Roof/Single level building - Larkfield Close Winkfield Row Bracknell Ascot
Inspection: Pre-Purchase Roof Inspections
Berkshire - Shaw - Berkshire
3 bedrooms/2 storeys - Two Mile Dr, Slough
Inspection: Pre-Purchase Roof Inspections