string SL,JE,M,DXJE
integer N,I,J,W
SL="零壹贰叁肆伍陆柒捌玖拾"
JE="分角元拾佰仟万拾佰仟亿"
M=trim(XXJE)
N=pos(M,".")
M=replace(M,N,1,"")//去掉小数点用“”代替
N=len(M)
J=N; DXJE=" " //Initialize
for I=1 to N
W=integer(mid(M,I,1))
if W>0 then
DXJE=DXJE + mid(SL,W + 1,1)
DXJE=DXJE + mid(JE,J,1)
ElseIf W=0 then
if mid(JE,J,1)="万" then
DXJE=DXJE + mid(JE,J,1)
ElseIF mid(JE,J,1)="元" then
if Len(M)=3 then
DXJE=DXJE+"零"
end if
DXJE=DXJE + "元"
if integer(mid(M,I + 1,1))>0 and Len(M) > 3 then
DXJE=DXJE + Mid(SL,W + 1,1)
end if
ELSEIf integer(mid(M,I + 1,1))>0 then
DXJE=DXJE + mid(SL,W + 1,1)
ElseIf integer(mid(M,I)) = 0 then
if J >= 7 then DXJE=DXJE + "万"
if J >= 3 then DXJE=DXJE + "元"
DXJE =DXJE + "整"
EXIT
End if
End if
J=J - 1
Next
return DXJE
string n_data,c_data,n_str
integer i
n_data=space(14 - len(trim(string(abs(num*100)))))+trim(string(abs(num)*100))
for i=1 to 14 step 1
n_str=mid(n_data,i,1)
if n_str<>" " then
if mid(n_data,i,2)="00" or (n_str="0" and (i=4 or i=8 or i=12 or i=14)) then
else
c_data=c_data+trim(mid("零壹贰叁肆伍陆柒捌玖",integer(n_str) + 1,1))
end if
if right(c_data,4)="亿万" then c_data=left(c_data,len(c_data) - 2)
end if
next
if num<0 then c_data="(负数)"+c_data
if num=0 then c_data="零圆"
if n_str="0" then c_data=c_data+"整"
return c_data
// 将钱数转化为大写函数---去掉元你改一下就可以了
//argu:decimal data
//
constant string ls_bit = "万仟佰拾亿仟佰拾万仟佰拾元角分"
constant string ls_num = "壹贰叁肆伍陆柒捌玖"
long lmax = len( ls_bit ) + 1
string ls_je, ls_dw, ls_result = ''
long ll_len, i, k
ls_je = string( data, "#############.00" )
ll_len = len( ls_je ) - 1
ls_je = replace( ls_je, ll_len - 1, 1, '' )
for i = ll_len to 1 step -1
lmax -= 2
ls_dw = mid( ls_bit, lmax, 2 )
k = long( mid( ls_je, i, 1 ) )
if k = 0 then
choose case ls_dw
case '元','万','亿'
ls_result = ls_dw + ls_result
case '分'
ls_result = '整'
case '角'
if ls_result <> '整' then ls_result = '零' + ls_result
case else
choose case left( ls_result, 2 )
case '万', '亿', '元', '零'
case else
ls_result = '零' + ls_result
end choose
end choose
else
ls_result = mid( ls_num, k * 2 - 1, 2 ) + ls_dw + ls_result
end if
next
return ls_result
$PBExportHeader$uf_money2string.srf
global type uf_money2string from function_object
end type
forward prototypes
global function string uf_money2string (decimal data)
end prototypes
global function string uf_money2string (decimal data);//////////////////////////////////////////////////////////////////////
//
// 将钱数转化为大写
//
//////////////////////////////////////////////////////////////////////
constant string ls_bit = "万仟佰拾亿仟佰拾万仟佰拾元角分"
constant string ls_num = "壹贰叁肆伍陆柒捌玖"
long lmax = len( ls_bit ) + 1
string ls_je, ls_dw, ls_result = ''
long ll_len, i, k
ls_je = string( data, "#############.00" )
ll_len = len( ls_je ) - 1
ls_je = replace( ls_je, ll_len - 1, 1, '' )
for i = ll_len to 1 step -1
lmax -= 2
ls_dw = mid( ls_bit, lmax, 2 )
k = long( mid( ls_je, i, 1 ) )
if k = 0 then
choose case ls_dw
case '元','万','亿'
ls_result = ls_dw + ls_result
case '分'
ls_result = '整'
case '角'
if ls_result <> '整' then ls_result = '零' + ls_result
case else
choose case left( ls_result, 2 )
case '万', '亿', '元', '零'
case else
ls_result = '零' + ls_result
end choose
end choose
else
ls_result = mid( ls_num, k * 2 - 1, 2 ) + ls_dw + ls_result
end if
next
return ls_result
end function