OXID eShop CE
4.8.10
|
Public Member Functions | |
__construct ($dInitPrice=null) | |
setNettoPriceMode () | |
setBruttoPriceMode () | |
setVat ($newVat) | |
setUserVat ($newVat) | |
getVat () | |
setPrice ($dPrice, $dVat=null) | |
getPrice () | |
getBruttoPrice () | |
getNettoPrice () | |
getVatValue () | |
subtractPercent ($dValue) | |
addPercent ($dValue) | |
addPrice (oxPrice $oPrice) | |
add ($dValue) | |
subtract ($dValue) | |
multiply ($dValue) | |
divide ($dValue) | |
compare (oxPrice $oPrice) | |
setDiscount ($dValue, $sType) | |
getDiscounts () | |
calculateDiscount () |
Static Public Member Functions | |
static | percent ($dValue, $dPercent) |
static | brutto2Netto ($dBrutto, $dVat) |
static | netto2Brutto ($dNetto, $dVat) |
static | getPriceInActCurrency ($dPrice) |
Protected Member Functions | |
_recalculate () | |
_flushDiscounts () |
Protected Attributes | |
$_dBrutto = 0.0 | |
$_dNetto = 0.0 | |
$_dVat = 0.0 | |
$_aDiscounts = null | |
$_blNetPriceMode |
Price calculation class. Responsible for simple price calculations. Basically contains Brutto, Netto prices and VAT values.
Definition at line 6 of file oxprice.php.
oxPrice::__construct | ( | $dInitPrice = null | ) |
Class constructor. Gets price entering mode.
double | $dInitPrice | given price |
Definition at line 55 of file oxprice.php.
|
protected |
|
protected |
Calculates price depending on price entering mode. Round only displayed price to the user, other leave as accurate as possible: in Brutto mode: round Brutto price before calculations; in Netto mode: round Brutto price after calculations;
protected
Definition at line 396 of file oxprice.php.
oxPrice::add | ( | $dValue | ) |
Adds given value to price depending on price entering mode, and recalculates price
double | $dValue | value to add to price |
Definition at line 259 of file oxprice.php.
oxPrice::addPercent | ( | $dValue | ) |
Adds given percent to price depending on price entering mode, and recalculates price
double | $dValue | percent to add to price |
Definition at line 230 of file oxprice.php.
oxPrice::addPrice | ( | oxPrice | $oPrice | ) |
Adds another oxPrice object and recalculates current method.
oxPrice | $oPrice | object |
Definition at line 242 of file oxprice.php.
|
static |
Converts Brutto price to Netto using formula: X + $dVat% = $dBrutto X/100 = $dBrutto/(100+$dVAT) X= ($dBrutto/(100+$dVAT))/100 returns X
double | $dBrutto | brutto price |
double | $dVat | vat |
Definition at line 358 of file oxprice.php.
oxPrice::calculateDiscount | ( | ) |
oxPrice::compare | ( | oxPrice | $oPrice | ) |
Compares this object to another oxPrice objects. Comparison is performed on brutto price. Result is equal to: 0 - when prices are equal. 1 - when this price is larger than $oPrice. -1 - when this price is smaller than $oPrice.
oxPrice | $oPrice | price object |
Definition at line 317 of file oxprice.php.
oxPrice::divide | ( | $dValue | ) |
Divides price by given value depending on price entering mode, and recalculates price
double | $dValue | value for dividing price |
Definition at line 300 of file oxprice.php.
oxPrice::getBruttoPrice | ( | ) |
oxPrice::getDiscounts | ( | ) |
oxPrice::getNettoPrice | ( | ) |
oxPrice::getPrice | ( | ) |
Returns price depending on mode brutto or netto
Definition at line 155 of file oxprice.php.
|
static |
Returns price multiplied by current currency
string | $dPrice | price value |
Definition at line 414 of file oxprice.php.
oxPrice::getVat | ( | ) |
oxPrice::getVatValue | ( | ) |
oxPrice::multiply | ( | $dValue | ) |
Multiplies price by given value depending on price entering mode, and recalculates price
double | $dValue | value for multiplying price |
Definition at line 286 of file oxprice.php.
|
static |
Converts Netto price to Brutto using formula: X = $dNetto + $dVat% returns X
double | $dNetto | netto price |
double | $dVat | vat |
Definition at line 379 of file oxprice.php.
|
static |
Private function for percent value calculations
double | $dValue | value |
double | $dPercent | percent |
Definition at line 341 of file oxprice.php.
oxPrice::setBruttoPriceMode | ( | ) |
oxPrice::setDiscount | ( | $dValue, | |
$sType | |||
) |
Sets discount to price
double | $dValue | discount value |
string | $sType | discount type: abs or % |
Definition at line 429 of file oxprice.php.
oxPrice::setNettoPriceMode | ( | ) |
oxPrice::setPrice | ( | $dPrice, | |
$dVat = null |
|||
) |
Sets new price and VAT percent(optional). Recalculates price by price entering mode
double | $dPrice | new price |
double | $dVat | VAT |
Definition at line 137 of file oxprice.php.
oxPrice::setUserVat | ( | $newVat | ) |
Sets new base VAT percent, recalculates brutto, and then netto price (in brutto mode). if bruttoMode then BruttoPrice =(BruttoPrice - oldVAT% ) + newVat; oldVAT = newVat; finally recalculate; USE ONLY TO CHANGE BASE VAT (in case when local VAT differs from user VAT), USE setVat() in usual case !!!
double | $newVat | vat percent |
Definition at line 110 of file oxprice.php.
oxPrice::setVat | ( | $newVat | ) |
Sets new VAT percent, and recalculates price.
double | $newVat | vat percent |
Definition at line 91 of file oxprice.php.
oxPrice::subtract | ( | $dValue | ) |
Subtracts given value from price depending on price entering mode, and recalculates price
double | $dValue | value to subtracts from price |
Definition at line 273 of file oxprice.php.
oxPrice::subtractPercent | ( | $dValue | ) |
Subtracts given percent from price depending on price entering mode, and recalculates price
double | $dValue | percent to subtract from price |
Definition at line 216 of file oxprice.php.
|
protected |
Definition at line 35 of file oxprice.php.
|
protected |
Definition at line 46 of file oxprice.php.
|
protected |
Definition at line 13 of file oxprice.php.
|
protected |
Definition at line 20 of file oxprice.php.
|
protected |
Definition at line 27 of file oxprice.php.