update vehicle trips report to include trip duration and distance
This commit is contained in:
@ -176,11 +176,14 @@ class ReportsController extends Controller
|
||||
t.*,
|
||||
tm.total_mileage, total_trip,
|
||||
vt.name as type_name,
|
||||
ROW_NUMBER() OVER (PARTITION BY t.id ORDER BY t.start) AS trip_id
|
||||
ROW_NUMBER() OVER (PARTITION BY t.id ORDER BY t.start) AS trip_id,
|
||||
tgt.latitude,
|
||||
tgt.longitude
|
||||
FROM trips t
|
||||
JOIN TotalMileage tm ON t.id = tm.id
|
||||
LEFT JOIN t_vehicles tvt ON tvt.id = t.vhc_id
|
||||
LEFT JOIN t_vehicles_cats vt ON vt.id = tvt.cat_id
|
||||
LEFT JOIN t_gps_tracks tgt ON t.vhc_id = tgt.vhc_id
|
||||
WHERE
|
||||
t.start BETWEEN ? AND ?
|
||||
and (? IS NULL or t.id = ?)
|
||||
|
||||
Reference in New Issue
Block a user