vitalidze / traccar-web

Traccar Web UI mod
http://traccar.litvak.su/
151 stars 145 forks source link

Get millage report between 7:00am - 7:00pm during a month, possible? #1223

Open quantumapps0 opened 5 years ago

quantumapps0 commented 5 years ago

Dear Sir,

Thank you for your services. I would like to get a report for vehicles for a period of the month but only between 7:00 am - 7:00 pm (19:00). Unfortunately, with the current version, I'm not able to do that. Is there any solution for that, is there any query I can run on MySQL that calculates for me this? Please, anything would be helpful as I urgently need this.

Kind regards,

vitalidze commented 5 years ago

Not sure why you need it and why the report for a month does not work. I don't know an SQL query to run it because it needs to calculate distance between positions loaded from DB. In theory you can run 30/31 reports and then combine them somehow. You can do it via the /traccar/report endpoint by supplying there a JSON with report parameters. I cannot quickly give you an exact structure, but you can definitely reverse engineer it in your web browser console if you run a report for the desired period of time just once.

quantumapps0 commented 5 years ago

Dear Vitalidze,

The reason our working time is 7:00 - 19:00, after that drivers brig their vehicles to home. Since I'm providing them fuel based on millage detail. I want to filter out only working hours between this period only because of the vehicles used after working time for personal uses which is not my responsibility. So, now I have to run 30/31 reports and Sum them per each vehicle which takes a lot of time because the number of vehicles exceeds 100.

If in any way this is possible, I'm ready. Thanks for your help.

vitalidze commented 5 years ago

As I said you can run these 30/31 reports programmatically for all your vehicles and then process them with some application. This is the only doable way without changing the Traccar code.

quantumapps0 commented 5 years ago

Let's leave the traccar code, I only need a query to calculate the millage between a period. I'm familiar to MySQL and PHP and HTML, I can create a view and get my report also I can implement it in an interface. But all I need an algorithm or a QUERY to calculate the millage inside MySQL. Thanks