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
| Property | Value |
|---|---|
| Plugin | Suma KoolReports |
| Location | plugins/suma-koolreports/ |
| Library | KoolReport (vendored via Composer) |
| Stack | PHP 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
- Create a new directory under
plugins/suma-koolreports/reports/. - Create a PHP report class extending
\koolreport\KoolReport. - Create a Blade/PHP view template for the report output.
- Register the report page in
plugins/suma-koolreports/init.php. - Run
composer dump-autoloadin the plugin directory.