Personal tools
Namespaces

Variants
Actions

Report Generator 3.X For WHMCS

From ModulesGarden Wiki
(Difference between revisions)
Jump to: navigation, search
(About Report Generator For WHMCS)
Line 4: Line 4:
 
=About [http://www.modulesgarden.com/products/whmcs/report_generator/features Report Generator For WHMCS]=
 
=About [http://www.modulesgarden.com/products/whmcs/report_generator/features Report Generator For WHMCS]=
 
{|
 
{|
|style="padding: 10px 0px 5px 0px;"|'''Report Generator For WHMCS allows you to generate and manage any kind of reports using inbuilt drag & drop WYSIWYG editor.'''<br />
+
|style="padding: 10px 0px 5px 0px;"|'''Report Generator For WHMCS''' is a module that allows you to create custom reports using SQL query builder and display them in tables and graphs.<br />
Module lets you to adjust reports to your needs through using various filters, conditions and even your own PHP code. You can display ready reports in tables, graphs or charts.<br />
+
You can also generate report in XML or PDF and send it over email to specified staff members.
You can also generate reports in XML, CSV and PDF, as well as schedule their creating and send them over an email to specified staff members.
+
 
|}
 
|}
*'''Features:'''
+
 
 +
*'''Admin Area Features:'''
 
{|
 
{|
|style="padding: 10px 0px 0px 30px;"|✔ Query Builder For Dynamic Reports Creating
+
|style="padding: 10px 0px 0px 30px;"|✔ Drag & Drop WYSIWYG Report Builder
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 0px 30px;"|✔ Full Support For Reports Editing
+
|style="padding: 0px 0px 0px 30px;"|✔ Dynamic Reports Editing
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Report Types(Data Table, Pie Chart, Area Chart, Column Chart)
 
|}
 
|}
 
{|
 
{|
Line 19: Line 22:
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 0px 30px;"|✔ Multi Sections Of Dynamically Generated Reports
+
|style="padding: 0px 0px 0px 30px;"|✔ User Created Reports
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Multi-Sections Of Dynamically Generated Reports
 
|}
 
|}
 
{|
 
{|
 
|style="padding: 0px 0px 0px 30px;"|✔ Dynamic Filters
 
|style="padding: 0px 0px 0px 30px;"|✔ Dynamic Filters
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Predefined SQL Expressions At The Report Builder
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Multiple Joins At The Report Builder
 
|}
 
|}
 
{|
 
{|
Line 28: Line 40:
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 0px 30px;"|✔ Print Reports
+
|style="padding: 0px 0px 0px 30px;"|✔ Print Reports With Print Preview
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Schedule Automatic Reports Sending To Chosen Staff Members With Specified Conditions
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Export To CSV, XML and XML Structure
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Export To CSV From Report View - Allows You To Set Up Undefault Value Of Filter
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Import From The XML Structure
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ Generate PDF - Both Manually And By Cron Job
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 0px 30px;"|✔ Automatic Reports Sending To Desired Staff Members, With Specified User Conditions
+
|style="padding: 0px 0px 0px 30px;"|✔ Translation Of Database Columns And Tables From The Settings Tab
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 0px 30px;"|✔ Export To And Import From The XML
+
|style="padding: 0px 0px 10px 30px;"|✔ Enable Unicode Font For Generated PDF
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 10px 30px;"|✔ Export To PDF
 
 
|}
 
|}
 
*'''Additionally:'''
 
*'''Additionally:'''
Line 44: Line 70:
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 30px;"|✔ Supports WHMCS V5 and Later
+
|style="padding: 0px 0px 0px 30px;"|✔ Supports WHMCS V5 and Later
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ User-Friendly Interface
 +
|}
 +
{|
 +
|style="padding: 0px 0px 10px 30px;"|✔ Migration Tool
 +
|}
 +
*'''User Created Reports:'''
 +
{|
 +
|style="padding: 10px 0px 0px 30px;"|✔ 1. Section 1: Orders Of Services In Selected Period (Column Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 2. Section 1: Orders Of Services In Time (Column Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 3. Section 1: Orders Over The Weekdays (Pie Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 4. Section 1: Most Valuable Clients (Data Table)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 5. Section 1: User Accounts Created In Selected Period (Data Table) <br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 2: Amount Of User Accounts Created In Selected Period (Column Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 6. Section 1: Tickets Replied By Admin (Data Table) <br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 2: Tickets Replied By Admin (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 3: Tickets Replied By Admin (Pie Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 10px 30px;"|✔ 7. Section 1:  Customers Per Country (Pie Chart)
 +
|}
 +
*'''Predefined Reports:'''
 +
{|
 +
|style="padding: 10px 0px 0px 30px;"|✔ 1. Section 1: Open Tickets For The Period (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 2: New Invoices For The Period (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 3: Invoice Reminders For The Period (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 4: Hosting Renewals (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 5: Suspended Services For The Period (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 6: Domain Renewals For The Period (Data Table)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 0px 30px;"|✔ 2. Section 1: Closed/Answered Status Tickets By The Staff Member (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 2: Tickets Stats For The Staff Over Time (Area Chart)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 3: Closed To-Do List Tasks Owned By The Staff Member (Data Table)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 4: To-Do List Tasks Owned By The Staff Member Grouped By Status (Pie Chart)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 5: Orders Summary (Area Chart)
 +
|}
 +
{|
 +
|style="padding: 0px 0px 30px 30px;"|✔ 3. Section 1: Opened Tickets Stats For This Staff Over Time (Area Chart)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 2: To-Do List Tasks Owned By The Staff Member Grouped By Status (Pie Chart)<br />
 +
&nbsp;&nbsp;&nbsp;&nbsp;Section 3: Closed To-Do List Tasks Owned By The Staff Member (Data Table)
 
|}
 
|}
  
Line 56: Line 134:
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG1.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_1.png]]
 
|}
 
|}
 
{|
 
{|
Line 63: Line 141:
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG2.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_2.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|'''3. Remove all files from '' 'templates_c' ''folder.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''3. When you install Report Generator for the first time you have to rename '' 'license_RENAME.php' '' file.'''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''4. When you install Report Generator for the first time you have to rename '' 'license_RENAME.php' '' file.'''<br />
 
File is located at '' 'modules/addons/reportgenerator/license_RENAME.php' '' . Rename it from '' 'license_RENAME.php' '' to '' 'license.php' '' .
 
File is located at '' 'modules/addons/reportgenerator/license_RENAME.php' '' . Rename it from '' 'license_RENAME.php' '' to '' 'license.php' '' .
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG3.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_3.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''4. In order to configure your license key, you have to edit a previously renamed '' 'license.php' file.' '' '''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''5. In order to configure your license key, you have to edit a previously renamed '' 'license.php' file.' '' '''<br />
 
Enter your license key between quotation marks as presented on the following screen. You can find your license key at your client area'' → 'My Products' ''.  
 
Enter your license key between quotation marks as presented on the following screen. You can find your license key at your client area'' → 'My Products' ''.  
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG4.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_4.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''5. Now you have to set chmod '' '755' '' or '' '777' '' to '' 'reports_xml' '' directory.'''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''6. Now you have to set chmod '' '755' '' or '' '777' '' to all folders in '' 'storage' '' folder.'''<br />
'' 'reports_xml' '' file is located at '' 'your_whmcs/modules/addons/reportgenerator/' ''.
+
'' 'storage' '' folder is located at '' 'your_whmcs/modules/addons/reportgenerator/' ''.<br />
 +
''Note: If you set up chmods incorrectly, export report and generate PDF report functionalities will not work. ''
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG4_1.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_5.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''6. Now you have to activate the module in your WHMCS system. '''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''7. Now you have to activate the module in your WHMCS system. '''<br />
 
Log in to your WHMCS admin area. Go to '' 'Setup' '' → '' 'Addon Modules' ''. Afterwards, find '' 'Report Generator' '' and press '' 'Activate' '' button.
 
Log in to your WHMCS admin area. Go to '' 'Setup' '' → '' 'Addon Modules' ''. Afterwards, find '' 'Report Generator' '' and press '' 'Activate' '' button.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG5.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_6.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''7. In the next step you need to permit access to this module.'''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''8. In the next step you need to permit access to this module.'''<br />
 
To do so, click on '' 'Configure' '' button, tick '' 'Full Administrator' '' and press '' 'Save Changes' ''.
 
To do so, click on '' 'Configure' '' button, tick '' 'Full Administrator' '' and press '' 'Save Changes' ''.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG6.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_7.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''8. Last step is setting up cron jobs'''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''9. Last step is setting up cron jobs.'''<br />
You can find them at your module '' 'Addons' '' → '' 'Report Generator' '' → '' 'Cron Jobs' ''.
+
You can find them at your module '' 'Addons' '' → '' 'Report Generator' '' → '' 'Cron Jobs' '' → '' 'Cron Setup' ''.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG7.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_8.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|'''9. You have just successfully installed Report Generator!'''<br />
+
|style="padding: 0px 0px 15px 15px;"|'''10. You have just successfully installed Report Generator!'''<br />
 
You can access the module at '' 'Addons' '' → '' 'Report Generator' ''.
 
You can access the module at '' 'Addons' '' → '' 'Report Generator' ''.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG8.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_9.png]]
 
|}
 
|}
  
 
=Configuration and Management=
 
=Configuration and Management=
 
{|
 
{|
|style="padding: 10px 0px 30px 15px;"|'''Report Generator For WHMCS allows your to create custom reports using query builder and graphs.<br />
+
|style="padding: 10px 0px 30px 15px;"|'''Report Generator For WHMCS allows your to create custom reports using drag & drop WYSIWYG builder.<br />
Module has also additional useful features like predefined reports, import/export of reports, generating reports in PDF and ability to send it to admins.
+
Module also offers additional useful features like predefined reports, import/export of reports, generating reports in PDF, ability to send then to admins and much more.
 
|}
 
|}
  
==Report List==
+
==Reports List==
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|At '' 'Report Lists' '' you can view all predefined reports as well as those created by you.<br />
+
|style="padding: 10px 0px 15px 15px;"|At the '' 'Reports Lists' '' tab you can view all predefined reports as well as those created by you.<br />
Here you can manage your reports by viewing (1), editing (2), generating report in PDF (3), exporting to XML file (4) and removing (5).
+
Here you can manage your reports by viewing (1), editing (2) and removing them (8).<br />
 +
Additionally, you can generate PDF version of reports (3) as well as export reports to CSV (4 & 5), XML (6) and XML structure (7).  
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG9.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_10.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|For predefined reports you can only generate PDF file and view report.
+
|style="padding: 0px 0px 20px 15px;"|For predefined reports you can view report, generate PDF file and export report to CSV and XML.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG10.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_11.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|To create new report press '' 'Create New Report' '' or go to '' 'Reports List' '' → '' 'Create New Report' ''.<br />
+
|style="padding: 0px 0px 15px 15px;"|To start creation of report press '' 'Create New Report' ''.<br />
More information about creating new reports will be presented in the next section.
+
More information about creating new reports will be presented in the [[#Creating_Report|'''Creating Report''']] section.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG11.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_12.png]]
 
|}
 
|}
 
===Report View===
 
===Report View===
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|In report view you can see all tables and charts generated by the module.<br />
+
|style="padding: 10px 0px 15px 15px;"|In the report view you can see all tables and charts generated by the report.<br />
 
You can display report in a simple or widget format. To switch between them press one of the buttons marked on the screen below.
 
You can display report in a simple or widget format. To switch between them press one of the buttons marked on the screen below.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG12.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_13.png]]
 
|}
 
|}
  
 
===PDF Report View===
 
===PDF Report View===
 
{|
 
{|
|style="padding: 10px 0px 20px 15px;"|You can also view a PDF version of report which can be sent to admins or saved to PDF file on your disk.
+
|style="padding: 10px 0px 20px 15px;"|You can also view a PDF version of report which can be sent to your staff memebers or saved to PDF file on your disk.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG13.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_14.png]]
 
|}
 
