update vehicle trips report to include trip duration and distance

This commit is contained in:
wayanrivan
2026-07-07 12:54:42 +07:00
parent 39dbdf1795
commit 07092134e3
2 changed files with 27 additions and 27 deletions

View File

@ -177,13 +177,13 @@ class ReportsController extends Controller
tm.total_mileage, total_trip,
vt.name as type_name,
ROW_NUMBER() OVER (PARTITION BY t.id ORDER BY t.start) AS trip_id,
tgt.latitude,
tgt.longitude
-- 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
-- LEFT JOIN t_gps_tracks tgt ON t.vhc_id = tgt.vhc_id
WHERE
t.start BETWEEN ? AND ?
and (? IS NULL or t.id = ?)