Birt金额大小写转换
1.reportMoneyConvert.js
1 function formatMoney(mnum) 2 { 3 var mnum = parseFloat(mnum); 4 var strOutput="",strTemp="",strInTemp=''; 5 var unitArray = new Array("圆万亿","仟佰拾","零壹贰叁肆伍陆柒捌玖"); 6 var mnumArray = mnum.toString().split('.'); 7 var integralnum = mnumArray[0]; 8 var integrallen = integralnum.length; 9 var decimalnum = (mnum.toString().indexOf('.')>=0) ? mnumArray[1].substr(0, 2) : '0'; 10 var decimallen = decimalnum.length; 11 var ints = parseInt(integrallen/4); 12 var inty = integrallen%4; 13 if (ints>3 || (ints==3 && inty>0)) return "超出范围"; 14 if (inty>0) 15 { 16 ints++; 17 integralnum = "0000".substr(inty)+integralnum; 18 integrallen = integralnum.length; 19 } 20 var i = 0; 21 while (i<integrallen) 22 { 23 var strOutTemp = ""; 24 strTemp = integralnum.substr(i, 4); 25 i += 4; 26 for (var j=0; j<4; j++) 27 { 28 strInTemp = parseInt(strTemp.substr(j, 1)); 29 strOutTemp += unitArray[2].substr(strInTemp, 1); 30 if (strInTemp>0 && j<3) strOutTemp += unitArray[1].substr(j, 1); 31 } 32 strOutTemp = strOutTemp.replace(/零+$/, ""); 33 ints--; 34 if (strOutTemp!="") strOutTemp += unitArray[0].substr(ints, 1); 35 if (strTemp.substr(3,1)=='0') strOutTemp += "零"; 36 strOutput += strOutTemp; 37 } 38 strOutput = strOutput.replace(/零+/g, "零").replace(/^零/, "").replace(/零$/, ""); 39 if (strOutput=="圆") strOutput = ""; 40 if (decimallen==2) 41 { 42 strOutput += (decimalnum.charAt(0)!='0') ? unitArray[2].substr(parseInt(decimalnum.charAt(0)), 1)+"角" : "零"; 43 if (strOutput=="零") strOutput = ""; 44 strOutput += unitArray[2].substr(parseInt(decimalnum.charAt(1)), 1)+"分"; 45 } 46 else 47 { 48 if (decimalnum!='0') strOutput += unitArray[2].substr(parseInt(decimalnum), 1)+"角"; 49 if (strOutput!="") strOutput += "整"; 50 } 51 if (strOutput=="") strOutput = ""; 52 return strOutput; 53 }
2.报表中引用JS
3.运用
积极的人,象太阳,照到哪里哪里亮,消极的人,象月亮,初一十五不一样。想法决定我们的生活,有什么样的想法,就有什么样的未来。对于刚刚进入职场的我们,会经历很多不同的心境变化,很多时候现实跟你想象的都大相庭径,良好的心态很重要!