X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fcurrent_user.inc;h=a913bf5e56789ef8ddfc66e85aafd6d3a8a4dc21;hb=deb258224a97804610393ef563d45b5af5c5243a;hp=a86d00d3058ac68493f56c34e47cfabd659501a3;hpb=da8311619dd73feae101d246a1957b972e00cbd2;p=fa-stable.git diff --git a/includes/current_user.inc b/includes/current_user.inc index a86d00d3..a913bf5e 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -113,6 +113,45 @@ function number_format2($number, $decimals=0) return number_format($number, $decimals, $dsep, $tsep); } +function price_format($number) { + return number_format2($number, + $_SESSION["wa_current_user"]->prefs->price_dec()); +} + +function qty_format($number) { + return number_format2($number, + $_SESSION["wa_current_user"]->prefs->qty_dec()); +} + +function exrate_format($number) { + return number_format2($number, + $_SESSION["wa_current_user"]->prefs->exrate_dec()); +} + +function percent_format($number) { + return number_format2($number, + $_SESSION["wa_current_user"]->prefs->percent_dec()); +} + +function user_numeric($input) { + global $decseps, $thoseps; + + $num = trim($input); + $sep = $thoseps[user_tho_sep()]; + if($sep!='') $num = str_replace( $sep, '', $num); + str_replace($sep, '', $num); + $sep = $decseps[user_dec_sep()]; + if($sep!='.') $num = str_replace( $sep, '.', $num); + + if (!is_numeric($num)) + return false; + $num = (float)$num; + if ($num == (int)$num) + return (int)$num; + else + return $num; +} + function user_company() { return $_SESSION["wa_current_user"]->company;