pb 大写人民币

global type gf_money from function_object
end type

forward prototypes
global function string gf_money (decimal data)
end prototypes

global function string gf_money (decimal data);constant string ls_bit = "万仟佰拾亿仟佰拾万仟佰拾元角分"
constant string ls_num = "壹贰叁肆伍陆柒捌玖"
long lmax = len( ls_bit ) + 1
string ls_je, ls_dw, ls_result = ''
long ll_len, i, k
ls_je = string( data, "#############.00" )
ll_len = len( ls_je ) - 1
ls_je = replace( ls_je, ll_len - 1, 1, '' )
for i = ll_len to 1 step -1
	lmax -= 2
	ls_dw = mid( ls_bit, lmax, 2 )
	k = long( mid( ls_je, i, 1 ) )
	if k = 0 then
		choose case ls_dw
			case '元','万','亿'
				ls_result = ls_dw + ls_result
			case '分'
				ls_result = '整'
			case '角'
				if ls_result <> '整' then ls_result = '零' + ls_result
			case else
				choose case left( ls_result, 2 )
					case '万', '亿', '元', '零'
					case else
						ls_result = '零' + ls_result
				end choose
		end choose
	else
		ls_result = mid( ls_num, k * 2 - 1, 2 ) + ls_dw + ls_result
	end if
next
return ls_result
end function

global type gf_money2 from function_object
end type

forward prototypes
global function string gf_money2 (decimal data, string lx)
end prototypes

global function string gf_money2 (decimal data, string lx);//
//
//		将钱数转化为大写		
//
//
constant string ls_bit = "万仟佰拾亿仟佰拾万仟佰拾元角分"
constant string ls_num = "壹贰叁肆伍陆柒捌玖"
long lmax = len( ls_bit ) + 1
string ls_je, ls_dw, ls_result = ''
long ll_len, i, k

ls_je = string( data, "#############.00" )
ll_len = len( ls_je ) - 1
ls_je = replace( ls_je, ll_len - 1, 1, '' )

for i = ll_len to 1 step -1
	lmax -= 2
	ls_dw = mid( ls_bit, lmax, 2 )
	k = long( mid( ls_je, i, 1 ) )
	if k = 0 then
		choose case ls_dw
			case '元','万','亿'
				ls_result = ls_dw + ls_result
			case '分'
				ls_result = '整'
			case '角'
				if ls_result <> '整' then ls_result = '零' + ls_result
			case else
				choose case left( ls_result, 2 )
					case '万', '亿', '元', '零'
					case else
						ls_result = '零' + ls_result
				end choose
		end choose
	else
		ls_result = mid( ls_num, k * 2 - 1, 2 ) 
	end if
	if lx=ls_dw then
		return ls_result
	end if
next
return "error"
end function

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值