Back to Blog Posts

Customizing WHMCS Reports

By Sarah / February 15th, 2021


Your WHMCS installation holds a wealth of valuable data about your sales, your customers, and your business as a whole. So, having the ability to view and make sense of this data is vital to growing your business. The reports in the WHMCS Admin Area can help you with this, with dozens of premade reports shipping with your initial installation. WHMCS offers even more power by allowing you to customize reports, some of which require little to no programming knowledge to create.

Reports in WHMCS
You can access WHMCS's reports by going to Reports in the Admin Area. The reports you'll find here are grouped by type: General, Billing, Income, Clients, and Support. This page also includes an Exports section to allow you to export various types of data, like clients or transactions, from your WHMCS installation.


These reports span much of the information that WHMCS holds for you, from a detailed look at your income for each product and service to statistics on how your promotions are used.


Customizing Reports
The reports that we include with WHMCS by default are very useful, but sometimes your business will need something different. Maybe you need a very specific set of information, or maybe you just need more of the same report.

For example, WHMCS ships with a Top 10 Clients by Income report, which is great for finding your most important customers. For some promotions, you may want to expand on this list, maybe so that you could add them to a client group for your top clients, or so that you can give them enhanced support through your customer service team. You could do this by creating a Top 25 Clients by Income report with just a few small steps. WHMCS reports are shipped unencoded, so it's easy to duplicate and edit them.

Since this is a new version of one of the existing reports, the first step is to find the report file in the /modules/reports/ directory of your WHMCS installation.


The file for the Top 10 Clients by Income report is top_10_clients_by_income.php. To create the new report, copy it with a new filename (like top_25_clients_by_income.php).

Next, update the report with a new title and description by updating these two lines:

$reportdata["title"] = "Top 25 Clients by Income";
$reportdata["description"] = "This report shows the 25 clients with the highest net income according to the transactions entered in WHMCS.";

These display at the top of the report.


The code below this in the file gathers data from WHMCS's database, processes it, and outputs results in the WHMCS interface. This custom report will operate on the same set of data as the original report in the same way, so the majority of the code can remain untouched. The only line that needs adjustment is the one that determines how many records to return when displaying the report, changing line 28 of the file to indicate 25 instead of 10:

->take(25)

From there, just save your changes and reload the Reports page. You should see your custom report at the bottom of the page, listed in the Other category.


More Options
Once you're comfortable making small customizations, you can start branching out into bigger changes easily, just by acquiring some PHP and SQL knowledge. You can work with the charts and graphs in our reports by using the Google Charts API.

There's no limit to the types of custom reports you could create. Here are a few ideas to help you get started:

  • Sales details for a specific product offering.
  • Products purchased with a specific promotion code.
  • Customer demographics, like zip code, language, or signup date.
  • Trends for domain registrations or transfers over time.
  • Support ticket response times per staff member.
  • Sales figures per staff member.

Before you start your own customizations, we recommend studying the shipped reports to better understand how to use our reporting system. You can find out more about the format for writing custom reports in our documentation.

Liked this article? Share it