|}
  
 
==Creating Report==
 
==Creating Report==
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|At the beginning you have one section in your report. Each section generates one data table and a few charts on report.<br />
+
|style="padding: 10px 0px 15px 15px;"|In this section we will show you how to prepare a few example reports.<br />
At every step of creating report you can add new sections.<br />
+
If you wish to create your own report, we strongly recommend to firstly create reports shown below in order to get some practice.<br />
Below we will show you how to set up a single section.<br />
+
First report will be quite simple and described step by step while the next ones will be more and more complex.<br />
 +
We will show you how specific options affect final report.
 +
|}
 +
===First Report - User Accounts Created===
 +
{|
 +
|style="padding: 10px 0px 15px 15px;"|At the beginning you have only one section in your report. Each section generates one chart on final report.<br />
 +
In order to create additional chart on your report you need to add a new section.<br />
 +
Below we will show you how to set up a single section. This examplary report will show all new clients which accounts was created during last month.<br />
 
Start from entering report name and description.
 
Start from entering report name and description.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG14.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_15.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Now, select desired chart type and table you want to start with.<br />
 +
As you can see, default columns was loaded. For purpose of this report we will remove them through pressing '' 'Remove All The Columns' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_16.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Adding columns to report is quite easy owing to autocomplete box.<br />
 +
Type table name and list of all available columns will show up. Now, select desired column.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_17.png]]
 
