DEFINE ls_arr_num ARRAY [10] OF CHAR(2) DEFINE ls_arr_unit ARRAY [14] OF CHAR(2) DEFINE ls_arr_unit0 ARRAY [14] OF CHAR(2)
LET ls_arr_num[1] ='壹' LET ls_arr_num[2] ='贰' LET ls_arr_num[3] ='叁' LET ls_arr_num[4] ='肆' LET ls_arr_num[5] ='伍' LET ls_arr_num[6] ='陆' LET ls_arr_num[7] ='柒' LET ls_arr_num[8] ='捌' LET ls_arr_num[9] ='玖' LET ls_arr_num[10]='零'
LET ls_arr_unit[ 1] = '分' LET ls_arr_unit[ 2] = '角' LET ls_arr_unit[ 3] = '元' LET ls_arr_unit[ 4] = '拾' LET ls_arr_unit[ 5] = '佰' LET ls_arr_unit[ 6] = '仟' LET ls_arr_unit[ 7] = '万' LET ls_arr_unit[ 8] = '拾' LET ls_arr_unit[ 9] = '佰' LET ls_arr_unit[10] = '仟' LET ls_arr_unit[11] = '亿' LET ls_arr_unit[12] = '拾' LET ls_arr_unit[13] = '佰' LET ls_arr_unit[14] = '仟'
LET ls_arr_unit0[ 1] = '整' LET ls_arr_unit0[ 2] = '零' LET ls_arr_unit0[ 3] = '元' LET ls_arr_unit0[ 4] = '零' LET ls_arr_unit0[ 5] = '零' LET ls_arr_unit0[ 6] = '零' LET ls_arr_unit0[ 7] = '万' LET ls_arr_unit0[ 8] = '零' LET ls_arr_unit0[ 9] = '零' LET ls_arr_unit0[10] = '零' LET ls_arr_unit0[11] = '亿' LET ls_arr_unit0[12] = '零' LET ls_arr_unit0[13] = '零' LET ls_arr_unit0[14] = '零'
IF pf_money=0 THEN RETURN '零元整' END IF IF pf_money<0 THEN LET pf_money=0 - pf_money LET ls_result='负 ' ELSE LET ls_result='' END IF IF pf_money>999999999999.99 THEN RETURN ls_result='数值超出范围' END IF
LET ls_money=pf_money*100 USING "<<<<<<<<<<<<<<" LET li_length=length(ls_money CLIPPED)
for i=1 to li_length
LET li_bit=ls_money
if li_bit=0 then LET li_len=length(ls_result CLIPPED) if ls_result[li_len - 1, li_len]<>'零' then LET ls_result = ls_result CLIPPED, ls_arr_unit0[li_length - i + 1] else LET ls_result = ls_result[1, li_len - 2], ls_arr_unit0[li_length - i + 1] end if else LET ls_result = ls_result CLIPPED, ls_arr_num[li_bit], ls_arr_unit [li_length -i + 1] end if END FOR