-
-
-
-
-
- public static string GetChineseMoney(decimal num)
- {
- string str1 = "零壹贰叁肆伍陆柒捌玖";
- string str2 = "万仟佰拾亿仟佰拾万仟佰拾元角分";
- string str3 = "";
- string str4 = "";
- string str5 = "";
- int i;
- int j;
- string ch2 = "";
- string ch3 = "";
- int nzero = 0;
- int temp;
-
- if (DbUtils.Language.ToLower() == "en") return "";
- num = Math.Round(Math.Abs(num), 2);
- str4 = ((long)(num * 100)).ToString();
- j = str4.Length;
- if (j > 15) { return "溢出"; }
- str2 = str2.Substring(15 - j);
-
-
- for (i = 0; i < j; i++)
- {
- str3 = str4.Substring(i, 1);
- temp = Convert.ToInt32(str3);
- if (i != (j - 3) && i != (j - 7) && i != (j - 11) && i != (j - 15))
- {
-
- if (str3 == "0")
- {
- ch2 = "";
- ch3 = "";
- nzero = nzero + 1;
- }
- else
- {
- if (str3 != "0" && nzero != 0)
- {
- ch2 = "零" + str1.Substring(temp * 1, 1);
- ch3 = str2.Substring(i, 1);
- nzero = 0;
- }
- else
- {
- ch2 = str1.Substring(temp * 1, 1);
- ch3 = str2.Substring(i, 1);
- nzero = 0;
- }
- }
- }
- else
- {
-
- if (str3 != "0" && nzero != 0)
- {
- ch2 = "零" + str1.Substring(temp * 1, 1);
- ch3 = str2.Substring(i, 1);
- nzero = 0;
- }
- else
- {
- if (str3 != "0" && nzero == 0)
- {
- ch2 = str1.Substring(temp * 1, 1);
- ch3 = str2.Substring(i, 1);
- nzero = 0;
- }
- else
- {
- if (str3 == "0" && nzero >= 3)
- {
- ch2 = "";
- ch3 = "";
- nzero = nzero + 1;
- }
- else
- {
- if (j >= 11)
- {
- ch2 = "";
- nzero = nzero + 1;
- }
- else
- {
- ch2 = "";
- ch3 = str2.Substring(i, 1);
- nzero = nzero + 1;
- }
- }
- }
- }
- }
- if (i == (j - 11) || i == (j - 3))
- {
-
- ch3 = str2.Substring(i, 1);
- }
- str5 = str5 + ch2 + ch3;
-
- if (i == j - 1 && str3 == "0")
- {
-
- str5 = str5 + '整';
- }
- }
- if (num == 0)
- {
- str5 = "零元整";
- }
- return str5;
- }