关于powerbuilder 中报表的问题

abcd_nonqq 2009-08-23 08:13:09
老师: 我做了一个物业收费程序,在报表问题上不是很完善,在收费的合计中如何把 13.8转换成 壹拾叁元捌角整

还有,纸张大小的设定,如何打出随项目多少而定的纸张.
...全文
96 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
newease 2009-08-24
  • 打赏
  • 举报
回复
上面代码为函数uf_dxje实现大写金额

楼主在报表中新建一个计算域表达式为:uf_dxje(金额)即可以生成
壹拾叁元捌角整


第二个问题是自定义纸张,楼主可下载示例

http://download.csdn.net/source/1483884
newease 2009-08-24
  • 打赏
  • 举报
回复
人民币大写函数,将阿拉伯数值转换成大写人民币金额

global type uf_dxje from function_object
end type

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

global function string uf_dxje (decimal data);
constant string ls_bit = "万仟佰拾亿仟佰拾万仟佰拾元角分"
constant string ls_num = "壹贰叁肆伍陆柒捌玖"
long lmax = len( ls_bit )
string ls_je, ls_dw, ls_result = '',ls_temp,ls_zhengfu
long ll_len, i, k

if data < 0.00 then
ls_zhengfu='负'
data=data* -1
else
ls_zhengfu='正'
end if


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+1, 2 )
k = long( mid( ls_je, i, 1 ) )
if k = 0 then
choose case ls_dw
case '亿'
// //判断亿元级别的位数是不是全为零[开始]

ls_result = ls_dw + ls_result
case '万'
//判断万元级别的位数是不是全为零[开始]
if i =ll_len -6 then
// ls_temp=replace(ls_je, ll_len - 6, 6, '' )/*此处按照replace的使用说明不能得出正确结果,后来经过测试,发现是pb90的replace函数在处理纯数字时跟使用说明里的不一致*/
ls_temp=replace(ls_je, i+1, 6, '' )
if right(ls_temp,4)='0000' then
else
ls_result = ls_dw + ls_result
end if
else
ls_result = ls_dw + ls_result
end if
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, 2*(k -1)+1 , 2 ) + ls_dw + ls_result
end if

next
if ls_zhengfu='负' then
ls_result='负'+ls_result
else

end if
if ls_result='整' then
return ''
else
return ls_result
end if

end function
jlwei888 2009-08-23
  • 打赏
  • 举报
回复
http://download.csdn.net/source/307366
http://download.csdn.net/source/1343213

752

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