回复 7楼 tlliqi
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
*********************
FUNC NumTxt
&&数字金额变大写
*********************
para lnDollar
priv x1,x2,x3,x4,c1,c2,c3,zf
zf=""
do case
case lnDollar>999999999999.99
retu"金额太大,不能计算"
case lnDollar=0
retu "零元整"
case lnDollar<0
lnDollar=abs(lnDollar)
zf="负"
endcase
C1='壹贰叁肆伍陆柒捌玖'
C2='仟佰拾 '
C3='角分'
lcDollar = ALLTRIM(TRAN(lnDollar,"999999999999.99"))
lcDollar=repl('0',15-len(lcDollar))+lcDollar
x1=get_money(subst(lcDollar,1,4))
&& 得到亿位数
x2=get_money(subst(lcDollar,5,4))
&& 得到万位数
x3=get_money(subst(lcDollar,9,4))
&& 得到圆位数
x4=get_cents(subst(lcDollar,14,2)) && 得到分位数
lcText=iif(empty(x1),"",x1+"亿")+iif(empty(x2),"",x2+"万")+iif(empty(x3),"",x3)+"元"+x4+iif(right(x4,2)='分',"","整")
if left(lcText,2)="零"
lcText=subst(lcText,3,len(lcText)-2)
endif
if left(lcText,4)="壹拾"
lcText=right(lcText,len(lcText)-2)
endif
retu zf+lcText
FUNC get_money
LPARAMETER lcNumber
priv lcTemp,lcNum,lcString
lcNum=""
lcTemp=""
for n=1 to 4
lcNum=subst(lcNumber,n,1)
if lcNum="0"
lcString="零"
else
lcString=subst(c1,val(lcNum)*2-1,2)+subst(c2,n*2-1,2)
endif
if !(right(lcTemp,2)="零" and lcString="零")
lcTemp=lcTemp+lcString
endif
endfor
lcTemp=iif(lcTemp=="零","",allt(lcTemp))
if right(lcTemp,2)="零"
lcTemp=left(lcTemp,len(lcTemp)-2)
endif
retu allt(lcTemp)