|
static | adjustedCost ($base_cost, $discount_percent=0, $shipping_percent=0) |
|
static | adjustedCostSQL ($base_cost, $discount_percent=0, $shipping_percent=0) |
|
static | toMargin ($cost, $price, $format=array(1, false)) |
|
static | toMarginSQL ($cost, $price) |
|
static | toPrice ($cost, $margin) |
|
static | toPriceSQL ($cost, $margin) |
|
API class with margin related methods
static COREPOS\Fannie\API\item\Margin::adjustedCost |
( |
|
$base_cost, |
|
|
|
$discount_percent = 0 , |
|
|
|
$shipping_percent = 0 |
|
) |
| |
|
static |
Calculate effective cost of an item
- Parameters
-
$base_cost | [number] the cost of the item |
$discount_percent | [number] a percent discount off the listed cost |
$shipping_percent | [number] a percent markup for shipping |
- Returns
- [number] adjusted cost
Both percent parameters default to zero. Percents should be expressed as decimals - i.e., 0.10 means 10%
static COREPOS\Fannie\API\item\Margin::adjustedCostSQL |
( |
|
$base_cost, |
|
|
|
$discount_percent = 0 , |
|
|
|
$shipping_percent = 0 |
|
) |
| |
|
static |
Calculate effective cost of an item
- Parameters
-
$base_cost | [expression] the cost of the item |
$discount_percent | [expression] a percent discount off the listed cost |
$shipping_percent | [expression] a percent markup for shipping |
- Returns
- [string] SQL for calculating adjusted cost
Intended for building queries. User input should not be part of any of the parameters
static COREPOS\Fannie\API\item\Margin::toMargin |
( |
|
$cost, |
|
|
|
$price, |
|
|
|
$format = array(1,false) |
|
) |
| |
|
static |
Calculate margin
- Parameters
-
$cost | [number] item cost |
$price | [number] item price |
$format | [array] (multiplier, rounding) |
- Returns
- [number] margin
By default this returns a decimal (i.e. 0.10 for 10%) without any rounding. Passing in format (100, 2) will give the return value 10.00 for 10%.
static COREPOS\Fannie\API\item\Margin::toMarginSQL |
( |
|
$cost, |
|
|
|
$price |
|
) |
| |
|
static |
Calculate margin
- Parameters
-
$cost | [number] item cost |
$price | [number] item price |
- Returns
- [string] SQL for calculating adjusted cost
Intended for building queries. User input should not be part of any of the parameters
static COREPOS\Fannie\API\item\Margin::toPrice |
( |
|
$cost, |
|
|
|
$margin |
|
) |
| |
|
static |
Calculate price
- Parameters
-
$cost | [number] item cost |
$margin | [number] desired margin |
- Returns
- [number] price
Margin should be a decimal (i.e. 0.10 for 10%)
static COREPOS\Fannie\API\item\Margin::toPriceSQL |
( |
|
$cost, |
|
|
|
$margin |
|
) |
| |
|
static |
Calculate price
- Parameters
-
$cost | [number] item cost |
$margin | [number] desired margin |
- Returns
- [string] SQL for calculating adjusted cost
Intended for building queries. User input should not be part of any of the parameters
The documentation for this class was generated from the following file:
- fannie/classlib2.0/item/Margin.php