public
string
NumToChs(
decimal
a_money)
... {
try
...{
string ls_money,ls_chinese="",ls_ZF = "+";
int l_len,l_last,l_bit,l_bit_prior=0,l_location = 0;
if(a_money < 0)
...{
ls_ZF = "-";
a_money = 0.0M - a_money;
}
ls_money = a_money.ToString("0.00");
l_len = ls_money.Length;
l_last = l_len -1;
ls_money = ls_money.Substring(0,l_len-3)+ls_money.Substring(l_last-1,2);
l_last -= 1;
for(int i=l_last;i>=0;i--)
...{
l_location ++;
l_bit = int.Parse(ls_money.Substring(i,1));
if(l_bit==0&l_bit_prior!=0) ls_chinese = "零"+ls_chinese;
if(l_location==1&l_bit!=0) ls_chinese = "分"+ls_chinese;
if(l_location==2&l_bit!=0) ls_chinese = "角"+ls_chinese;
if(l_location==3) ls_chinese = "圆"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==0&l_bit!=0) ls_chinese = "拾"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==1&l_bit!=0) ls_chinese = "佰"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==2&l_bit!=0) ls_chinese = "仟"+ls_chinese;
if(l_location==7|l_location==15) ls_chinese = "万"+ls_chinese;
if(l_location==11) ls_chinese = "亿"+ls_chinese;
if(l_bit==1) ls_chinese = "壹"+ls_chinese;
if(l_bit==2) ls_chinese = "贰"+ls_chinese;
if(l_bit==3) ls_chinese = "叁"+ls_chinese;
if(l_bit==4) ls_chinese = "肆"+ls_chinese;
if(l_bit==5) ls_chinese = "伍"+ls_chinese;
if(l_bit==6) ls_chinese = "陆"+ls_chinese;
if(l_bit==7) ls_chinese = "柒"+ls_chinese;
if(l_bit==8) ls_chinese = "捌"+ls_chinese;
if(l_bit==9) ls_chinese = "玖"+ls_chinese;
l_bit_prior = l_bit;
}
if(ls_ZF=="-") ls_chinese = "退回 "+ls_chinese;
return ls_chinese;
}
catch(Exception ex)
...{
throw new Exception(ex.Message.ToString());
}
}
... {
try
...{
string ls_money,ls_chinese="",ls_ZF = "+";
int l_len,l_last,l_bit,l_bit_prior=0,l_location = 0;
if(a_money < 0)
...{
ls_ZF = "-";
a_money = 0.0M - a_money;
}
ls_money = a_money.ToString("0.00");
l_len = ls_money.Length;
l_last = l_len -1;
ls_money = ls_money.Substring(0,l_len-3)+ls_money.Substring(l_last-1,2);
l_last -= 1;
for(int i=l_last;i>=0;i--)
...{
l_location ++;
l_bit = int.Parse(ls_money.Substring(i,1));
if(l_bit==0&l_bit_prior!=0) ls_chinese = "零"+ls_chinese;
if(l_location==1&l_bit!=0) ls_chinese = "分"+ls_chinese;
if(l_location==2&l_bit!=0) ls_chinese = "角"+ls_chinese;
if(l_location==3) ls_chinese = "圆"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==0&l_bit!=0) ls_chinese = "拾"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==1&l_bit!=0) ls_chinese = "佰"+ls_chinese;
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==2&l_bit!=0) ls_chinese = "仟"+ls_chinese;
if(l_location==7|l_location==15) ls_chinese = "万"+ls_chinese;
if(l_location==11) ls_chinese = "亿"+ls_chinese;
if(l_bit==1) ls_chinese = "壹"+ls_chinese;
if(l_bit==2) ls_chinese = "贰"+ls_chinese;
if(l_bit==3) ls_chinese = "叁"+ls_chinese;
if(l_bit==4) ls_chinese = "肆"+ls_chinese;
if(l_bit==5) ls_chinese = "伍"+ls_chinese;
if(l_bit==6) ls_chinese = "陆"+ls_chinese;
if(l_bit==7) ls_chinese = "柒"+ls_chinese;
if(l_bit==8) ls_chinese = "捌"+ls_chinese;
if(l_bit==9) ls_chinese = "玖"+ls_chinese;
l_bit_prior = l_bit;
}
if(ls_ZF=="-") ls_chinese = "退回 "+ls_chinese;
return ls_chinese;
}
catch(Exception ex)
...{
throw new Exception(ex.Message.ToString());
}
}