|}
 
|}
  
===Main Settings===
 
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|Firstly, select all tables you want to use in this section.<br />
+
|style="padding: 0px 0px 15px 15px;"|As you may noticed earlier, each change made affects report preview displayed below.<br />
Afterwards, tick all records from tables you want to display.<br />
+
In some situations preview may be replaced with error, which will contain information about lacking or miss-configured settings of report.<br />
If you will decide to display additional column, you can define it in '' 'Additional Columns' '' field.
+
On the following screen error message is caused by using incorrect function '' 'COUNT()' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_18.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 15px;"|To set up time period for report, go to the '' 'Conditions' '' tab and mark '' 'Filter results by date' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_19.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Afterwards, select '' 'Clients Table : datecreated' '' and '' 'Monthly' '' from marked dropdown menus.<br />
 +
Now, report will be generated using only accounts created during last 30 days.<br />
 +
''Note: Time period for report can be changed later at the report view or email configuration.''
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_20.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|You can set up ordering records by specific column. To do that, go to the '' 'Groups & Limits' '' tab.<br />
 +
We will order records by client last name. Choose '' 'Clients Table : lastname' '' and '' 'Ascending' '' as shown on the following screen.<br />
 +
Your report displaying all new accounts created during last month is ready, press '' 'Generate Report' '' to save it.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_21.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Let's view that report through pressing '' 'View' '' button.<br />
 +
As you can see, column names are names of table columns.<br />
 +
Our module allows you to easily change column names under which table columns will be displayed.<br />
 +
You will find more information about setting up custom column names at [[#Tables_And_Columns_Definitions|'''Tables And Columns Definitions''']] section.<br />
 +
While viewing report with enabled filtering by date you can easily change time periods as shown on the following screen.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 30px 25px;"|[[File:RG_22.png]]
 +
|}
 +
 
 +
===Second Report - Orders Per User===
 +
{|
 +
|style="padding: 10px 0px 15px 15px;"|This report will be counting orders made by clients this year. Due to that, we will need to use group by command to count those products.<br />
 +
As previously, start of defining report name and description. Additionally, choose report type and starting table.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_23.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Join orders table to clients table. We will need it to display columns from both tables here.<br />
 +
Press '' 'Join Another Table' '' to proceed.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_24.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|It is time to think about how we want to connect these two tables.<br />
 +
We want to display client even if he has no order, therefore from '' 'Please Specify A Join Type' '' we will choose:<br />
 +
'' 'Return all rows from the left table, even if there are no match at the right table' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_25.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|Now select two tables to join. For purpose of this report it will be tables '' 'Clients' '' and '' 'Orders' ''.<br />
 +
It is time to decide what columns will be used to join chosen columns.<br />
 +
At the table '' 'Orders' '' we can find column '' 'userid' '' in which there is stored ID of client who made an order.<br />
 +
Therefore we will join them using '' 'Clients Table : ID' '' and '' 'Orders Table : userid' ''.<br />
 +
At the end press '' 'Confirm!' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_26.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 15px 15px;"|We want to display clients details in one column and quantity of orders in another one.<br />
 +
First column will be displayed by:
 +
concat(tblclients.id, '# ', tblclients.firstname, ' ', tblclients.lastname) as Client
 +
Concat will join provided columns while '' 'Client' '' is alias for this column. Alias will be used for generated report.
 +
COUNT(*) as Orders
 +
Count along with grouping by allow us to count records for each client.
 +
Orders Table : ID as Any_Order_Exist
 +
This column was added to handle clients which does not have any orders.<br />
 +
Due to join type, '' 'COUNT(*) as Orders' '' will be filled with 1 for them.<br />
 +
Proceed to the '' 'Groups & Limits' '' tab to set up grouping by (currently our generator does not recognize what should be counted).
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG15.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_27.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|To set date used in this section of report select this record from a '' 'Date' '' dropdown menu.
+
|style="padding: 0px 0px 15px 15px;"|We want to group records by clients, therefore fill '' 'Group This Section By' '' with '' 'Clients Table : ID' '' which is unique key at the client table.<br />
 +
Additionally, let's set up sorting clients by quantity of orders, we can use column alias for this.<br />
 +
As we predicted, clients with 0 orders have assigned 1 order. Proceed to '' 'Your Own Code' '' to fix that.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG16.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_28.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|At '' 'Custom PHP Function' '' you can alter displayed result. Remember to place your code in:<br />
+
|style="padding: 0px 0px 15px 15px;"|At '' 'Your Own Code' '' tab you can modify received output.<br />
 +
Code have to be placed in delimiters as shown below.
 
  <?php  
 
  <?php  
 
  // your custom code here
 
  // your custom code here
return $result;
 
 
  ?>  
 
  ?>  
 
The '' '$result' '' variable is passed by reference and contains just iterated element of the result array.<br />
 
The '' '$result' '' variable is passed by reference and contains just iterated element of the result array.<br />
 
In this way you can create new columns in your table or modify existing ones through modifying this variable.<br />
 
In this way you can create new columns in your table or modify existing ones through modifying this variable.<br />
You can access it as normal array where the key is a column name and value is a current row value.<br />
+
You can access it as typical array where the key is a column name and value is a current row value.<br />
''Important: <span style="color:#FF0000">Use this field with caution</span>, because every mistake made here can result with <span style="color:#FF0000">error in your production environment</span>.''
+
'''Important 1: <span style="color:#FF0000">Use this field with caution</span>, because every mistake made here can result with <span style="color:#FF0000">error in your production environment</span>.'''<br />
 +
''Note: While working on $result you can use aliases!''<br />
 +
What we need to do is assigning 0 to '' 'Orders' '' column if '' 'Any_Order_Exist' '' column is empty.<br />
 +
Additionally, we are unable to remove previously added column, therefore we will display '' 'Yes/No' '' in '' 'Any_Order_Exist' '' depending on existence of any order assigned to client.<br />
 +
Code placed below will do it for you:
 +
<?php
 +
foreach($result as $element) // iterate over all records storing current row in $element variable
 +
{
 +
if($element->Any_Order_Exist=="") // check if Any_Order_Exist is empty
 +
{
 +
&nbsp;$element->Orders=0;      //assign 0 to Orders if Any_Order_Exist is empty
 +
&nbsp;$element->Any_Order_Exist='No'; //assign 'No' to Any_Order_Exist if it is empty
 +
}
 +
else  // if previous if was false, commands stored here will be ordered
 +
{
 +
&nbsp;$element->Any_Order_Exist='Yes';  //assign 'Yes' to Any_Order_Exist
 +
}
 +
}
 +
?>
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG17.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_29.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|Last step here is joining tables you added to this section as it is necessary to display the report correctly.<br />
+
|style="padding: 0px 0px 20px 15px;"|Your code is ready, press '' 'Generate Report' '' to save it.
For example, to join table '' 'tblclients' '' with '' 'tblactivitylog' '' you should join it using '' 'tblclients - id' '' and '' 'tblactivitylog- clientid' ''.<br />
+
If you have more than 2 tables in your report section, it is advised to create more join relations.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG18.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_30.png]]
 
