Fastreport3.0,人民币大写问题

xbrave 2005-08-09 10:06:28
分组打印,用SISTEXT算出合计金额。怎么样转换成人民币大写。如果用函数写在什么地方,怎么调用?我搜索了以前的贴子,也没有明确答案。请朋友们帮忙。
...全文
307 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
xbrave 2005-08-18
  • 打赏
  • 举报
回复
lwh006朋友:哈哈,客户不赶时代我们赶时代有什么用,人家发票要求呀,有这一项内容。道理是对,可我们也没办法。最后我还是在Quickreport中解决。谢谢朋友的帮助。结贴。。。。
LWH008 2005-08-18
  • 打赏
  • 举报
回复
前些天我也在搞这个,现在我放弃,不再弄什么大写了.原因是:大写金额是手工时代的做法,在信息时代没有多少必要性. 呵呵,与时俱进~~
hqhhh 2005-08-11
  • 打赏
  • 举报
回复
呵呵!
如果根据记录生成的合计,可能不行,不过也不一定,再试试看!
LWH008 2005-08-11
  • 打赏
  • 举报
回复
hqhhh(枫叶) 的做法,如果数据是依赖于记录的,也就是说它是不固定的,行吗?
xbrave 2005-08-11
  • 打赏
  • 举报
回复
搞了几天也不能通过,SysMemo1是根据记录生成的合计,放了一个Memo1,用来显示大写。请朋友们再帮助试试,转换函数是Smalltobig。
xbrave 2005-08-10
  • 打赏
  • 举报
回复
谢谢,在fastreport3.0中怎么加自定义函数呀
xbrave 2005-08-10
  • 打赏
  • 举报
回复
hqhhh(枫叶) 朋友:我也想这么做,我是如果Systext是一组的合计,我再加MEMO1,为合计大写,那么在打印PrintBtn中怎么写,我Form1我已经写上函数了,如SmalltoBig,谢谢!!!
dengyueguang 2005-08-10
  • 打赏
  • 举报
回复
不知道,关注。
abcdefgdeng 2005-08-10
  • 打赏
  • 举报
回复
UP
hqhhh 2005-08-10
  • 打赏
  • 举报
回复
其实你要转换一下思路,
不需要在fastreport中加定义函数,而在程序中加,
然后在打印报表之前给报表中的字段赋值,这样实现比较好一些,
不然需要做大小转换的报表都需在要报表中加自定义函数,如果函数有误,要修改函数,其不是很麻烦!
78hgdong 2005-08-10
  • 打赏
  • 举报
回复
fastreport3.0加自定义函数看帮助有的.
太空11 2005-08-10
  • 打赏
  • 举报
回复
mark
merkey2002 2005-08-09
  • 打赏
  • 举报
回复
写个转换函数啊
这个是我很早很早以前写的,你参考一下,至于在哪里调用,没想到好的法子。。。你试试能不能把它改在fastreport里面。
function small2big(sourcemoney:currency):string;
var
strsourcemoney,strobjectmoney:string;
//strsourcemoney 保存未转换的小写字符串
//strobjectmoney 保存已转换的大写字符串
thiswei,thispos:string[2];
//thiswei为当前位的大写,thispos为当前位的人民币单位
iwei,pospoint:integer;
//iwei为当前位置,pospoint为小数点的位置
begin
strsourcemoney:=formatfloat('0.00',sourcemoney);
//将浮点数转换成指定格式字符串
if length(strsourcemoney)>15 then //超过千亿元
begin
showmessage('please input correct number');
exit;
end;
pospoint:=pos('.',strsourcemoney);//小数点位置
for iwei:=length(strsourcemoney) downto 1 do
begin

case pospoint-iwei of
-3: thispos:='厘' ;
-2: thispos:='分';
-1: thispos:='角';
1: thispos:='元';
2: thispos:='拾';
3: thispos:='佰';
4:thispos:='千';
5: thispos:='万';
6: thispos:='拾';
7:thispos:='佰';
8: thispos:='千';
9: thispos:='亿';
10: thispos:='十';
11: thispos:='佰';
12: thispos:='千';
end;
case strsourcemoney[iwei] of
'.': continue ;
'1': thiswei:='壹' ;
'2': thiswei:='贰';
'3': thiswei:='叁';
'4': thiswei:='肆';
'5': thiswei:='伍';
'6': thiswei:='陆';
'7': thiswei:='柒';
'8': thiswei:='捌';
'9': thiswei:='玖';
'0':
begin
thiswei:='';
if iwei<length(strsourcemoney) then
if (strsourcemoney[iwei+1]<>'0') and (strsourcemoney[iwei+1]<>'.') then
thiswei:='零';
if (thispos<>'亿') and (thispos<>'万') and (thispos<>'元') then
thispos:='' //单位是十,百、仟 的,为0,则不显示单位。
else
thiswei:='';//若单位为亿、万、元,则前一位0,不显示'零'
end;
end;
strobjectmoney:=thiswei+thispos+strobjectmoney;//组合成大写金额
end;
strobjectmoney:=ansireplacetext(strobjectmoney,'亿万','亿'); //去掉'亿万'中的'万'
if ansicontainsstr(strobjectmoney,'分') then
small2big:=strobjectmoney
else
begin
strobjectmoney:=strobjectmoney+'整';
small2big:=strobjectmoney;
end;
end;

2,497

社区成员

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

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