1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- $PBExportHeader$f_convert.srf
- $PBExportComments$金额大写--函数
- global type f_convert from function_object
- end type
- forward prototypes
- global function string f_convert (decimal ad_number)
- end prototypes
- global function string f_convert (decimal ad_number);string ls_hz1[15],ls_hz2[10],ls_return,ls_temp,ls_argument
- int li_1,li_len
- boolean lb_first_zero
- ls_hz1[1]="分"
- ls_hz1[2]="角"
- ls_hz1[3]=""
- ls_hz1[4]="元"
- ls_hz1[5]="拾"
- ls_hz1[6]="佰"
- ls_hz1[7]="仟"
- ls_hz1[8]="万"
- ls_hz1[9]="拾"
- ls_hz1[10]="佰"
- ls_hz1[11]="仟"
- ls_hz1[12]="亿"
- ls_hz1[13]="拾"
- ls_hz1[14]="佰"
- ls_hz1[15]="仟"
- ls_hz2[1]="壹"
- ls_hz2[2]="贰"
- ls_hz2[3]="叁"
- ls_hz2[4]="肆"
- ls_hz2[5]="伍"
- ls_hz2[6]="陆"
- ls_hz2[7]="柒"
- ls_hz2[8]="捌"
- ls_hz2[9]="玖"
- ls_hz2[10]="零"
- if ad_number=0 then return '零元整'
- ls_argument=string(ad_number,"0.00")
- if len(ls_argument)>15 then return ''// 数值不能大于千亿
- if right(ls_argument,1)='0' then ls_return='整'
- do while true
- li_1 += 1
- li_len=len(ls_argument)
- ls_temp=right(ls_argument,1)
- ls_argument=left(ls_argument,li_len - 1)
- if ls_temp='' or isnull(ls_temp) then
- exit
- end if
- if ls_temp='.' then
- continue
- end if
- if ls_temp='-' then
- ls_return='负'+ls_return
- continue
- end if
- if ls_temp<>'0' then
- ls_return=ls_hz2[integer(ls_temp)]+ls_hz1[ li_1 ]+ls_return
- lb_first_zero=true
- else
- if lb_first_zero then
- if (li_1<>4 and li_1<>2) or dec(ls_argument)<>0 then
- ls_return='零'+ls_return
- end if
- lb_first_zero=false
- end if
- if li_1=12 or li_1=8 then
- if right(ls_argument,3)<>'000' then ls_return=ls_hz1[li_1]+ls_return
- end if
- if li_1=4 then
- if dec(ls_argument)<>0 then ls_return=ls_hz1[li_1]+ls_return
- end if
- end if
- loop
- return ls_return
- end function
|