M
mkbss
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟想在fr里面显示合计金额大写,自己定义了一个函数,然后调用这个函数,但在调用过程中,出现错误的提示
代码如下
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 lendo
begin
j:=strtoint(copy(temp,i,1));
resu:=resu+num[j]+a[len-i];
end;
result:=resu;
end;
procedure Memo3OnBeforePrint(Sender: TfrxComponent);
var p :real;
begin
p:=strtofloat(memo2.text;
memo3.text:=MoneyToCharacter(p);
end;
错误提示如下:
The following error(s) have occured;
'is not a valid floating point value '
[SUM(<frxDBDataset1."Amount">,DetailData1)]
[SUM(<frxDBDataset1."Amount">,DetailData1)]是合计金额
怎么解决呀(正常显示数据)
代码如下
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 lendo
begin
j:=strtoint(copy(temp,i,1));
resu:=resu+num[j]+a[len-i];
end;
result:=resu;
end;
procedure Memo3OnBeforePrint(Sender: TfrxComponent);
var p :real;
begin
p:=strtofloat(memo2.text;
memo3.text:=MoneyToCharacter(p);
end;
错误提示如下:
The following error(s) have occured;
'is not a valid floating point value '
[SUM(<frxDBDataset1."Amount">,DetailData1)]
[SUM(<frxDBDataset1."Amount">,DetailData1)]是合计金额
怎么解决呀(正常显示数据)