CostPriceCalculator
Class CostPriceCalculator
Calculate purchasing price by different methods.
Table of Contents
Constants
- METHOD_AVERAGE = 'average'
- METHOD_FIFO = 'fifo'
Methods
- __construct() : mixed
- calculate() : float
- Calculate purchasing price by quantity. Is able to calculate in certain store and get result in required currency.
- getMethod() : string
- Return current purchasing price calculation method.
- getMethodList() : array<string|int, mixed>
- setMethod() : void
- Set current purchasing price calculation method value.
Constants
METHOD_AVERAGE
public
mixed
METHOD_AVERAGE
= 'average'
METHOD_FIFO
public
mixed
METHOD_FIFO
= 'fifo'
Methods
__construct()
public
__construct(BatchManager $batchManager) : mixed
Parameters
- $batchManager : BatchManager
calculate()
Calculate purchasing price by quantity. Is able to calculate in certain store and get result in required currency.
public
calculate(float $quantity, int $storeId[, string|null $currency = null ]) : float
Parameters
- $quantity : float
- $storeId : int
- $currency : string|null = null
Tags
Return values
floatgetMethod()
Return current purchasing price calculation method.
public
static getMethod() : string
Return values
stringgetMethodList()
public
static getMethodList() : array<string|int, mixed>
Return values
array<string|int, mixed>setMethod()
Set current purchasing price calculation method value.
public
static setMethod(string $method) : void
Parameters
- $method : string