Report datasets and coverage
Reports aggregate authorized source facts using a declared row meaning, date and amount basis. The same-looking amount can represent estimated opportunity value, issued revenue or net supplier cost. A chart must preserve that distinction and the selection’s coverage.
report_query version 1 aggregates the complete selection in PostgreSQL and returns a 50-row source page from the same statement snapshot. The API validates a typed configuration and forwards the caller’s JWT, preserving source permissions and tenant RLS. There is no free-SQL builder, arbitrary cross-source join or client-side portfolio summation.
Dataset reference
Section titled “Dataset reference”| Dataset | Row meaning and date | Amount or measure |
|---|---|---|
| Opportunities | One opportunity; created date | Estimated value excluding VAT |
| Quotes | One canonical offer thread; relevant last sent/accepted event | Relevant version subtotal excluding VAT |
| Invoices | One issued invoice or credit; issue date | Subtotal, with imported credited amounts subtracting absolute value |
| Time | Non-deleted, non-rejected, non-replaced report; report date | Hours; not automatically utilization, approved or paid hours |
| Purchases | One original eligible cost-queue invoice, confirmed duplicates excluded; invoice date | Net cost counted once despite project allocations |
| Projects | Every non-deleted project, including those without economic entries; actual completion date | Existing whole-project economics model |
An unsent quote draft is not a sent offer. An unsent revision does not erase an earlier sent or accepted version. The dataset’s canonical thread/version selection prevents counting all versions as new business.
Permission and amount boundaries
Section titled “Permission and amount boundaries”analytics:read opens Reports. Each dataset additionally requires source capabilities; project reporting requires project, invoice and time read. Cost/margin metrics also require salary:read, which is not implicitly granted. Liquidity requires finance:invoices:read for its silver sources. A forbidden source is not zero data.
The database enforces these rules on direct RPC calls and saved-report visibility. The API’s staff/capability guard is only one layer; the caller-token RPC still checks source authority. Trust boundaries explains why forwarding the verified caller differs from querying everything with a service role.
Different currencies never share a monetary total. A missing currency stays missing rather than becoming SEK. Missing source dates and category values remain visible. Undated projects have an explicit cohort without a period comparison, avoiding a fabricated comparison between missing completion dates.
Coverage and profitability
Section titled “Coverage and profitability”The report contract retains the existing project-economics model. Margin percentages are weighted from covered revenue and costs, with the current minimum 50% project-coverage gate. Individual project percentages and covered-only portfolio percentages cannot be added together.
Incomplete purchase allocation, absent cost input or an unverified liquidity register remains a coverage limitation. A displayed subtotal does not establish that all costs, payment registers or payroll are complete. New contribution-margin definitions remain deferred under their owning decision; documentation must not silently define them from a chart.
Cost allocations supply per-project shares, while the purchase dataset counts the original source once. Payment reconciliation establishes the separate freshness and register proof required for balance statements.
Saved reports and concurrent changes
Section titled “Saved reports and concurrent changes”Presets are code configuration. Opening a report or changing filters does not persist a saved view. Saving creates a private company/person-owned report_views row. The owner or a tenant:update administrator can manage it; an authorized reader can copy a shared report privately. RLS rechecks source access when reading.
Updates and deletion match the expected revision. A conflict retains the local configuration and requires a fresh read. Configuration versioning is independent of result freshness or provider coverage. Sharing a view does not grant its readers new source capabilities.
Synthetic interpretation and evidence
Section titled “Synthetic interpretation and evidence”A synthetic selection contains two project invoices in SEK and one in EUR, plus an undated project. It can show separate currency totals and explicit missing-date coverage. It cannot combine the two currencies or move the undated project into a chosen month to make a comparison complete.
Request-model tests specify unsupported combinations and permission refusal; database tests establish aggregation and source policy. Existing shared receipts prove their named tabs, selections and versions. This source review does not certify every report or resolve financial acceptance by itself.