Function Total (ls as number) 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 Number
Dim len_int As Number
Dim i As Number
Dim a_int As Number
Dim pp As Number
dx_sz= "0 One and three Woolu qi Ba Jiu"
dx_dw= "Thousands of thousand hundred million thousand to pick up thousands of thousand gather round"
If Ls=0 then dx_str= "0 rounding"
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 (a)
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= "0") and ((d= "0") or (B=B2) or (c= "circle") or (c= "million") or (c= "million") then b= ""
if (a= "0") and (c<> "Circle") and (c<> "million") and (c<> "billion") then c= ""
if (c= "circle") or (c= "million") or (c= "billion")) 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= "Circle") and (d= "million")) or ((c= "Million") and (d= "billion")) then c= ""
End If
Dx_str=dx_str+b+c
B2=b
Next I
' handling of amounts 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+ "whole"
If Num_dec>0 then dx_str=dx_str+ "0" +b+ "min"
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<> "0" then a=a+ "angle"
If b<> "0" then b=b+ "minute" Else b= ""
Dx_str=dx_str+a+b
End If
Dx_str=fu+dx_str
Dx_str=replace (Dx_str, "0", "billion")
Dx_str=replace (Dx_str, "0", "million")
Dx_str=replace (Dx_str, "0", "thousand")
Dx_str=replace (Dx_str, "0 yuan", "circle")
Total =dx_str
End Function
Crystal Report Small to large write the function number-VB