Conversion functions of RMB uppercase in Crystal Reports
Function RMB (LS as currency) as string
Dim dx_sz as string
Dim dx_dw as string
Dim str_int as string
Dim str_dec as string
Dim dx_str as string
Dim Fu as string
Dim A as string
Dim B as string
Dim C as string
Dim D as string
Dim B2 as string
Dim num_int as number
Dim num_dec as currency
Dim len_int as number
Dim I as number
Dim a_int as number
Dim PP as number
Dx_sz = ""
Dx_dw = "tens of thousands of yuan, hundreds of millions of yuan, tens of thousands of yuan"
If ls <0 then
Ls = ABS (LS)
Fu = "negative"
Else
Fu = ""
End if
Dx_str = CSTR (LS)
Dx_str = Replace (dx_str, "¥ ","")
Dx_str = Replace (dx_str ,",","")
If (LS> 0) and (LS <1) Then dx_str = "0" + dx_str
Pp = instr (dx_str ,".")
If PP> 0 then
Str_int = mid (dx_str, 1, instr (dx_str, ".")-1)
Else
Str_int = dx_str
End if
Num_int = tonumber (str_int)
If (LS> 0) and (LS <1) then
Num_dec = ls * 100
Else
Num_dec = (ls-num_int) * 100
End if
Str_dec = totext (num_dec)
Str_dec = Replace (str_dec, "¥ ","")
Len_int = Len (str_int)
Dx_str = ""
For I = 1 to len_int
A = mid (str_int, I, 1)
A_int = tonumber ()
B = mid (dx_sz, (a_int + 1), 1)
C = mid (dx_dw, (13-len_int + I), 1)
If dx_str <> "then
D = mid (dx_str, Len (dx_str)-1, 1)
Else
D = ""
End if
If (B = "zero") and (D = "zero") or (B = b2) or (C = "Yuan") or (C = "Ten Thousand ") or (C = "") then B = ""
If (A = "0") and (C <> "") Then c = ""
If (C = "") or (C = "") or (C = "") and (D = "0 ") and (A = "0") then
Dx_str = mid (dx_str, 1, Len (dx_str)-2)
D = mid (dx_str, Len (dx_str)-1, 2)
If (C = "") and (D = "") or (C = "") and (D = "")) then c = ""
End if
Dx_str = dx_str + B + C
B2 = B
Next I
'Processing amount less than 1
If Len (dx_str) <= 2 then dx_str = ""
If (num_dec <10) and (LS> 0) then
A_int = tonumber (str_dec)
B = mid (dx_sz, (a_int + 1), 1)
If num_dec = 0 then dx_str = dx_str + "integer"
If num_dec> 0 then dx_str = dx_str + "zero" + B + "points"
End if
If num_dec> = 10 then
A_int = tonumber (mid (str_dec, 1, 1 ))
A = mid (dx_sz, (a_int + 1), 1)
A_int = tonumber (mid (str_dec, 2, 1 ))
B = mid (dx_sz, (a_int + 1), 1)
If a <> "zero" Then a = a + ""
If B <> "0" then B = B + "score" else B = ""
Dx_str = dx_str + A + B
End if
If ls = 0 then dx_str = "Zero yuan whole"
Dx_str = Fu + dx_str
Dx_str = Replace (dx_str, "0 billion", "")
Dx_str = Replace (dx_str, "0 thousand", "Ten Thousand ")
Dx_str = Replace (dx_str, "", "")
Dx_str = Replace (dx_str, "0 RMB", "RMB ")
RMB = dx_str
End Function