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

金额大写

2017-09-20 8页 doc 38KB 77阅读

用户头像

is_682974

暂无简介

举报
金额大写金额大写 ,金额额入 框 //inIdID ,大额出 写框  //outIdID ,保存大的文本 写框//txtIdID    ,最大位;不含小,  几数数//max 使用方法,// this.Txt_Amount.Attributes["onkeyup"]="TypeAmount('Txt_Amount','L_Amount','Txt_AmountL   ab',10)"      function TypeAmount(inId,outId,txtId,max)  { var obj = document.getEle...
金额大写
金额大写 ,金额额入 框 //inIdID ,大额出 写框  //outIdID ,保存大的文本 写框//txtIdID    ,最大位;不含小,  几数数//max 使用方法,// this.Txt_Amount.Attributes["onkeyup"]="TypeAmount('Txt_Amount','L_Amount','Txt_AmountL   ab',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=lcMoney+'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,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索