|
From: Phil D. <ph...@lo...> - 2014-05-23 07:16:43
|
The sales analysis manual has the example - I knew I'd written sommat up:
Automating Sales Reports
Having created reports it is possible to email sales reports to defined
recipients. A script called MailSalesReport.php is a template for doing
this. There are no links to this script and no security level is set up
for it. All that is required is to save this script to another file
named anything with an extension of .php under the same directory as the
other scripts.
This script will need to be edited with the email addresses of the
people to receive the report and the reportID - the system generated
report number to be run. The lines to edit are:
/*The Sales report to send */
$ReportID = 4;
/*The people to receive the emailed report */
$Recipients = array('"Root" ','"some one else" ');
The lines surrounded by /* and */ are comments.
Once edited to the ReportID or choice and the Recipients all entered the
file should be saved.
To schedule the report to run an entry in crontab under a linux
installation that would send the report at 0:0 each week day (assuming
wget is installed in /usr/bin/wget and that the web server is on the
same machine and the new script is called DailySalesReport.php) would be:
# Scheduled email of a daily sales report
0 0 * * 2-5 root /usr/bin/wget http://localhost/web-erp/DailySalesReport.php
since the page has no output - it would be pointless running it in a web
browser although it would initiate another email to the defined recipients.
A similar template script is available called MailSalesReport_csv.php
that mails the comma separated values file for a ReportID to the
Recipients defined in the script in just the same way as
MailSalesReport.php script above.
A more elegant solution to automatic emailing of sales analysis reports
is available using the report_runner.php script this script can be run
from a shell or directly from cron and takes command line parameters.
This has the advantage instead of hardcoding a number or scripts this
script can be run with the paratmers below:
-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)
[-t reporttext ] (some words you want to send with the report-optional)
[ -H weberpHOME] (the home directory for weberp - or edit the php file)
Phil
Phil Daintree
Logic Works Ltd - +64 (0)275 567890
http://www.logicworks.co.nz
On 23/05/14 14:08, Pak Ricard wrote:
> Hi all:
>
> I'm facing some performance issues with my installation, mainly because
> of some batch processes using a lot of resources. Every morning we
> launch a custom script to optimize stock in every location, and do
> around 150 business checks and send emails to everyone concerned in the
> team, so the first one opening webERP every morning launches the script
> automatically (as the DB optimization fucntion does.)
>
> Used to work great but now it's taking too much time and shared
> resources at the hosting space. I would like to split it in several
> tasks launched by cron job, but problem is I have no idea how to write a
> webERP script that is able to be launched by cron.
>
> Does someone have a sample that could be used as a template?
>
> Many thanks!
>
> Regards,
> Ricard
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
>
>
>
> _______________________________________________
> Web-erp-developers mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/web-erp-developers
|