FastReport中怎么定义报表大写金额

我们在设计FastReport报表时,遇到客户有可能需要显示的是大写金额,可以用如下方法设计报表解决.

首先要改为大写金额的用[tt]做为变量定义

然后在文本编辑器里写代码

代码:

begin
  qianwei:=-2;
  Smallmonth:=formatfloat('0.00',[QueryBody."iamt"]);
  dianweizhi :=pos('.',Smallmonth);
  tt :='';
  BigMonth:='';
  qian:=length(Smallmonth);
  while qian>0 do
  begin
    if qian<>dianweizhi then
    begin
      i:=copy(Smallmonth,qian,1);
      if i='1' then wei1:='壹'
      else if i='2' then wei1:='贰'
      else if i='3' then wei1:='叁'
      else if i='4' then wei1:='肆'
      else if i='5' then wei1:='伍'
      else if i='6' then wei1:='陆'
      else if i='7' then wei1:='柒'
      else if i='8' then wei1:='捌'
      else if i='9' then wei1:='玖'
      else if i='0' then wei1:='零';
      if qianwei=-3      then  qianwei1:='厘'
      else if qianwei=-2 then  qianwei1:='分'
      else if qianwei=-1 then  qianwei1:='角'
      else if qianwei=0  then  qianwei1:='元'
      else if qianwei=1  then  qianwei1:='拾'
      else if qianwei=2  then  qianwei1:='佰'
      else if qianwei=3  then  qianwei1:='千'
      else if qianwei=4  then  qianwei1:='万'
      else if qianwei=5  then  qianwei1:='拾'
      else if qianwei=6  then  qianwei1:='佰'
      else if qianwei=7  then  qianwei1:='千'
      else if qianwei=8  then  qianwei1:='亿'
      else if qianwei=9  then  qianwei1:='十'
      else if qianwei=10 then  qianwei1:='佰'
      else if qianwei=11 then  qianwei1:='千';
      inc(qianwei);
      BigMonth :=wei1+qianwei1+BigMonth;
    end;
    dec(qian);
  end;
  tt := BigMonth;
end

按照上面的办法轻松搞定.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ok060

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值