"Fossies" - the Fresh Open Source Software Archive

Member "mrbs-1.9.2/help_report.html" (14 Oct 2020, 8443 Bytes) of package /linux/www/mrbs-1.9.2.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the mrbs-1.9.2.tar.gz project site itself.

NAME

report.php - produce MRBS reports

SYNOPSIS

report.php [args]

where args is a space separated list of arguments of the form param1=value1&param2=value2. Spaces in the value string and ampersands can normally be escaped with the backslash character ('\'), depending on the shell. Array parameters can be sent by using the '[]' notation, eg param1[]=valueA&param1[]=valueB. Array parameters must all appear in the same argument.

DESCRIPTION

This page describes how to use MRBS reporting from the command line (CLI). Report.php can either be called directly or as a cron job. The script report.php should be called as a parameter to the PHP interpreter. The output of report.php is sent to STDOUT.

The language and locale used for the reports is specified by the config variable $cli_language. The script can only be run from the command line if the MRBS config variable $allow_cli is set to TRUE.

OPTIONS

output The type of output to produce. Permitted values are:
0A report (default)
1A summary
output_format The format that the output should be produced in. Permitted values are:
0HTML (default except when running from the CLI)
1CSV (default when running from the CLI)
2iCalendar (.ics file) report - excluding periods (cannot be used for summaries)
day The day (1..31) to use as the base date for the reporting period. If any of day, week and month are not specified then today's date will be used as the base date.
month The month (1..12) to use as the base date for the reporting period. If any of day, week and month are not specified then today's date will be used as the base date.
year The year (4 digits) to use as the base date for the reporting period. If any of day, week and month are not specified then today's date will be used as the base date.
from_date The start date of the reporting period in YYYY-MM-DD format. If from_date is not specified then the base date will be used.
to_date The end date of the reporting period in YYYY-MM-DD format. If to_date is not specified then the base date + $default_report_days (specified in systemdefaults.inc.php and optionally over-ridden in config.in.php) will be used. Note that the reporting period ends at 0000 on the to_day, so if for example you want a report for all bookings in 2019 the to_date should be 2020-01-01.
creatormatch Limit the report to entries where the creator's user name contains the string.
areamatch Limit the report to entries where the area name contains the string.
roommatch Limit the report to entries where the room name contains the string.
namematch Limit the report to entries where the entry name contains the string.
descrmatch Limit the report to entries where the description contains the string.
typematch[] Limit the report to entries of types X,Y,Z (eg typematch[]=X&typematch[]=Y&typematch[]=Z). Default: all types.
match_approved Limit the report to entries that are/are not approved. Permitted values are:
0Awaiting approval
1Approved
2All entries (default)
match_confirmed Limit the report to entries that are tentative or confirmed. Permitted values are:
0Tentative
1Confirmed
2All entries (default)
match_private Limit the report to entries that are private or public. Permitted values are:
0Private
1Public
2All entries (default)
sortby Permitted values are:
rsort by room name (default)
ssort by start time
sumby The field to use for the first column of the summary table. Permitted values are:
dbrief description (default)
ccreator's user name
ttype
phase The phase of report production. Phase 1 is the gathering of user input from the web page form; Phase 2 is the production of the report or summary. When running from the command line it is not necessary to set this option as it is automatically set to 2 by MRBS. However when running report.php from the web browser or by using wget, setting phase=2 will force report.php to go straight to the production of a report.
custom Custom fields can be searched for using the same syntax as above.

RETURN VALUES

Returns 0 on success.

EXAMPLES

To produce a summary in CSV format of all bookings for 2019, arranged by the creator's name, and send the summary to the file summary.csv:

/usr/local/bin/php /home/mrbs/report.php output=1 from_date=2019-01-01 to_date=2020-01-01 sumby=c > summary.csv

The CLI output can be simulated in a browser by putting the parameters in a query string. But note that the parameter phase=2 must be added to tell MRBS that it is on the second phase of report production (the first phase is gathering the user input from the form; if report.php is called from the command line the phase is automatically set to 2). For example, to simulate the CLI command above enter into the browser (note the addition of the output_format parameter as CSV is not the default format when running from the browser):

report.php?phase=2&output=1&output_format=2&from_date=2019-01-01&to_date=2020-01-01&sumby=c

When using wget, don't forget to escape ampersands with a backslash. For example:

wget -O myreport.csv http://localhost/mrbs/report.php?phase=2\&output=1\&output_format=2\&sumby=c