首 页文章中心下载中心繁體中文
设为首页
加入收藏
联系我们
您当前的位置:开源盛世-源代码下载网 -> 文章中心 -> 其他编程 -> Delphi技术 -> 文章内容 退出登录 用户管理
栏目导航
· VC# 技术 · Delphi技术
· Java技术 · 通用算法
· 编程相关
热门文章
· Tab Control控件使用...
· 学生档案管理系统
· [图文] 排列组合公式
· UTF-8与GB2312之间的...
· DirectShow下载安装...
· Virtual PC 在PAE模...
· Windows2000终端服务...
· MapInfo上的GIS系统...
· Mapbasic参考手册索...
· MapX应用开发中文讲...
相关文章
· 小写转大写金额[SQL...
将小写数字金额转成大写金额
作者:佚名  来源:vscodes.com整理  发布时间:2005-12-16 13:31:11  发布人:Polaris

减小字体 增大字体

procedure TfmBMZC.BitBtn2Click(Sender: TObject); //金额转换
const
  chNum : array[0..9] of string = ('零','壹','贰','叁','肆','伍','陆','柒','捌','玖');
  chBit : array[0..3] of string = ('圆','拾','佰','仟');
var
  y, m, d : Word;
  s : string;
  len, n , tmp: integer;
  bIsZero : Boolean;
begin
  DecodeDate(Date, y, m, d);
  jfjeChange();
  with fmPrint do begin
    qrYear.Caption:=IntToStr(y);
    qrMonth.Caption:=IntToStr(m);
    qrDay.Caption:=IntToStr(d);

    qrName.Caption:=EdName.Text;

    qrXMoney.Caption:=jf;

//对照表生成小写金额的大写
    bIsZero:=false;
    n:=Pos('.', jf); //小数点前的处理
    if n=0 then
      len:=Length(jf)
    else
      len:=n-1;
    for n:=1 to len do begin
      tmp:=StrToInt(jf[n]);
      if tmp=0 then begin
        if n<len then
          bIsZero:=true
        else if n=len then
          s:=s + chBit[len-n];
      end
      else begin
        if bIsZero then begin
          s:=s+chNum[0]+chNum[tmp] + chBit[len-n];
          bIsZero:=false;
        end
        else
          s:=s+chNum[tmp] + chBit[len-n];
      end;
    end;

    if Length(jf)>len then begin //小数点后的处理
      if len+2<=Length(jf) then begin
        tmp:=StrToInt(jf[len+2]);
        if tmp=0 then
          s:=s+'零'
        else
          s:=s+chNum[tmp]+'角';
      end;
      if len+3<=Length(jf) then
        s:=s+chNum[StrToInt(jf[len+3])]+'分';
    end;
    qrDMoney.Caption:=s;

    qrShow.Caption:='辅修报名注册费。';

    qrHandler.Caption:='僧格淋沁';

    QuickRep1.Preview;
  end;
end;

procedure TfmBMZC.jfjeChange();  //对输入框中内容的控制
var
  tmp : string;
begin
//计算"缴费金额"
  jf:=Trim(Copy(mEdJFJE.Text, 1, 4));
  if jf=' then //"元"为空
    jf:='0';

  tmp:=Trim(Copy(mEdJFJE.Text, 7, 1));
  if tmp=' then begin file://"角"为空
    tmp:=Trim(Copy(mEdJFJE.Text, 10, 1));
    if tmp<>' then //填写了"分"
      jf:=jf+'.0'+tmp;
  end
  else begin //填写了"角"
    jf:=jf+'.'+tmp;
    tmp:=Trim(Copy(mEdJFJE.Text, 10, 1));
    if tmp<>' then //填写了"分"
      jf:=jf+tmp;
  end;

  jf:=FloatToStr(StrToFloat(jf));
end;

end.


End of《将小写数字金额转成大写金额》

[] [返回上一页] [打 印] [收 藏]
 
∷相关“将小写数字金额转成大写金额”文章评论∷
(评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 网站目录 鄂ICP备06007162
开源盛世 版权所有Copyright © 2003-2005 VSCodes.Com. All Rights Reserved.