ServiceDataPresenter extends AbstractPresenter
Service data presenter
Table of Contents
Properties
| $collection |
Methods
| __construct() | Init |
| collection() | Retrieves the collection used by the presenter |
| discounts() | Retrieves the discounts for all items in the collection |
| items() | Retrieves a set of all items in the collection |
| taxes() | Retrieves the taxes for all items in the collection |
| totals() | Retrieves totals for all items in the collection |
| getDiscounts() | Retrieves the discounts for all items in the collection |
| getItems() | Retrieves a list of all item prices in the collection |
| getTaxes() | Retrieves the taxes for all items in the collection |
| getTotals() | Retrieves totals for all items in the collection |
Methods
__construct()
Init
public
__construct(ItemPriceCollection $collection) : mixed
Parameters
- $collection : ItemPriceCollection
-
An ItemPriceCollection
collection()
Retrieves the collection used by the presenter
public
collection() : ItemPriceCollection
Return values
ItemPriceCollection —The instance of the ItemPriceCollection
discounts()
Retrieves the discounts for all items in the collection
public
discounts() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of stdClass objects representing each discount, including:
- description The discount description
- amount The discount amount
- type The discount type
- total The total amount actually discounted
items()
Retrieves a set of all items in the collection
public
items() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of stdClass objects representing each item, including:
- description The item description
- price The item unit price
- qty The item quantity
- subtotal The item subtotal
- total The item total
- total_after_tax The item total including tax
- total_after_discount The item total after discount
- tax_amount The total item tax
- discount_amount The total item discount
taxes()
Retrieves the taxes for all items in the collection
public
taxes() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of stdClass objects representing each tax, including:
- description The tax description
- amount The tax amount
- type The tax type
- total The total amount actually taxed
totals()
Retrieves totals for all items in the collection
public
totals() : stdClass
Return values
stdClass —An stdClass of total information:
- subtotal The collection's subtotal
- total The collection's total
- total_after_tax The collection's total after tax
- total_after_discount The collection's total after discount
- tax_amount The collection's total tax
- discount_amount The collection's total discount
getDiscounts()
Retrieves the discounts for all items in the collection
protected
getDiscounts(ItemPriceCollection $collection) : array<string|int, mixed>
Parameters
- $collection : ItemPriceCollection
-
The collection from which to fetch all discounts
Return values
array<string|int, mixed> —An array of stdClass objects representing each discount, including:
- description The discount description
- amount The discount amount
- type The discount type
- total The total amount actually discounted
getItems()
Retrieves a list of all item prices in the collection
protected
getItems(ItemPriceCollection $collection) : array<string|int, mixed>
Parameters
- $collection : ItemPriceCollection
-
The collection from which to fetch all items
Return values
array<string|int, mixed> —An array of stdClass objects representing each item, including:
- description The item description
- price The item unit price
- qty The item quantity
- subtotal The item subtotal
- total The item total
- total_after_tax The item total including tax
- total_after_discount The item total after discount
- tax_amount The total item tax
- discount_amount The total item discount
getTaxes()
Retrieves the taxes for all items in the collection
protected
getTaxes(ItemPriceCollection $collection) : array<string|int, mixed>
Parameters
- $collection : ItemPriceCollection
-
The collection from which to fetch all taxes
Return values
array<string|int, mixed> —An array of stdClass objects representing each tax, including:
- description The tax description
- amount The tax amount
- type The tax type
- total The total amount actually taxed
getTotals()
Retrieves totals for all items in the collection
protected
getTotals(ItemPriceCollection $collection) : stdClass
Parameters
- $collection : ItemPriceCollection
-
The collection from which to fetch all totals
Return values
stdClass —An stdClass of total information:
- subtotal The collection's subtotal
- total The collection's total
- total_without_exclusive_tax The collection's total without exclusive taxes
- total_after_tax The collection's total after tax
- total_after_discount The collection's total after discount
- tax_amount The collection's total tax
- discount_amount The collection's total discount