|
@ -27,17 +27,21 @@ class Format |
|
|
|
|
|
|
|
|
/* money */ |
|
|
/* money */ |
|
|
static protected $decimal_point = ','; |
|
|
static protected $decimal_point = ','; |
|
|
static protected $currency_symbol = ' руб.'; |
|
|
|
|
|
|
|
|
static protected $currency_symbol = 'руб.'; |
|
|
static protected $frac_digits = 2; |
|
|
static protected $frac_digits = 2; |
|
|
static protected $cache_money = array(); |
|
|
static protected $cache_money = array(); |
|
|
|
|
|
|
|
|
|
|
|
static public function getCurrency() |
|
|
|
|
|
{ |
|
|
|
|
|
return self::$currency_symbol; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static public function int2money($int = 0, $currency = false) |
|
|
static public function int2money($int = 0, $currency = false) |
|
|
{ |
|
|
{ |
|
|
if(!isset(self::$cache_money[$int])){ |
|
|
if(!isset(self::$cache_money[$int])){ |
|
|
self::$cache_money[$int] = number_format($int/100, self::$frac_digits, self::$decimal_point, ''); |
|
|
self::$cache_money[$int] = number_format($int/100, self::$frac_digits, self::$decimal_point, ''); |
|
|
} |
|
|
} |
|
|
return self::$cache_money[$int] . (($currency) ? self::$currency_symbol : ''); |
|
|
|
|
|
|
|
|
return self::$cache_money[$int] . (($currency) ? ' '.self::$currency_symbol : ''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static public function money2int($money) |
|
|
static public function money2int($money) |
|
|