mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-02-02 13:41:05 -05:00
30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
/** GARRISON MODIFIED 4/20/2013 **/
|
|
function to_currency($number)
|
|
{
|
|
$CI =& get_instance();
|
|
$currency_symbol = $CI->config->item('currency_symbol') ? $CI->config->item('currency_symbol') : '$';
|
|
$thousands_separator = $CI->config->item('thousands_separator') ? $CI->config->item('thousands_separator') : '';
|
|
$decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.';
|
|
if($number >= 0)
|
|
{
|
|
if($CI->config->item('currency_side') !== 'currency_side')
|
|
return $currency_symbol.number_format($number, 2, $decimal_point, $thousands_separator);
|
|
else
|
|
return number_format($number, 2, $decimal_point, $thousands_separator).$currency_symbol;
|
|
}
|
|
else
|
|
{
|
|
if($CI->config->item('currency_side') !== 'currency_side')
|
|
return '-'.$currency_symbol.number_format(abs($number), 2, $decimal_point, $thousands_separator);
|
|
else
|
|
return '-'.number_format(abs($number), 2, $decimal_point, $thousands_separator).$currency_symbol;
|
|
}
|
|
}
|
|
/** END MODIFIED **/
|
|
|
|
function to_currency_no_money($number)
|
|
{
|
|
return number_format($number, 2, '.', '');
|
|
}
|
|
?>
|