Skip to main content

Custom KoolReports

The Dealers Site includes a custom reporting plugin (Suma KoolReports, plugins/suma-koolreports/) built on the KoolReport PHP reporting library. It provides rich data analytics dashboards accessible from the WordPress admin.


Plugin Details

PropertyValue
PluginSuma KoolReports
Locationplugins/suma-koolreports/
LibraryKoolReport (vendored via Composer)
StackPHP reports + Tailwind CSS frontend

Available Reports

Reports are located in plugins/suma-koolreports/reports/:

Orders Paid (reports/orders-paid/)

An analytics report showing paid WooCommerce orders with breakdowns by:

  • Date range (configurable filter)
  • Customer / dealer company
  • Product SKU and category
  • Order total and payment method

Unpaid Orders Grouped by Customer (reports/unpaid-orders-grouped-by-customer/)

Accounts receivable report showing outstanding (unpaid) orders grouped by dealer, with:

  • Total unpaid amount per dealer
  • Oldest unpaid order date
  • Drill-down to individual order details
  • Export to CSV

Architecture

Each report is a PHP class that extends KoolReport's \koolreport\KoolReport:

class OrdersPaid extends \koolreport\KoolReport {
public function settings() {
return [
'dataSources' => [
'main' => [
'class' => '\koolreport\datasources\WPDataSource',
'wpdb' => $GLOBALS['wpdb'],
],
],
];
}

public function setup() {
// Define query, filters, and data pipeline
}
}

Reports are rendered as WordPress admin pages using the plugin's shortcode or admin menu registration.


Access Control

KoolReport pages are restricted to administrators and users with the view_reports capability. The plugin integrates with the User Role Editor Pro plugin for granular access control.


Adding a New Report

  1. Create a new directory under plugins/suma-koolreports/reports/.
  2. Create a PHP report class extending \koolreport\KoolReport.
  3. Create a Blade/PHP view template for the report output.
  4. Register the report page in plugins/suma-koolreports/init.php.
  5. Run composer dump-autoload in the plugin directory.