About the chart package

This package will create a chart of the daily processed emails with the help of Mercury's system.log file. The number of emails (each line in the system log is a processed email) will be counted and placed into emails.csv for the daily numbers and into total-emails.txt for the total number for each month at the end of the month. Seperate task scheduler job.
The chart is produced from the emails.csv file. 
The chart software is the non-commercial freeware from https://canvasjs.com/php-charts/chart-from-csv-data/ and consists of html and java script. 

Requirements:
a: write Mercury's system log file (Configuration > Core Module > Files > System log file) to a directory in the vhost of your Mercury Web Interface install.
b: create 3 task scheduler jobs to run 3 php scripts
c: adjust file locations in 2 files

How to install:
A: copy all files and the directory /js to your Mercury Web Interface directory

B: open count.php and adjust the date formatting (line 4) and filepath (line 6) to match your Mercury's system log file. 
https://www.php.net/manual/en/datetime.format.php For now it is assumed as d-m-y.log

C: open chart.html, go to line 27 and change the sample url to your url.

D: create 3 task scheduler jobs to run a php script, count.php, count-month.php, clear.php
count.php with a daily job at 11:59PM (suggested time)
count-month.php with a monthly job at the last day of the month at 11:59PM (suggested time)
clear.php with a monthly job at the first day of the month at 12:05AM (suggested time)

Notes when using Windows 10 Task Scheduler:
Start creating your job. Pay attention to the "Action Tab" settings.
In the "Action Tab" set the path to php.exe, add the argument and the start-in location. Below are the specific settings.
Action: Start a program 
Program/script: enter the full path to php.exe
Add Arguments: count.php
Start in: full path to count.php (sample: D:\Apache24\htdocs\your webinterface directory\)

For the other 2 php scripts create the same, just change the "Add Arguments"
Enjoy! 

Johannes
mercury@yorktondigital.ca



