@get-asset/sdk
Aged Report
Headless aging report for outstanding receivables or payables. It fetches the matching report, normalizes customer and vendor rows into the same shape, and calculates column totals. The aging date is the last day of the range selected on AssetProvider by the shared date picker. Compose the bucket iterators for the four aging columns and use the same compound for either report by changing kind.
Anatomy
Import the primitive and compose the parts you need.
<AgedReport.Root kind="receivable"><AgedReport.Success><AgedReport.BucketColumns><AgedReport.BucketLabel /></AgedReport.BucketColumns><AgedReport.Rows><AgedReport.Name /><AgedReport.Buckets><AgedReport.BucketLabel /><AgedReport.BucketAmount /></AgedReport.Buckets><AgedReport.Total /></AgedReport.Rows><AgedReport.TotalsBuckets><AgedReport.BucketAmount /></AgedReport.TotalsBuckets><AgedReport.GrandTotal /></AgedReport.Success><AgedReport.Loading>…</AgedReport.Loading><AgedReport.Empty>Nothing outstanding.</AgedReport.Empty><AgedReport.Error><AgedReport.ErrorMessage /><AgedReport.Retry>Try again</AgedReport.Retry></AgedReport.Error></AgedReport.Root>
Required scopes
The access token used by AssetProvider must include this scope for this primitive to fetch data successfully:
report:read
API reference
Root props
| Prop | Type | Default | Description |
|---|---|---|---|
kindrequired | "receivable" | "payable" | — | Selects the API endpoint and customer/vendor labels used by the compound. |
dateFrom | CalendarDateString | — | Inclusive start (YYYY-MM-DD) of a fixed reporting range. Detaches the report from the provider's shared range entirely and must be paired with dateTo — passing one without the other throws. Use periodDateRange to derive the pair from a month, quarter, or year. |
dateTo | CalendarDateString | — | Inclusive end (YYYY-MM-DD) of the fixed reporting range, and the day the report ages from. Must be paired with dateFrom. Omit both to follow the provider's date picker. |
lines | AgedReportLineOverride[] | — | Overrides fetched rows and skips API requests. Missing bucket values default to zero; missing totals are calculated from the buckets. |
state | "loading" | "error" | "empty" | — | Forces a state and skips API requests. |
childrenrequired | ReactNode | — | Compound parts. |
Parts
Container
Always rendered. Provides the report data and state to its children.
| Part | Description |
|---|---|
AgedReport.Root | Fetches aged receivables or payables for the current business and provides context. |
AgedReport.TitleasChild? | Renders "Aged Receivables" or "Aged Payables" for the active kind. |
AgedReport.PartyLabelasChild? | Renders "Customer" for receivables or "Vendor" for payables. |
AgedReport.AsOfasChild?, format? | Renders the aging date — the last day of the resolved range. The format callback receives the Date value. |
Bucket columns
Iterates the four columns in order: 0–30, 31–60, 61–90, and 90+ days.
| Part | Description |
|---|---|
AgedReport.BucketColumns | Iterates the four bucket definitions for column headers and provides bucket context. |
AgedReport.BucketLabelasChild? | Renders the current bucket label and adds its key as the data-bucket attribute. |
Success
Renders when the report contains one or more rows.
| Part | Description |
|---|---|
AgedReport.Success | State wrapper. Compose the report table inside. |
AgedReport.Rows | Iterates each customer or vendor row and provides row context. |
AgedReport.NameasChild? | Renders the current customer or vendor name. |
AgedReport.Buckets | Iterates the current row's four bucket amounts and provides bucket context. |
AgedReport.BucketAmountasChild?, format? | Renders the current bucket amount. Adds data-bucket and data-empty when the amount is zero. |
AgedReport.TotalasChild?, format? | Renders the current row's total outstanding amount. |
AgedReport.TotalsBuckets | Iterates the four calculated column totals and provides bucket context. |
AgedReport.GrandTotalasChild?, format? | Renders the total outstanding amount across all rows. |
Loading
Renders while the request is in flight.
| Part | Description |
|---|---|
AgedReport.Loading | State wrapper. Render a skeleton or placeholder inside. |
Empty
Renders when the report has no rows.
| Part | Description |
|---|---|
AgedReport.Empty | State wrapper. Render an empty-state message inside. |
Error
Renders when the report request fails.
| Part | Description |
|---|---|
AgedReport.Error | State wrapper. Compose the error UI inside. |
AgedReport.ErrorMessageasChild?, format? | Renders the report error message. |
AgedReport.RetryasChild? | Button that re-runs the active report request. |
Hooks and constants
| Part | Description |
|---|---|
useAgedReport() | Returns kind, title, party, asOf, lines, totals, hasData, loading, error, and retry. |
useAgedRow() | Returns the current normalized row inside Rows. |
useAgedBucket() | Returns the current bucket key, label, and amount inside an iterator. |
AGED_BUCKETS | The ordered bucket definitions exported for custom compositions. |