/********************************************************************/
/*函数 : f_conver_number_chinese */
/*参数 : adec_money 将要转换为大写金额的数字 */
/*返回值: string */
/*撰写人: huwenbin 2009/06/5 */
/********************************************************************/
string ls_money_unit,ls_money,ls_nuit,ls_badge
int li_long,li_i
ls_money = trim(string(round(adec_money,2)))
do while left(ls_money,1) = '0'
ls_money = mid(ls_money,2)
loop
li_long = len(ls_money)
for li_i = 1 to li_long
ls_nuit = right(ls_money,li_i)
ls_nuit = left(ls_nuit,1)
choose case ls_nuit
case '.'
ls_nuit = ''
case '1'
ls_nuit = '壹'
case '2'
ls_nuit = '贰'
case '3'
ls_nuit = '叁'
case '4'
ls_nuit = '肆'
case '5'
ls_nuit = '伍'
case '6'
ls_nuit = '陆'
case '7'
ls_nuit = '柒'
case '8'
ls_nuit = '捌'
case '9'
ls_nuit = '玖'
case '0'
ls_nuit = '零'
end choose
choose case li_i
case 1
ls_badge = '分'
case 2
ls_badge = '角'
case 3
ls_badge = ''
case 4
ls_badge = '元'
case 5,9,13
ls_badge = '拾'
case 6,10,14
ls_badge = '佰'
case 7,11,15
ls_badge = '仟'
case 8
ls_badge = '万'
case 12
ls_badge = '亿'
end choose
if li_i = 4 and ls_nuit = '零' then
ls_money_unit = '元' + ls_money_unit
end if
if pos(ls_money_unit,'万') = 0 then
if li_i > 7 and ls_nuit = '零' then
ls_money_unit = '万' + ls_money_unit
end if
end if
if pos(ls_money_unit,'亿') = 0 then
if li_i > 11 and ls_nuit = '零' then
ls_money_unit = '亿' + ls_money_unit
end if
end if
if ls_nuit <> '零' then
ls_money_unit = ls_nuit + ls_badge + ls_money_unit
else
ls_money_unit = ls_nuit + ls_money_unit
end if
int pos1,pos2,pos3,pos4
pos1 = pos(ls_money_unit,'零元')
if pos1 > 0 then
ls_money_unit = replace(ls_money_unit,pos1,4,'元零')
end if
pos2 = pos(ls_money_unit,'零万')
if pos2 > 0 then
ls_money_unit = replace(ls_money_unit,pos2,4,'万零')
end if
pos3 = pos(ls_money_unit,'零亿')
if pos3 > 0 then
ls_money_unit = replace(ls_money_unit,pos3,4,'亿零')
end if
pos4 = pos(ls_money_unit,'零零')
if pos4 > 0 then
ls_money_unit = replace(ls_money_unit,pos4,2,'')
end if
next
if right(ls_money_unit, 2) = '零' then
ls_money_unit = left(ls_money_unit,len(ls_money_unit) - 2)
end if
if right(ls_money_unit, 2) = '元' then
ls_money_unit = ls_money_unit + '整'
end if
return ls_money_unit
//有些地方写得不是很严密,希望提出好的意见!