How To Make Sales Reports Run Automatically


There are a couple of ways actually:

1. Make a copy of the script MailSalesReport.php sale call it MailMySalesReport.php - the top part of this script has some user modifiable parameters - which are documented in the file as below:

php
The intention is that this script is called from cron at intervals defined with a command like:

/usr/bin/wget http://localhost/web-erp/MailSalesReport.php

The configuration of this script requires the id of the sales analysis report to send
and an array of the receipients */

$_GET['ReportID'] = 2;
/usr/bin/wget http://localhost/web-erp/MailSalesReport.php

$DatabaseName = 'weberp';
$Recipients = array('"Root" <root@localhost>','"' . _('someone else') . '" <someoneelese@sowhere.com>');



Now you need to set up a scheduled job using either cron if your web-host is a linux or unix machine (as 70+% are) or windows scheduler. To call the page you need to use the wget utlity program - the command to put into cron using your web-hosts cpanel or whatever utility they provide for scheduling jobs is:


/usr/bin/wget http://localhost/web-erp/MailMySalesReport.php

Method 2:


Use the report_runner.php script

this script takes a number of parameters

~ -r reportnumber (the number of the weberp report)
~ -n reportname (the name you want to give the report)
~ -e emailaddress[;emailaddress;emailaddres...] (who you want to send it to)
~ -d database name (the mysql db to use for the data for the report)
~ [-t reporttext ] (some words you want to send with the report-optional)
~ [ -H weberpHOME] (the home directory for weberp - or edit the php file)

If you wanted to email report number 5 and call it MyReport to joe@mycompany.com and fred@mycompany.com and my database is weberpdemo then you would enter the command:

path_to_webERP_install/report_runner.php -r5 -nMyReport -ejoe@mycompany.com;fred@mycompany.com -dweberpdemo -t"Please find attached MyReport"

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki