Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Класс Calculation

Открытые статические члены

static setConfig (array $config)
 
static getConfig ()
 
static pushConfig ()
 
static popConfig ()
 
static getCurrency ()
 
static getPrecision ()
 
static isAllowedUseDiscounts ()
 
static isIncludingVat ()
 
static getResultMode ()
 
static isComponentResultMode ()
 
static isRawResultMode ()
 
static roundPrecision ($value)
 
static compare ($firstValue, $secondValue, $operator)
 

Открытые атрибуты

const RESULT_MODE_COMPONENT = 1
 
const RESULT_MODE_RAW = 2
 

Защищенные статические члены

static checkConfig (array $config)
 

Статические защищенные данные

static $config
 

Подробное описание

См. определение в файле calculation.php строка 17

Методы

◆ checkConfig()

static checkConfig ( array $config)
staticprotected

Validate new settings (allowed keys and values).

См. определение в файле calculation.php строка 198

◆ compare()

static compare ( $firstValue,
$secondValue,
$operator )
static

Returns the result of comparing two values with the precision of rounding.

Аргументы
float | int$firstValueFirst value.
float | int$secondValueSecond value.
string$operatorCompare operator ( >, >=, <, <=, ==, !=).
Возвращает
bool

См. определение в файле calculation.php строка 161

◆ getConfig()

static getConfig ( )
static

Returns current calculation settings.

Возвращает
array

См. определение в файле calculation.php строка 60

◆ getCurrency()

static getCurrency ( )
static

Returns result calculation currency.

Возвращает
string

См. определение в файле calculation.php строка 92

◆ getPrecision()

static getPrecision ( )
static

Returns calculation precision.

Возвращает
int

См. определение в файле calculation.php строка 102

◆ getResultMode()

static getResultMode ( )
static

См. определение в файле calculation.php строка 127

◆ isAllowedUseDiscounts()

static isAllowedUseDiscounts ( )
static

Returns true if allowed use discounts.

Возвращает
bool

См. определение в файле calculation.php строка 112

◆ isComponentResultMode()

static isComponentResultMode ( )
static

См. определение в файле calculation.php строка 132

◆ isIncludingVat()

static isIncludingVat ( )
static

Returns true if result price with VAT.

Возвращает
bool

См. определение в файле calculation.php строка 122

◆ isRawResultMode()

static isRawResultMode ( )
static

См. определение в файле calculation.php строка 137

◆ popConfig()

static popConfig ( )
static

Set the calculation settings from the stack, if it is not empty.

Возвращает
void

См. определение в файле calculation.php строка 80

◆ pushConfig()

static pushConfig ( )
static

Save current calculation settings to the stack before the changes.

Возвращает
void

См. определение в файле calculation.php строка 70

◆ roundPrecision()

static roundPrecision ( $value)
static

Rounding the price or discount to a specified number of decimal places.

Аргументы
float | int$valueValue for rounding.
Возвращает
float

См. определение в файле calculation.php строка 148

◆ setConfig()

static setConfig ( array $config)
static

Set calculation settings.

Аргументы
array$configkeys are case sensitive:
  • string CURRENCY Result currency (can be null - use base currency (compatibility only)).
  • int PRECISION Calculation precision (can be null - use default catalog precision - CATALOG_VALUE_PRECISION).
  • bool USE_DISCOUNTS Use discounts for calculation (by default use discounts is allowed).
  • bool RESULT_WITH_VAT Returns result price without/with VAT (by default return price with VAT).
  • int RESULT_MODE Returns raw result for provider or prepared result for components (by default - for components).
Возвращает
void

См. определение в файле calculation.php строка 46

Данные класса

◆ $config

$config
staticprotected
Инициализатор
= array(
'CURRENCY' => null,
'PRECISION' => null,
'USE_DISCOUNTS' => true,
'RESULT_WITH_VAT' => true,
'RESULT_MODE' => self::RESULT_MODE_COMPONENT
)

См. определение в файле calculation.php строка 22

◆ RESULT_MODE_COMPONENT

const RESULT_MODE_COMPONENT = 1

См. определение в файле calculation.php строка 19

◆ RESULT_MODE_RAW

const RESULT_MODE_RAW = 2

См. определение в файле calculation.php строка 20