Accounting
Table of Contents
Methods
- __construct() : mixed
- calculate() : array<string|int, mixed>|null
- Calculates total sums based on current tax mode and provided data.
- calculateByItem() : Result
- Calculate total sums based on current tax mode and $item`s fields.
- calculateDeliveryTotal() : float
- calculatePriceWithoutTax() : float
- Returns original price before tax
- calculatePriceWithTax() : float
- Applies tax with $taxRate to the price and returns its new value
- clearCache() : $this
- Clear inner calculation cache.
- isTaxMode() : bool
- Return true if location dependant tax mode is used.
- resolvePersonTypeId() : int
- Returns person type id based on data contained in the $item
- setTaxMode() : $this
- Switch location dependant tax mode.
Methods
__construct()
public
__construct() : mixed
calculate()
Calculates total sums based on current tax mode and provided data.
public
calculate(array<string|int, mixed> $productRows, string $currencyId, int $personTypeId[, string|null $locationId = null ]) : array<string|int, mixed>|null
Parameters
- $productRows : array<string|int, mixed>
- $currencyId : string
- $personTypeId : int
- $locationId : string|null = null
Tags
Return values
array<string|int, mixed>|nullcalculateByItem()
Calculate total sums based on current tax mode and $item`s fields.
public
calculateByItem(Item $item) : Result
This method stores calculation result in inner cache.
Parameters
- $item : Item
Return values
ResultcalculateDeliveryTotal()
public
calculateDeliveryTotal(ItemIdentifier $itemIdentifier) : float
Parameters
- $itemIdentifier : ItemIdentifier
Return values
floatcalculatePriceWithoutTax()
Returns original price before tax
public
calculatePriceWithoutTax(float $priceWithTax, float|null $taxRate) : float
Parameters
- $priceWithTax : float
- $taxRate : float|null
Return values
floatcalculatePriceWithTax()
Applies tax with $taxRate to the price and returns its new value
public
calculatePriceWithTax(float $priceWithoutTax, float|null $taxRate) : float
Parameters
- $priceWithoutTax : float
- $taxRate : float|null
Return values
floatclearCache()
Clear inner calculation cache.
public
clearCache() : $this
Return values
$thisisTaxMode()
Return true if location dependant tax mode is used.
public
isTaxMode() : bool
By default VAT taxes used.
Return values
boolresolvePersonTypeId()
Returns person type id based on data contained in the $item
public
resolvePersonTypeId(Item $item) : int
Parameters
- $item : Item
Return values
int —- if a suitable person type was not found, returns 0
setTaxMode()
Switch location dependant tax mode.
public
setTaxMode(bool $isTaxMode) : $this
Parameters
- $isTaxMode : bool