27 lines
644 B
JavaScript
27 lines
644 B
JavaScript
/*
|
|
$Revision$
|
|
$Id$
|
|
*/
|
|
function num2curr(s) {
|
|
// debugger;
|
|
if( !isNaN(s) ) {
|
|
s = s.toFixed(2);
|
|
}
|
|
return s;
|
|
}
|
|
|
|
// Met eventueel gewenste decimaalscheider (punt of komma) maar
|
|
// nooit 1000-scheiders
|
|
function num2currEditable(fnum, decimals)
|
|
{
|
|
if (fnum == null)
|
|
return "";
|
|
|
|
if (typeof decimals == "undefined")
|
|
decimals = 2;
|
|
fnum = fnum.toFixed(decimals);
|
|
var waarde2 = (1.5).toLocaleString(); // Eventueel gewenste komma.
|
|
fnum = fnum.substring(0, fnum.length - decimals - 1) + waarde2.substring(2, 1) + fnum.substring(fnum.length - decimals);
|
|
|
|
return fnum;
|
|
} |