Page 1 of 1

Batching reports

Posted: Wed Jan 14, 2009 6:04 am
by davisty
Hello,

Is there a way to run batch reports, for example the Punch Summary report, that can be run from the job scheduler?

And is there a way to provide the date range as a parameter or something that the report would need to run properly?

Thank you in advance ...

Posted: Wed Jan 14, 2009 7:09 am
by blabj
We need this ability as well. Hopefully there is something URL accessible.

Posted: Wed Jan 14, 2009 8:02 am
by shaunw
If you have the expertise, it is possible to trigger any of the reports from just a URL alone.

Unfortunately its not an easy process at this time though.

We will be adding scheduled report functionality that can email reports to specific email addresses on demand though.

Posted: Wed Jan 14, 2009 12:27 pm
by blabj
For those of you who cannot wait (like me!) you can do the following..

Prepare the report as you want it.. and just before you submit it, start wireshark (or tshark if you prefer CLI) and capture/listen on port 80 on the server (the machine running timetrex).. then click the "Display Report" button.. and stop the capture.

Search for "x-www-form-urlencoded".. the content of this HTTP POST is your ticket.

Now you can CURL (amazingly useful tool) it from the command line in linux (is there curl for windows?? dunno)

First you login - replace the XXX and YYY below with proper user name and password.

Code: Select all

curl -D headers.txt -b headers.txt --data "user_name=XXX&password=YYY&language=en&action%3Asubmit=Submit" http://myhost.mydomain/interface/Login.php &>/dev/null
Now, you need the report URL and the FORM POST data captured above. So for example, http://myhost.mydomain/interface/report ... ftList.php

Code: Select all

curl -D headers.txt -b headers.txt --data "action%3ADisplay+Report=&generic_data%5Bname%5D=&generic_data%5Bid%5D=29&filter_data%5Bgroup_ids%5D%5B%5D=3&filter_data%5Bbranch_ids%5D%5B%5D=-1&filter_data%5Bbranch_ids%5D%5B%5D=1&filter_data%5Bdepartment_ids%5D%5B%5D=-1&filter_data%5Bpunch_branch_ids%5D%5B%5D=-1&filter_data%5Bpunch_department_ids%5D%5B%5D=-1&filter_data%5Buser_title_ids%5D%5B%5D=-1&filter_data%5Bcolumn_ids%5D%5B%5D=-1000-first_name&filter_data%5Bcolumn_ids%5D%5B%5D=-1001-last_name&filter_data%5Bcolumn_ids%5D%5B%5D=-1160-branch&filter_data%5Bcolumn_ids%5D%5B%5D=-1170-department&filter_data%5Bcolumn_ids%5D%5B%5D=-1120-type&filter_data%5Bcolumn_ids%5D%5B%5D=-1130-status&filter_data%5Bcolumn_ids%5D%5B%5D=-1100-time_stamp&filter_data%5Bcolumn_ids%5D%5B%5D=-1174-station_description&filter_data%5Bprimary_sort%5D=-1001-last_name&filter_data%5Bprimary_sort_dir%5D=1&filter_data%5Bsecondary_sort%5D=-1100-time_stamp&filter_data%5Bsecondary_sort_dir%5D=1&BUTTON=Display+Report" http://myhost.mydomain/interface/report/ActiveShiftList.php
NOTE: Everything after --data is on the same line.. the only space is before the http://

Also - the above URL is customized to MY parameters, so it will not work for you with just a copy/paste.. you have to capture your HTTP POST.

The output of this curl command is HTML which you can plop in an email... it may need scraping though.

This can be scripted.. and thrown into cron.

NOTE: An upgrade to TimeTrex *could* break this method (if they add or change anything surrounding that particular report).

-Bob

Posted: Wed Jan 14, 2009 12:39 pm
by shaunw
A slightly easier way to get the FORM variables is to use FireFox's Web Developer add-on, or edit the HTML form itself and change the POST to a GET. Then you can just copy the URL straight from your browser.

If you do modify the form to GET, you don't want to leave it that way though because the URLs may get too long and be rejected.