Line 129... |
Line 129... |
129 |
join view_client_site_device on (view_client_site_device.device_id = maintenance_schedule.device_id )
|
129 |
join view_client_site_device on (view_client_site_device.device_id = maintenance_schedule.device_id )
|
130 |
join (select max(maintenance_performed_id) last_maintenance from maintenance_performed group by device_id,maintenance_task_id) last_performed on maintenance_performed.maintenance_performed_id = last_performed.last_maintenance
|
130 |
join (select max(maintenance_performed_id) last_maintenance from maintenance_performed group by device_id,maintenance_task_id) last_performed on maintenance_performed.maintenance_performed_id = last_performed.last_maintenance
|
131 |
where maintenance_schedule.removed_date is null
|
131 |
where maintenance_schedule.removed_date is null
|
132 |
and <additionalWhere>
|
132 |
and <additionalWhere>
|
133 |
order by
|
133 |
order by
|
134 |
DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), now()),
|
- |
|
- |
|
134 |
|
135 |
Client,
|
135 |
Client,
|
136 |
Site,
|
136 |
Site,
|
137 |
Device,
|
137 |
Device,
|
138 |
maintenance_task.description
|
138 |
maintenance_task.description
|
139 |
EOD
|
139 |
EOD
|
140 |
// and DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), now()) <= 7
|
140 |
// DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), now()),
|
141 |
);
|
141 |
);
|
142 |
|
142 |
|
143 |
define (SQL_MAINTENANCE_REPORT, '
|
143 |
define (SQL_MAINTENANCE_REPORT, '
|
144 |
select concat( client.name, \' - \', site.name) "Site",
|
144 |
select concat( client.name, \' - \', site.name) "Site",
|
145 |
device.name "Device Name",
|
145 |
device.name "Device Name",
|