Functions written by Informix 4GL to convert to uppercase amount strings

Source: Internet
Author: User
Tags informix uppercase character

#######################################

# #这个函数输入金额, return the uppercase character Amount # #

# #bellchiuATNanJingCITIC: em13: # #

#######################################

FUNCTIONF_CONV_GB (Pf_money)
Definepf_moneydecimal (14,2)
Definell_money INTEGER
Definei SMALLINT
Defineli_bit SMALLINT
Defineli_lengthsmallint
Defineli_len SMALLINT
Definels_money CHAR (20)
Definels_resultchar (64)
Definels_arr_num Array[10]ofchar (2)
Definels_arr_unit Array[14]ofchar (2)
Definels_arr_unit0array[14]ofchar (2)
letls_arr_num[1]= ' One '
letls_arr_num[2]= ' II '
Letls_arr_num[3]= ' three '
Letls_arr_num[4]= ' Restaurant '
Letls_arr_num[5]= ' Wu '
Letls_arr_num[6]= ' Lu '
letls_arr_num[7]= ' Qi '
letls_arr_num[8]= ' BA '
Letls_arr_num[9]= ' JIU '
letls_arr_num[10]= ' 0 '
Let ls_arr_unit[1]= ' min '
Let ls_arr_unit[2]= ' Corner '
Let ls_arr_unit[3]= ' yuan '
Let ls_arr_unit[4]= ' pick '
Let ls_arr_unit[5]= ' Bai '
Let ls_arr_unit[6]= ' thousand '
Let ls_arr_unit[7]= ' million '
Let ls_arr_unit[8]= ' pick '
Let ls_arr_unit[9]= ' Bai '
Let ls_arr_unit[10]= ' thousand '
Let ls_arr_unit[11]= ' billion '
Let ls_arr_unit[12]= ' pick '
Let ls_arr_unit[13]= ' Bai '
Let ls_arr_unit[14]= ' thousand '
Let ls_arr_unit0[1]= ' whole '
Let ls_arr_unit0[2]= ' 0 '
Let ls_arr_unit0[3]= ' yuan '
Let ls_arr_unit0[4]= ' 0 '
Let ls_arr_unit0[5]= ' 0 '
Let ls_arr_unit0[6]= ' 0 '
Let ls_arr_unit0[7]= ' million '
Let ls_arr_unit0[8]= ' 0 '
Let ls_arr_unit0[9]= ' 0 '
Let ls_arr_unit0[10]= ' 0 '
Let ls_arr_unit0[11]= ' billion '
Let ls_arr_unit0[12]= ' 0 '
Let ls_arr_unit0[13]= ' 0 '
Let ls_arr_unit0[14]= ' 0 '
IF Pf_money=0then
Return ' 0 yuan whole '
ENDIF
Ifpf_money<0then
Letpf_money=0-pf_money
letls_result= ' Negative '
ELSE
Letls_result= '
ENDIF
Ifpf_money>999999999999.99then
returnls_result= ' value out of range '
ENDIF
Letls_money=pf_money*100using "<<<<<<<<<<<<<<"
Letli_length=length (ls_moneyclipped)
Fori=1toli_length
Letli_bit=ls_money[i]
Ifli_bit=0then
Letli_len=length (ls_resultclipped)
Ifls_result[li_len-1,li_len]<> ' 0 ' then
LETLS_RESULT=LS_RESULTCLIPPED,LS_ARR_UNIT0[LI_LENGTH-I+1]
Else
Letls_result=ls_result[1,li_len-2],
LS_ARR_UNIT0[LI_LENGTH-I+1]
endif
Else
Letls_result=ls_resultclipped,ls_arr_num[li_bit],
LS_ARR_UNIT[LI_LENGTH-I+1]
endif
ENDfor
returnls_resultclipped
Endfunction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.