• FastReport 金额大小写转换自定义函数


    在FastReport中编写金额数字转换大写自定义函数

    function MoneyToCharacter(Money:real):string; //数字转换为中文大写
    var
    temp:string;
    resu:string;
    i,j:integer;
    len:integer;
    Num:array[0..9] of string;
    A:array[0..13] of string;
    begin
    Num[0]:='零';
    num[1]:='壹';
    Num[2]:='贰';
    num[3]:='叁';
    Num[4]:='肆';
    num[5]:='伍';
    Num[6]:='陆';
    num[7]:='柒';
    Num[8]:='捌';
    num[9]:='玖';
    a[0]:='分';
    a[1]:='角';
    a[2]:='元';
    a[3]:='拾';
    a[4]:='佰';
    a[5]:='仟';
    a[6]:='万';
    a[7]:='拾';
    a[8]:='佰';
    a[9]:='仟';
    a[10]:='亿';
    a[11]:='拾';
    a[12]:='佰';
    a[13]:='仟';
    temp:=trim(inttostr(round(money*100)));
    len:=length(temp);
    resu:='';
    if (len>13) or (len=0) then
    begin
    exit;
    end;
    for i:=1 to len do
    begin
    j:=strtoint(copy(temp,i,1));
    resu:=resu+num[j]+a[len-i];
    end;
    len:=length(resu);
    result:=copy(resu,0,len-8);
    end;

    四舍五入,取整数

    调用函数

    procedure Memo41OnAfterData(Sender: TfrxComponent);
    begin
    memo41.text:='总金额(大写):'+MoneyToCharacter(Round(SUM(<加工."发货金额">,MasterData1)))+'整';
    TfrxMemoView(Sender).Font.Size:=12;
    while ((TfrxMemoView(Sender).CalcHeight-TfrxMemoView(Sender).LineSpacing)-TfrxMemoView(Sender).Height>0) do
    begin
    TfrxMemoView(Sender).Font.Size := TfrxMemoView(Sender).Font.Size-1;
    end;
    end;

    如下显示:

    显示浮点数属性设置 displayFormat Formatstr %2.2n
    ————————————————
    版权声明:本文为CSDN博主「心梦缘-雪雁」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/mxy906975387/article/details/93861312

  • 相关阅读:
    animate()的使用
    jQuery UI中datepicker()的使用
    newsletter 在不同邮箱中发送的问题
    用户评价 打星等级 效果 jQuery
    SpringBoot整合WebSocket
    SpringBoot之自定义拦截器
    SpringBoot整合MyBatis
    EF实体框架简单原理及基本增删改查用法(上)
    数据库内容导出到Excel
    Asp.Net页面生命周期
  • 原文地址:https://www.cnblogs.com/approx/p/15544420.html
Copyright © 2020-2023  润新知