Audience: New engineers picking up reporting. It's large — treat AdminReportService as its own module.


Mental model

Operational DBs → DataSynchronizationService (30s, SyncBIData) → Warehouse (Stores + Containers)
                                                                     │
                                        AdminReportService reads it → Paginator envelope → frontend table

Two hard facts: reports read the Warehouse, not live data (eventual consistency), and AdminReportService is ~7,000 lines (find the method, don't read it whole).

The 30-minute tour

  1. WarehouseDbContext.cs — the 5 Stores + 5 Containers. This is the reporting data model.
  2. DataSynchronizationService.cs — the 30s worker; see the SyncBIData() calls into Person/Payroll/Requests/Contractor/Payment.
  3. ReportModel.cs — ReportFilterParams (After/Before/Between/On/YTD).
  4. AdminReportService.cs (7,058) — jump to the specific report method (Employee_Summary, Statutory_Payments, the custom builder). Don't read top-to-bottom.
  5. Admin/ReportsController.cs — the 26 endpoints; also the server-driven-tables initiative's anchor.
  6. Frontend: pages/dashboard/documents/reports/ — CustomReport, EmployeeReportBuilder, EnhancedReportTable (the render engine).

Where things live

You want to change… Go to
A report's logic the specific method in AdminReportService.cs
The warehouse schema WarehouseDbContext • the Store/Container entities
BI sync DataSynchronizationService • each service's SyncBIData()
Container aggregation the SQL procedures (not the C#)
Custom builder / templates AdminReportService builder methods + settings/documents/reports FE
Table rendering EnhancedReportTable.tsx (+ the SDT format)

Things that will trip you up

  1. Reports ≠ live data. They read the Warehouse; a "missing" recent change is pre-sync state. (RFD-002)
  2. Four DbContexts — the Warehouse is its own DB. Don't query TenantDb for a report.
  3. Containers are SQL procedures — aggregation logic is in the database. (RFD-001)
  4. AdminReportService is huge — module-sized; navigate by method.
  5. Sync failures = silent staleness — a failing SyncBIData() quietly ages reports. Monitor it.