|}
 
|}
  
===Filters===
+
===Third Report - Unpaid Invoices===
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|At '' 'Filters' '' tab you can decide which records should be displayed through setting conditions.<br />
+
|style="padding: 10px 0px 15px 15px;"|At the third report we will show you how to prepare report displaying clients with the most unpaid invoices.<br />
You can use predefined conditions. Select record to apply filter on, afterwards select '' 'Operation Type' '' and type value into '' 'Default Value' '' field.
+
We will also add second section displaying unpaid invoices which can be filtered by client first and last name.<br />
 +
Start of defining report name and description, choose report type and starting table.<br />
 +
Press '' 'Join Another Table' '' to proceed.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG19.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_31.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|You can also type your own conditions using field marked on the screen below.
+
|style="padding: 0px 0px 20px 15px;"|Now, join invoice table using '' 'Clients Table : ID' '' and '' 'Invoices Table : userid' '' and set it up to return tables only if there is a match in the invoice table.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG20.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_32.png]]
 
|}
 
|}
 +
{|
 +
|style="padding: 0px 0px 20px 15px;"|Add '' 'COUNT(*) as Sum' '' column and proceed to the '' 'Conditions' '' tab.
  
===Orders & Limits===
+
|}
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|At '' 'Order & Limits' '' tab you can set the following options: '' 'group by' '' (which is necessary if you set up '' 'Additional Fields' ''), '' 'order by' '' and limits.<br />
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_33.png]]
To set '' 'Order By' '', select record used to order by values displayed in report, afterwards select direction of ordering by (Ascending/Descending).<br />
+
You can also use custom group by command through pressing '' 'Add your own group by query' '' and typing command in textbox which will appear.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG21.png]]
+
|style="padding: 0px 0px 20px 15px;"|Press '' 'Create New Filter' '' button to define new condition for your report.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|In order to set group by, select record or time period to group by.<br />
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_34.png]]
You can also use customize order by command through pressing '' 'Add your own order by query' '' and entering command in a textbox which will appear.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG22.png]]
+
|style="padding: 0px 0px 15px 15px;"|Select column you want to define condition for, select filter operand, define default value of filter and filter friendly name.<br />
 +
Conditions can be changed at the report view, they will be displayed under friendly name defined here.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|Through setting up limits you can define time period to create a report from.<br />
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_35.png]]
To do it, simply enter a time period (in days) to create a report from.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG23.png]]
+
|style="padding: 0px 0px 15px 15px;"|Fill '' 'concat(tblclients.id, tblclients.lastname, tblclients.firstname)' '' into '' 'Group This Section By' '' field.<br />
 +
Owing to previously introduced concat you can both make sure you will be counting invoices properly and display string generated by concat under summary column in table.<br />
 +
This concat returns client ID, lastname and firstname in one string.<br />
 +
Order records using '' 'Sum' '' alias and define limit of column for this report.<br />
 +
Now, let's create second section. To do so, press '' 'Create New Section' ''.
 
|}
 
|}
 
===Charts===
 
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|'' 'Charts' '' tab allows you to create any quantity of charts in your report.<br />
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_36.png]]
You can create two types of charts which are pie chart and area chart.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG24.png]]
+
|style="padding: 0px 0px 15px 15px;"|In this section we want to display list of all unpaid invoices of selected client.<br />
 +
Select date table and start of client table.<br />
 +
Additionally, join client table with invoice table as in previous section.  
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|To create a pie chart, press on '' 'Add a Pie Chart' '' button.
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_37.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG25.png]]
+
|style="padding: 0px 0px 15px 15px;"|Now, add desired columns. As you can see on the following screen, we have used concat to display clients details in first column.<br />
 +
Proceed to condition tab and press '' 'Add New Condition' '' button.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|Afterwards, type chart name and select record to create a pie chart from.
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_38.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG26.png]]
+
|style="padding: 0px 0px 15px 15px;"|There are two conditions to add, their default values are leaved blank so default report will omit there conditions.<br />
 +
Nonetheless, you will be able to easily filter for desired client at report view.<br />
 +
Now, create conditions shown below.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|Creating an area chart is similar. To begin, press on '' 'Add an Area Chart' '' button.
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_39.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG27.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_40.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|Afterwards, type chart name, additional column counters (which are optional) and select record to create an area chart from.
+
|style="padding: 0px 0px 15px 15px;"|Proceed to the '' 'Groups & Limits' '' tab and set up ordering by ID.<br />
 +
You can also increase limits of record displayed on the report.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG28.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_41.png]]
 
|}
 
|}
 
