为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

金额大写

2017-09-21 5页 doc 21KB 24阅读

用户头像

is_954223

暂无简介

举报
金额大写金额大写 //inId?º?ð?îÊäÈë?ò ID //outId?º?óÐ?Êä?ö?ò ID //txtId?º???æ?óÐ?µÄÎÄ???ò ID //max?º×î?ó??Î?Êý????º?Ð?Êý?? //Ê?ÓÃ?????ºthis.Txt_Amount.Attributes["onkeyup"]="TypeAmount('Txt _Amount','L_Amount','Txt_AmountLab',10)" function TypeAmount(inId,outId,txtId,max) ...
金额大写
金额大写 //inId?º?ð?îÊäÈë?ò ID //outId?º?óÐ?Êä?ö?ò ID //txtId?º???æ?óÐ?µÄÎÄ???ò ID //max?º×î?ó??Î?Êý????º?Ð?Êý?? //Ê?ÓÃ?????ºthis.Txt_Amount.Attributes["onkeyup"]="TypeAmount('Txt _Amount','L_Amount','Txt_AmountLab',10)" function TypeAmount(inId,outId,txtId,max) { var obj = document.getElementById(inId); document.getElementById(outId).innerHTML = MoneyFormat(obj.value,max); document.getElementById(txtId).value = document.getElementById(outId).innerHTML; } function MoneyFormat(aiMoney,aiMaxOut){ //?óÐ?ÈËÃñ?Òת??(ÒÔ?ÖΪµ?Î?) if (!aiMaxOut){aiMaxOut = 7;} aiMoney = aiMoney.replace(/,/g,'') ; lcMoney = parseFloat(aiMoney)+""; if (lcMoney=='NaN'){lcMoney='0.00'} if (lcMoney.indexOf('.')==-1){ lcMoney=lcMoney+".00" }else{ lcMoney=lcMoney.substring(0,lcMoney.indexOf('.')+3) if (((lcMoney.substring(lcMoney.indexOf('.'))).length)==2){lcMoney=lc Money+'0'} } lcMoneyNs = lcMoney; lcMoney = lcMoney.replace('.','') lcMoney = lcMoney.replace('-','') var liLength=lcMoney.length , lcFormat=""; for (i=1; i<=(aiMaxOut-liLength); i++){ lcMoney = '0' + lcMoney; } if (liLength>aiMaxOut){lcFormat = '?ð?îÖµ???ö??Î?!';aiMaxOut=0;} liLength=aiMaxOut; var AlterlcMoney= new Array("Áã","Ò?","??","Èþ","ËÁ","Îé","Â?","Æâ","?Æ","?Á"); for (i=1; i<=liLength; i++){ var liTempMoney = parseFloat(lcMoney.substring(liLength-i)); lcMoney = lcMoney.substring(0,liLength-i); if (i==1){lcFormat =" ?Ö " + lcFormat;} if (i==2){lcFormat =" ?Ç " + lcFormat;} if (i==3){lcFormat =" Ôª " + lcFormat;} if (i==4){lcFormat =" Ê? " + lcFormat;} if (i==5){lcFormat =" ?Û " + lcFormat;} if (i==6){lcFormat =" Çª " + lcFormat;} if (i==7){lcFormat =" Íò " + lcFormat;} if (i==8){lcFormat =" Ê? " + lcFormat;} if (i==9){lcFormat =" ?Û " + lcFormat;} if (i==10){lcFormat =" Çª "+ lcFormat;} if (i==11){lcFormat =" ÒÚ " + lcFormat;} if (i==12){lcFormat =" Ê? " + lcFormat;} if (i==13){lcFormat =" ?Û " + lcFormat;} if (i==14){lcFormat =" Çª " + lcFormat;} if (i==15){lcFormat =" Íò " + lcFormat;} lcFormat = ""+AlterlcMoney[liTempMoney]+"" + lcFormat; } lcMoney = lcFormat; return lcMoney +" Õû"; } /********************* ÒÔÏÂÊÇ C# ???? *********************/ /// /// ?ñÊ???Êý×ÖÊä?ö??Ð?Ð??ä?É?ÆÎñ?óÐ? /// /// Êý×Ö /// ÐèÒªµÄ???È public static string FormatNumberLab(string num, int len) { if (len > 15) { return "?ð?î???ö??Î?"; } string rtn = ""; string[] lc = { "Áã", "Ò?", "??", "Èþ", "ËÁ", "Îé", "Â?", "Æâ", "?Æ", "?Á" }; string[] lc2 = { "?Ö", "?Ç", "Ôª", "Ê?", "?Û", "Ǫ", "Íò", "Ê?", "?Û", "Ǫ", "ÒÚ", "Ê?", "?Û", "Ǫ", "Íò" }; //ÏÈת?É2Î?ÊýµÄÊý×Ö num = ValidateNumber(num) ? num : "0.00"; num = (decimal.Parse(num) * 100).ToString("0");//ÒÆ?ýÐ?Êýµã string lcFormat = ""; num = FormatNumberAhead(num, len+1, "0");//ÏòÇ???Æë 0 ???ÓÉÏÐ?ÊýµãÁ?Î?Êý for (int i = 0; i <= len; i++) { rtn = lcFormat + rtn; lcFormat = "" + lc[int.Parse(num[num.Length - i -1].ToString())] + ""; lcFormat += " " + lc2[i] + " "; } rtn += " Õû"; return rtn; } /// /// ?ñÊ???Êý×ÖÊä?ö??ÏòÇ???ÆëÖ???×Ö?û /// /// Êý×Ö /// ÐèÒªµÄ???È /// Ö???×Ö?û public static string FormatNumberAhead(string num, int len, string s) { string rtn = ""; if (num.Length >= len) { return num; } ArrayList arr = ArrayList.Repeat(s, len - num.Length); rtn = string.Join("", arr.ToArray(typeof(string)) as string[]) + num; return rtn; } /// /// ?ìÑéÎÄ??ÊÇ?ñΪÊý×Ö /// /// public static bool ValidateNumber(string str) { System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(@"^(\d+)?(\.(\d+))?$"); return rex.IsMatch(str); }
/
本文档为【金额大写】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索