Read-only summary of a single SalesDataRecord for display and reporting - the sale amount, its period, who entered it, who and which team the sale is attributed to, the matched product SKU, tags and any custom extra fields captured on the owning series. Instances are produced from a SalesDataRecord by the toBean method and consumed by admin and website pages such as the sales data history table and the claimer app. update writes edited field values back to the underlying record, but callers must start and commit their own transaction around it.
Implements: Relational
Properties
| Property | Returns | Description |
|---|---|---|
| amount | BigDecimal | The value of the sale. |
| catMap | Map<String,String> | The categories of the matched product SKU, keyed by category name with the category title as the value. |
| enteredBy | ProfileBean | The profile who entered this sales record into Kademi. |
| enteredDate | Date | The date and time the record was entered into Kademi, as distinct from the sale's own period dates. |
| extraFields | Map<String,String> | The record's custom field values, keyed by field name, for every extra field defined on the owning series. |
| id | long | Database id of the underlying SalesDataRecord. |
| periodFrom | Date | Start of the period that the sale occurred in. |
| periodTo | Date | End of the period that the sale occurred in. Defaults to periodFrom when a record is created without an explicit end date. |
| productName | String | Name of the catalogue product that the record's product SKU code was matched against. |
| productSku | String | The raw product SKU code recorded on the sale, as entered on the underlying SalesDataRecord. |
| salesBy | Object | The entity the sale is attributed to - either a ProfileBean, when the series attributes sales to individuals, or an OrgData, when it attributes sales to organisations. |
| salesTeam | OrgData | The sales team organisation the record was entered against, separate from the profile or organisation it is attributed to. |
| sku | ProductSkuBean | Summary of the product SKU matched against this record's product SKU code, if any. |
| skuTitle | String | Display title of the matched product SKU, when one was found for the record's product SKU code. |
| tags | List<String> | Free-text tags attached to the record. |
| totalPoints | BigDecimal | Total points allocated for this record, when populated by the caller. Not calculated automatically - use findTotalPoints to calculate it from the record's points allocations. |
Methods
getId() · getSkuTitle() · getProductSku() · getProductName() · getAmount() · getPeriodFrom() · getPeriodTo() · getEnteredBy() · getEnteredDate() · getSalesBy() · getSalesTeam() · getExtraFields() · getTags() · getCatMap() · getTotalPoints() · getSku() · update() · findPointsAllocation() · findTotalPoints()
getId()
Returns: long
Database id of the underlying SalesDataRecord.
getSkuTitle()
Returns: String
Display title of the matched product SKU, when one was found for the record's product SKU code.
getProductSku()
Returns: String
The raw product SKU code recorded on the sale, as entered on the underlying SalesDataRecord.
getProductName()
Returns: String
Name of the catalogue product that the record's product SKU code was matched against.
getAmount()
Returns: BigDecimal
The value of the sale.
getPeriodFrom()
Returns: Date
Start of the period that the sale occurred in.
getPeriodTo()
Returns: Date
End of the period that the sale occurred in. Defaults to periodFrom when a record is created without an explicit end date.
getEnteredBy()
Returns: ProfileBean
The profile who entered this sales record into Kademi.
getEnteredDate()
Returns: Date
The date and time the record was entered into Kademi, as distinct from the sale's own period dates.
getSalesBy()
Returns: Object
The entity the sale is attributed to - either a ProfileBean, when the series attributes sales to individuals, or an OrgData, when it attributes sales to organisations.
getSalesTeam()
Returns: OrgData
The sales team organisation the record was entered against, separate from the profile or organisation it is attributed to.
getExtraFields()
Returns: Map<String,String>
The record's custom field values, keyed by field name, for every extra field defined on the owning series.
getTags()
Returns: List<String>
Free-text tags attached to the record.
getCatMap()
Returns: Map<String,String>
The categories of the matched product SKU, keyed by category name with the category title as the value.
getTotalPoints()
Returns: BigDecimal
Total points allocated for this record, when populated by the caller. Not calculated automatically - use findTotalPoints to calculate it from the record's points allocations.
getSku()
Returns: ProductSkuBean
Summary of the product SKU matched against this record's product SKU code, if any.
update()
Returns: void
Apply updated values in this record to the database. Note that this does not start a transaction so you must start and commit a transaction externally
findPointsAllocation()
Returns: List<PointsAllocation>
Looks up the points allocations that have been made against this record. The result is cached on this bean after the first call.
findTotalPoints()
Returns: BigDecimal
Calculates the sum of points awarded across all of this record's points allocations, looking them up via findPointsAllocation if not already cached.