===Saving Report===
 
 
{|
 
{|
|style="padding: 10px 0px 20px 15px;"|When your report is ready, save it through pressing '' 'Create Report' ''.
+
|style="padding: 0px 0px 15px 15px;"|Let's proceed to the '' 'Your Own Code' '' section to replace '' 'No Company Assigned' '' with blank field.<br />
 +
Copy and paste code placed below:
 +
<?php
 +
foreach($result as $element)
 +
if($element->companyname=='No Company Assigned')
 +
{
 +
&nbsp;$element->companyname=<nowiki>''</nowiki>;
 +
}
 +
?>
 +
Your report is ready, press '' 'Generate Report' '' to finish.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG28_1.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_42.png]]
 
|}
 
|}
  
==Custom Table Records Names==
+
==Modifying Report==
 +
{|
 +
|style="padding: 10px 0px 20px 15px;"|All reports can be easily altered. Press '' 'Edit' '' next to report that you wish to modify.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_43.png]]
 +
|}
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|Our module allows you to set custom table record names, it is quite simple.<br />
+
|style="padding: 0px 0px 15px 15px;"|Edit screen is the same as generate screen. Therefore you are allowed to modify and even entirely change report according to your needs.<br />
Open lang file located at '' 'your_whmcs/modules/addons/mg_resellers/lang' ''. For test purposes we have chosen '' 'english.php' '' file.<br />
+
For this report we will add filtering results by clients' nationality.<br />
Afterwards, enter:
+
Join hosting table with client table as shown on the following screen.
''$_LANG['record_name'] = 'displayed_record_name';''
+
Where '' 'record_name' '' is a record name you want to display differently and '' 'displayed_record_name' '' is a name under which this record will be visible.<br />
+
For example, to change record '' 'groupid' '' to '' 'Group ID' '' use this code:<br />
+
''$_LANG['groupid'] = 'Group ID';''
+
''Note 1: It will set up custom name for all records with that name.''<br />
+
''Note 2: Custom table records support Multi-Language functionality.''
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG29.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_44.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|You can also set up custom table name in the same way.<br />
+
|style="padding: 0px 0px 15px 15px;"|Proceed to the '' 'Conditions' '' tab and press '' 'Add New Filter' ''.<br />
''$_LANG['table_name'] = 'displayed_table_name';''
+
Filter set up shown on the following screen will filter report output depending of client's country.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG30.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_44_1.png]]
 
|}
 
|}
  
 
==Email Configuration==
 
==Email Configuration==
 
{|
 
{|
|style="padding: 10px 0px 15px 15px;"|At '' 'Email Configuration' '' you can set up emails with reports sent to administrators.<br />
+
|style="padding: 10px 0px 15px 15px;"|At '' 'Email Configuration' '' you can set up emails with PDF reports sent to administrators.<br />
Simply select admin or admins to which email with report should be sent.<br />
+
Start of selecting admin or admins to which email with report should be sent.<br />
Afterwards, choose which of your reports should be sent.
+
Afterwards, choose which of your reports should be sent and decide how often reports should be sent using '' 'Time Period' '' dropdown menu.<br />
 +
In addition to that, you can define filter values for generated report if report uses any.<br />
 +
Confirm through pressing '' 'Add Relation' '' button.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG31.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_45.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|Depending on the selected report, various fields will appear at '' 'Additional Filters' '' section.<br />
+
|style="padding: 0px 0px 15px 15px;"|As you can see on the following screen, all relations are listed at the bottom of '' 'Email Configuration' '' page.<br />
You can specify report content through setting it up, for example, on the screen below we have chosen '' 'admin' '' staff member.<br />
+
Each of those relations can be removed at any time through pressing '' 'Delete' '' button.  
In this way the sent report will refer to '' 'admin' '' staff member.<br />
+
Finish by selecting time period for email sending and press '' 'Add Relation' ''.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG32.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_46.png]]
 
|}
 
|}
  
 
==Import==
 
==Import==
 
{|
 
{|
|style="padding: 10px 0px 20px 15px;"|To import report from XML file into your Report Generator go to '' 'Import' '' tab.
+
|style="padding: 10px 0px 15px 15px;"|To import report from the XML file into your Report Generator, go to the '' 'Import' '' tab.<br />
 +
Press '' 'Browse' '' button and select your report XML file.<br />
 +
Afterwards, press '' 'Upload' '' button and your report will be uploaded into the module.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG33.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_47.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|Next, press '' 'Upload' '' button and select your report XML file.<br />
+
|style="padding: 0px 0px 15px 15px;"|Imported report should be renamed afterwards.<br />
Afterwards, press '' 'Upload' '' button and your report will be uploaded to the module.
+
Press '' 'Update Report' '' as soon as you finish.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG34.png]]
+
|style="padding: 0px 0px 20px 25px;"|[[File:RG_48.png]]
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 15px 15px;"|However your just imported report is still not available at reports list, you need to install it first.<br />
+
|style="padding: 0px 0px 20px 15px;"|Now you can go to the '' 'Reports List' '' to see that your report has been successfully imported and it is ready to use.
To do so, simply press '' 'Install on Page' '' button as presented on the following screen.
+
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 20px 25px;"|[[File:RG35.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_49.png]]
 
|}
 
|}
 +
 +
==Default Reports Settings==
 
{|
 
{|
|style="padding: 0px 0px 20px 15px;"|Now you can go to '' 'Reports List' '' and see that your report has been successfully installed and it is ready to use.
+
|style="padding: 10px 0px 15px 15px;"|At the '' 'Settings' '' → '' 'Default Reports Settings' '' tab you are allowed to define a few behaviors of our module.<br />
 +
1. Protects generating reports from data lost during refreshing.<br />
 +
2. Pressing '' 'To PDF' '' adds a cron job which will generate a PDF report for you.<br />
 +
Reports generated by cron are available at the '' 'Cron Jobs' '' → '' 'Cron Generated Reports' ''.<br />
 +
3. Font used to generate PDF reports is switched to font, which supports unicode.<br />
 +
During this option being enabled, generated PDF reports are much larger than earlier.
 
|}
 
|}
 
{|
 
{|
|style="padding: 0px 0px 30px 25px;"|[[File:RG36.png]]
+
|style="padding: 0px 0px 30px 25px;"|[[File:RG_50.png]]
 
|}
 
|}
 +
 +
