function fomatMoney(controlName,controlValue){
//去掉前导'0'
controlValue = controlValue.replace(/^0+([0-9])/,'$1');
//判定是否为数字
if(/[^0-9/.,]/.test(controlValue)){
alert("货币金额必须为数字!");
if(controlName == 'goodsValue'){
document.forms[0].goodsValue.focus();
}else if(controlName == 'saleAmount'){
document.forms[0].saleAmount.focus();
}else if(controlName == 'illegalIncome'){
document.forms[0].illegalIncome.focus();
}
return ;
}
controlValue=controlValue.replace(/^(/d*)$/,"$1.");
controlValue=(controlValue+"00").replace(/(/d*/./d/d)/d*/,"$1");
controlValue=controlValue.replace(".",",");
var re=/(/d)(/d{3},)/;
while(re.test(controlValue)){
controlValue=controlValue.replace(re,"$1,$2");
}
controlValue=controlValue.replace(/,(/d/d)$/,".$1");
controlValue=controlValue.replace(/^/./,"0.");
if(controlName == 'goodsValue'){
document.forms[0].goodsValue.value = controlValue;
}else if(controlName == 'saleAmount'){
document.forms[0].saleAmount.value = controlValue;
}else if(controlName == 'illegalIncome'){
document.forms[0].illegalIncome.value = controlValue;
}
}