鸿 网 互 联 www.68idc.cn

当前位置 : 服务器租用 > 编程语言开发 > delphi > >

DelphiFastreport报表

来源:互联网 作者:佚名 时间:2015-07-05 21:30
Allowslip选True (跨页打印)MasterData1的Stretched设置为True;(设置对象可以拉伸)所有Memo的StretchMode设置为smMaxHeight(自动拉伸到最高高度);WordWrap为True;(自动换行)FastReport调用Delphi中的人民币大写转换自定义函数function TJzpzEdit1.MoneyCn(mm

   

Allowslip选True (跨页打印)MasterData1的Stretched设置为True;(设置对象可以拉伸)所有Memo的StretchMode设置为smMaxHeight(自动拉伸到最高高度);WordWrap为True;(自动换行)FastReport调用Delphi中的人民币大写转换自定义函数function TJzpzEdit1.MoneyCn(mmje: Double): string;consts1: string = ‘零壹贰叁肆伍陆柒捌玖’;s2: string = ‘分角元拾佰仟万拾佰仟亿拾佰仟万’;function StrTran(const S, s1, s2: string): string;beginResult := StringReplace(S, s1, s2, [rfReplaceAll]);end;varS, dx: string;i, Len: Integer;beginif mmje < 0 thenbegindx := ‘负’;mmje := -mmje;end;S := Format(‘%.0f’, [mmje * 100]);Len := Length(S);for i := 1 to Len dodx := dx + Copy(s1, (Ord(S[i]) – Ord(’0′)) * 2 + 1, 2) + Copy(s2, (Len – i)* 2 + 1, 2);dx := StrTran(StrTran(StrTran(StrTran(StrTran(dx, ‘零仟’, ‘零’), ‘零佰’,‘零’),‘零拾’, ‘零’), ‘零角’, ‘零’), ‘零分’, ‘整’);dx := StrTran(StrTran(StrTran(StrTran(StrTran(dx, ‘零零’, ‘零’), ‘零零’,‘零’),‘零亿’, ‘亿’), ‘零万’, ‘万’), ‘零元’, ‘元’);if dx = ‘整’ thenResult := ‘零元整’elseResult := StrTran(StrTran(dx, ‘亿万’, ‘亿零’), ‘零整’, ‘整’);end;//////////procedure TJzpzEdit1.FormCreate(Sender: TObject);beginfrxReport1.AddFunction(‘function MoneyCn(mmje: Double): String;’,'Myfunction’,'小写金额转大写的函数’);end;//////////function TJzpzEdit1.frxReport1UserFunction(const MethodName: string;var Params: Variant): Variant;beginif UpperCase(MethodName) = UpperCase(‘MoneyCn’) thenResult := MoneyCn(Params[0]);end;//////////报表中调用方法MoneyCn(50000000)

网友评论
<