==Tables And Columns Definitions==
 +
{|
 +
|style="padding: 10px 0px 15px 15px;"|Our module allows you to set up custom table and column names. It is very simple.<br />
 +
Go to the '' 'Report Generator' '' → '' 'Settings' '' → '' 'Advanced Builder Settings' ''. As you can see, there are three text fields.<br />
 +
First one, '' 'Table Definitions' '' enables you to easily change name of the tables visible at the reports created by module.<br />
 +
Second one, '' 'Column Definitions' '' does the same thing for columns.<br />
 +
'' 'Additional Group Expressions' '' field, lets you set up predefined MySQL expressions which afterwards may be added through one click.<br />
 +
''Note 1: '' 'Column Definitions' '' will set up custom name for all columns with that name.''
 +
|}
 +
{|
 +
|style="padding: 0px 0px 30px 25px;"|[[File:RG_51.png]]
 +
|}
 +
 +
==Migration==
 +
{|
 +
|style="padding: 10px 0px 15px 15px;"|Due to changes in the module and its structure, upgrading it from version 1.0 requires migration tool.<br />
 +
It can be accessed at the '' 'Migration' '' tab of our module and allows you to migrate reports from the previous version of Report Generator For WHMCS.<br />
 +
As you can see, all reports which existed in version 1.0 are listed here. In order to import report from the previous version of the module press '' 'Migrate' '' button next to it.<br />
 +
'''Important: Email settings will be lost during upgrade.'''
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 25px;"|[[File:RG_52.png]]
 +
|}
 +
{|
 +
|style="padding: 0px 0px 20px 15px;"|Afterwards, press '' 'Update Report' '' button. Your report is now available at the '' 'Reports List' '' → '' 'User Generated Reports' ''.
 +
|}
 +
{|
 +
|style="padding: 0px 0px 30px 25px;"|[[File:RG_53.png]]
 +
|}
 +
 
=Tips=
 
=Tips=
 
{|
 
{|
|style="padding: 10px 0px 30px 15px;"|In order to work properly, module requires PHP with a PDO support.
+
|style="padding: 10px 0px 10px 15px;"|1. In order to work properly, module requires PHP with a PDO support.
 
|}
 
|}
 +
{|
 +
|style="padding: 0px 0px 30px 15px;"|2. There is workaround which enables you to copy report. Simply export report to XML structure and import report from a received file.
 +
|}
 +
 
=Common Problems=
 
=Common Problems=
 
