fastReport 中显示金额大写

frxReport 控件加入自定义函数并显示金额大写

1. --- dConnector的 DataModuleCreate 中加入以下代码

procedure TdConnector.DataModuleCreate(Sender: TObject);
begin
   // -----------
  frpAmbKrmTalon.AddFunction('function MoneySpeech(pMoney: Currency): String;', 'Myfunction','人民币大写金额转换函数');
end;

2. --- dConnector.frxReport 控件的onUserFunction事件中加入以下代码

function TdConnector.frpAmbKrmTalonUserFunction(const MethodName: string; var Params: Variant): Variant;
begin
  // ------- 金额大写
  if UpperCase(MethodName) = UpperCase('MoneySpeech') then Result := MoneySpeechC(Params[0]);

end;

3. --- 要显示大写金额的字段 双击 Text 录入以下代码

[(MoneySpeech(<fdsAKrmTalon."det_somma">))]

 

原文地址:https://www.cnblogs.com/karkash/p/15671309.html