---
tags: [reports, command]
module: Reports
---

# [Command]Commands

## Connections
[[_Reports]] · [[[Model]Models]] · [[[Job]Jobs]] · [[[Cross]CrossModuleDependencies]]

## Source
`Modules/Reports/Console/`

---

## PopulateReportCustomerAgingTransactionsCommand
**Signature:** `report:customer-aging:populate-transactions {--website-id= : Process specific tenant} {--sync : Run synchronously}`

Dispatches `PopulateAgingReportForTenantJob` for every tenant (or a single tenant via `--website-id`). Used to refresh the `report_customer_aging` pre-computed cache table.

**Flow:**
```
handle()
    → get all websites (or specific one)
    → for each website:
        --sync  → job->handle() directly (blocking)
        default → dispatch to 'report_processing' queue
    → logs progress
```

**Run this when:** invoices/returns are bulk-imported, or the aging data drifts out of sync.  
`ReportsAgingCustomerService::updateTransactionRecord()` handles incremental updates during normal payment operations — this command is for full rebuilds.

---

## Validation Rules (`Rules/`)

| Rule | Validates |
|---|---|
| IsExists | Report ID exists in `ReportsEnum::DATA_MAPPING` |
| IsAllowedReports | Report is enabled for the tenant's subscription package (via `AllowableReports` trait) |
| FromIsSmallerThanTo | `from_date <= to_date` (strtotime comparison) |
| MultiSelectCostCenterExists | Each cost center ID exists in DB, or is `null`/`0` (main center) |

---

## Trait: AllowableReports
`Modules/Reports/Traits/AllowableReports.php`  
`getAllowedReports(subdomain)` — fetches the list of allowed report IDs from the tenant's subscription package. Used by `IsAllowedReports` rule and `SubscriptionReportStatusService`.