{|
 
{|

Revision as of 16:27, 29 May 2014

Contents

About Report Generator For WHMCS

Report Generator For WHMCS is a module that allows you to create custom reports using SQL query builder and display them in tables and graphs.

You can also generate report in XML or PDF and send it over email to specified staff members.

  • Admin Area Features:
✔ Drag & Drop WYSIWYG Report Builder
✔ Dynamic Reports Editing
✔ Report Types(Data Table, Pie Chart, Area Chart, Column Chart)
✔ Predefined Reports
✔ User Created Reports
✔ Multi-Sections Of Dynamically Generated Reports
✔ Dynamic Filters
✔ Predefined SQL Expressions At The Report Builder
✔ Multiple Joins At The Report Builder
✔ Two View Types Of Report Pages (Simple And Widget Alike)
✔ Print Reports With Print Preview
✔ Schedule Automatic Reports Sending To Chosen Staff Members With Specified Conditions
✔ Export To CSV, XML and XML Structure
✔ Export To CSV From Report View - Allows You To Set Up Undefault Value Of Filter
✔ Import From The XML Structure
✔ Generate PDF - Both Manually And By Cron Job
✔ Translation Of Database Columns And Tables From The Settings Tab
✔ Enable Unicode Font For Generated PDF
  • Additionally:
✔ Multi-Language Support
✔ Supports WHMCS V5 and Later
✔ User-Friendly Interface
✔ Migration Tool
  • User Created Reports:
✔ 1. Section 1: Orders Of Services In Selected Period (Column Chart)
✔ 2. Section 1: Orders Of Services In Time (Column Chart)
✔ 3. Section 1: Orders Over The Weekdays (Pie Chart)
✔ 4. Section 1: Most Valuable Clients (Data Table)
✔ 5. Section 1: User Accounts Created In Selected Period (Data Table)

    Section 2: Amount Of User Accounts Created In Selected Period (Column Chart)

✔ 6. Section 1: Tickets Replied By Admin (Data Table)

    Section 2: Tickets Replied By Admin (Data Table)
    Section 3: Tickets Replied By Admin (Pie Chart)

✔ 7. Section 1: Customers Per Country (Pie Chart)
  • Predefined Reports:
✔ 1. Section 1: Open Tickets For The Period (Data Table)

    Section 2: New Invoices For The Period (Data Table)
    Section 3: Invoice Reminders For The Period (Data Table)
    Section 4: Hosting Renewals (Data Table)
    Section 5: Suspended Services For The Period (Data Table)
    Section 6: Domain Renewals For The Period (Data Table)

✔ 2. Section 1: Closed/Answered Status Tickets By The Staff Member (Data Table)

    Section 2: Tickets Stats For The Staff Over Time (Area Chart)
    Section 3: Closed To-Do List Tasks Owned By The Staff Member (Data Table)
    Section 4: To-Do List Tasks Owned By The Staff Member Grouped By Status (Pie Chart)
    Section 5: Orders Summary (Area Chart)

✔ 3. Section 1: Opened Tickets Stats For This Staff Over Time (Area Chart)

    Section 2: To-Do List Tasks Owned By The Staff Member Grouped By Status (Pie Chart)
    Section 3: Closed To-Do List Tasks Owned By The Staff Member (Data Table)

Installation

This tutorial will show you how to successfully install and configure Report Generator For WHMCS.

We will guide you step by step through the whole installation and configuration process.

1. Log in to your client area and download Report Generator For WHMCS.
RG 1.png
2. Upload and extract the module into the main WHMCS directory.

Files in your WHMCS directory should look like this.

RG 2.png
3. Remove all files from 'templates_c' folder.
4. When you install Report Generator for the first time you have to rename 'license_RENAME.php' file.

File is located at 'modules/addons/reportgenerator/license_RENAME.php' . Rename it from 'license_RENAME.php' to 'license.php' .

RG 3.png
5. In order to configure your license key, you have to edit a previously renamed 'license.php' file.'

Enter your license key between quotation marks as presented on the following screen. You can find your license key at your client area → 'My Products' .

RG 4.png
6. Now you have to set chmod '755' or '777' to all folders in 'storage' folder.

'storage' folder is located at 'your_whmcs/modules/addons/reportgenerator/' .
Note: If you set up chmods incorrectly, export report and generate PDF report functionalities will not work.

RG 5.png
7. Now you have to activate the module in your WHMCS system.

Log in to your WHMCS admin area. Go to 'Setup' 'Addon Modules' . Afterwards, find 'Report Generator' and press 'Activate' button.

RG 6.png
8. In the next step you need to permit access to this module.

To do so, click on 'Configure' button, tick 'Full Administrator' and press 'Save Changes' .

RG 7.png
9. Last step is setting up cron jobs.

You can find them at your module 'Addons' 'Report Generator' 'Cron Jobs' 'Cron Setup' .

RG 8.png
10. You have just successfully installed Report Generator!

You can access the module at 'Addons' 'Report Generator' .

RG 9.png

Configuration and Management

Report Generator For WHMCS allows your to create custom reports using drag & drop WYSIWYG builder.

Module also offers additional useful features like predefined reports, import/export of reports, generating reports in PDF, ability to send then to admins and much more.

Reports List

At the 'Reports Lists' tab you can view all predefined reports as well as those created by you.

Here you can manage your reports by viewing (1), editing (2) and removing them (8).
Additionally, you can generate PDF version of reports (3) as well as export reports to CSV (4 & 5), XML (6) and XML structure (7).

RG 10.png
For predefined reports you can view report, generate PDF file and export report to CSV and XML.
RG 11.png
To start creation of report press 'Create New Report' .

More information about creating new reports will be presented in the Creating Report section.

RG 12.png

Report View

In the report view you can see all tables and charts generated by the report.

You can display report in a simple or widget format. To switch between them press one of the buttons marked on the screen below.

RG 13.png

PDF Report View

You can also view a PDF version of report which can be sent to your staff memebers or saved to PDF file on your disk.
RG 14.png

Creating Report

In this section we will show you how to prepare a few example reports.

If you wish to create your own report, we strongly recommend to firstly create reports shown below in order to get some practice.
First report will be quite simple and described step by step while the next ones will be more and more complex.
We will show you how specific options affect final report.

First Report - User Accounts Created

At the beginning you have only one section in your report. Each section generates one chart on final report.

In order to create additional chart on your report you need to add a new section.
Below we will show you how to set up a single section. This examplary report will show all new clients which accounts was created during last month.
Start from entering report name and description.

RG 15.png
Now, select desired chart type and table you want to start with.

As you can see, default columns was loaded. For purpose of this report we will remove them through pressing 'Remove All The Columns' .

RG 16.png
Adding columns to report is quite easy owing to autocomplete box.

Type table name and list of all available columns will show up. Now, select desired column.

RG 17.png
As you may noticed earlier, each change made affects report preview displayed below.

In some situations preview may be replaced with error, which will contain information about lacking or miss-configured settings of report.
On the following screen error message is caused by using incorrect function 'COUNT()' .

RG 18.png
To set up time period for report, go to the 'Conditions' tab and mark 'Filter results by date' .
RG 19.png
Afterwards, select 'Clients Table : datecreated' and 'Monthly' from marked dropdown menus.

Now, report will be generated using only accounts created during last 30 days.
Note: Time period for report can be changed later at the report view or email configuration.

RG 20.png
You can set up ordering records by specific column. To do that, go to the 'Groups & Limits' tab.

We will order records by client last name. Choose 'Clients Table : lastname' and 'Ascending' as shown on the following screen.
Your report displaying all new accounts created during last month is ready, press 'Generate Report' to save it.

RG 21.png
Let's view that report through pressing 'View' button.

As you can see, column names are names of table columns.
Our module allows you to easily change column names under which table columns will be displayed.
You will find more information about setting up custom column names at Tables And Columns Definitions section.
While viewing report with enabled filtering by date you can easily change time periods as shown on the following screen.

RG 22.png

Second Report - Orders Per User

This report will be counting orders made by clients this year. Due to that, we will need to use group by command to count those products.

As previously, start of defining report name and description. Additionally, choose report type and starting table.

RG 23.png
Join orders table to clients table. We will need it to display columns from both tables here.

Press 'Join Another Table' to proceed.

RG 24.png
It is time to think about how we want to connect these two tables.

We want to display client even if he has no order, therefore from 'Please Specify A Join Type' we will choose:
'Return all rows from the left table, even if there are no match at the right table' .

RG 25.png
Now select two tables to join. For purpose of this report it will be tables 'Clients' and 'Orders' .

It is time to decide what columns will be used to join chosen columns.
At the table 'Orders' we can find column 'userid' in which there is stored ID of client who made an order.
Therefore we will join them using 'Clients Table : ID' and 'Orders Table : userid' .
At the end press 'Confirm!' .

RG 26.png
We want to display clients details in one column and quantity of orders in another one.

First column will be displayed by:

concat(tblclients.id, '# ', tblclients.firstname, ' ', tblclients.lastname) as Client

Concat will join provided columns while 'Client' is alias for this column. Alias will be used for generated report.

COUNT(*) as Orders

Count along with grouping by allow us to count records for each client.

Orders Table : ID as Any_Order_Exist

This column was added to handle clients which does not have any orders.
Due to join type, 'COUNT(*) as Orders' will be filled with 1 for them.
Proceed to the 'Groups & Limits' tab to set up grouping by (currently our generator does not recognize what should be counted).

RG 27.png
We want to group records by clients, therefore fill 'Group This Section By' with 'Clients Table : ID' which is unique key at the client table.

Additionally, let's set up sorting clients by quantity of orders, we can use column alias for this.
As we predicted, clients with 0 orders have assigned 1 order. Proceed to 'Your Own Code' to fix that.

RG 28.png
At 'Your Own Code' tab you can modify received output.

Code have to be placed in delimiters as shown below.

<?php 
// your custom code here
?> 

The '$result' variable is passed by reference and contains just iterated element of the result array.
In this way you can create new columns in your table or modify existing ones through modifying this variable.
You can access it as typical array where the key is a column name and value is a current row value.
Important 1: Use this field with caution, because every mistake made here can result with error in your production environment.
Note: While working on $result you can use aliases!
What we need to do is assigning 0 to 'Orders' column if 'Any_Order_Exist' column is empty.
Additionally, we are unable to remove previously added column, therefore we will display 'Yes/No' in 'Any_Order_Exist' depending on existence of any order assigned to client.
Code placed below will do it for you:

<?php
foreach($result as $element) // iterate over all records storing current row in $element variable
{
if($element->Any_Order_Exist=="") // check if Any_Order_Exist is empty
{
 $element->Orders=0;      //assign 0 to Orders if Any_Order_Exist is empty
 $element->Any_Order_Exist='No'; //assign 'No' to Any_Order_Exist if it is empty
}
else  // if previous if was false, commands stored here will be ordered
{
 $element->Any_Order_Exist='Yes';  //assign 'Yes' to Any_Order_Exist
}
}
?>
RG 29.png
Your code is ready, press 'Generate Report' to save it.
RG 30.png

Third Report - Unpaid Invoices

At the third report we will show you how to prepare report displaying clients with the most unpaid invoices.

We will also add second section displaying unpaid invoices which can be filtered by client first and last name.
Start of defining report name and description, choose report type and starting table.
Press 'Join Another Table' to proceed.

RG 31.png
Now, join invoice table using 'Clients Table : ID' and 'Invoices Table : userid' and set it up to return tables only if there is a match in the invoice table.
RG 32.png
Add 'COUNT(*) as Sum' column and proceed to the 'Conditions' tab.
RG 33.png
Press 'Create New Filter' button to define new condition for your report.
RG 34.png
Select column you want to define condition for, select filter operand, define default value of filter and filter friendly name.

Conditions can be changed at the report view, they will be displayed under friendly name defined here.

RG 35.png
Fill 'concat(tblclients.id, tblclients.lastname, tblclients.firstname)' into 'Group This Section By' field.

Owing to previously introduced concat you can both make sure you will be counting invoices properly and display string generated by concat under summary column in table.
This concat returns client ID, lastname and firstname in one string.
Order records using 'Sum' alias and define limit of column for this report.
Now, let's create second section. To do so, press 'Create New Section' .

RG 36.png
In this section we want to display list of all unpaid invoices of selected client.

Select date table and start of client table.
Additionally, join client table with invoice table as in previous section.

RG 37.png
Now, add desired columns. As you can see on the following screen, we have used concat to display clients details in first column.

Proceed to condition tab and press 'Add New Condition' button.

RG 38.png
There are two conditions to add, their default values are leaved blank so default report will omit there conditions.

Nonetheless, you will be able to easily filter for desired client at report view.
Now, create conditions shown below.

RG 39.png
RG 40.png
Proceed to the 'Groups & Limits' tab and set up ordering by ID.

You can also increase limits of record displayed on the report.

RG 41.png
Let's proceed to the 'Your Own Code' section to replace 'No Company Assigned' with blank field.

Copy and paste code placed below:

<?php
foreach($result as $element)
if($element->companyname=='No Company Assigned')
{
 $element->companyname='';
}
?>

Your report is ready, press 'Generate Report' to finish.

RG 42.png

Modifying Report

All reports can be easily altered. Press 'Edit' next to report that you wish to modify.
RG 43.png
Edit screen is the same as generate screen. Therefore you are allowed to modify and even entirely change report according to your needs.

For this report we will add filtering results by clients' nationality.
Join hosting table with client table as shown on the following screen.

RG 44.png
Proceed to the 'Conditions' tab and press 'Add New Filter' .

Filter set up shown on the following screen will filter report output depending of client's country.

RG 44 1.png

Email Configuration

At 'Email Configuration' you can set up emails with PDF reports sent to administrators.

Start of selecting admin or admins to which email with report should be sent.
Afterwards, choose which of your reports should be sent and decide how often reports should be sent using 'Time Period' dropdown menu.
In addition to that, you can define filter values for generated report if report uses any.
Confirm through pressing 'Add Relation' button.

RG 45.png
As you can see on the following screen, all relations are listed at the bottom of 'Email Configuration' page.

Each of those relations can be removed at any time through pressing 'Delete' button.

RG 46.png

Import

To import report from the XML file into your Report Generator, go to the 'Import' tab.

Press 'Browse' button and select your report XML file.
Afterwards, press 'Upload' button and your report will be uploaded into the module.

RG 47.png
Imported report should be renamed afterwards.

Press 'Update Report' as soon as you finish.

RG 48.png
Now you can go to the 'Reports List' to see that your report has been successfully imported and it is ready to use.
RG 49.png

Default Reports Settings

At the 'Settings' 'Default Reports Settings' tab you are allowed to define a few behaviors of our module.

1. Protects generating reports from data lost during refreshing.
2. Pressing 'To PDF' adds a cron job which will generate a PDF report for you.
Reports generated by cron are available at the 'Cron Jobs' 'Cron Generated Reports' .
3. Font used to generate PDF reports is switched to font, which supports unicode.
During this option being enabled, generated PDF reports are much larger than earlier.

RG 50.png

Tables And Columns Definitions

Our module allows you to set up custom table and column names. It is very simple.

Go to the 'Report Generator' 'Settings' 'Advanced Builder Settings' . As you can see, there are three text fields.
First one, 'Table Definitions' enables you to easily change name of the tables visible at the reports created by module.
Second one, 'Column Definitions' does the same thing for columns.
'Additional Group Expressions' field, lets you set up predefined MySQL expressions which afterwards may be added through one click.
Note 1: 'Column Definitions' will set up custom name for all columns with that name.

RG 51.png

Migration

Due to changes in the module and its structure, upgrading it from version 1.0 requires migration tool.

It can be accessed at the 'Migration' tab of our module and allows you to migrate reports from the previous version of Report Generator For WHMCS.
As you can see, all reports which existed in version 1.0 are listed here. In order to import report from the previous version of the module press 'Migrate' button next to it.
Important: Email settings will be lost during upgrade.

RG 52.png
Afterwards, press 'Update Report' button. Your report is now available at the 'Reports List' 'User Generated Reports' .
RG 53.png

Tips

1. In order to work properly, module requires PHP with a PDO support.
2. There is workaround which enables you to copy report. Simply export report to XML structure and import report from a received file.

Common Problems

1. When you have problems with connection, check whether your SELinux or firewall is not blocking ports.
2. If you encounter any troubles with our module it is possible that you have not installed PDO.
Navigation
WHMCS Modules
WHMCS Widgets
Tools And Applications
Translations
General
FAQ
Community