多谢壁画兄指教,谢谢了!
附大小写金额转换及rave报表打印金额大写代码如下
function RMB(NN:real):string;
var
HZ,NS,NW,NA,N1,N2:string;
LA,X,Nk:integer;
begin
if NN>9999999999999.99 then
begin
MessageDlg('金额溢出。',mtError,[mbOk], 0);
HZ:='';
Result:=HZ;
exit;
end;
if NN=0 then
begin
HZ:='零元';
result:=HZ;
exit;
end;
NS:='零壹贰叁肆伍陆柒捌玖';
NW:='分角元拾佰仟万拾佰仟亿拾佰仟万';
NA:=FloatToStr(NN*100);
LA:=length(NA);
X:=1;
HZ:='';
while X<=LAdo
begin
NK:=Ord(NA[x])-Ord('0');
N1:=Copy(NS,NK*2+1,2);
N2:=Copy(NW,LA*2+1-X*2,2);
if (NK=0) AND ((N2='亿') OR( N2='万') OR( N2='元'))then
begin
if copy(HZ,Length(HZ)-1,2)='零' then
HZ:=copy(HZ,1,length(HZ)-2);
if copy(HZ,Length(HZ)-1,2)='亿' then
if N2='元' then
begin
N1:=N2;
N2:='零';
end
else
N2:=''
else
begin
N1:=N2;
N2:='零';
end
end
else
if NK=0 then
begin
if copy(HZ,length(HZ)-1,2)='零' then
N1:='';
if N2='分' then
begin
if copy(HZ,length(HZ)-1,2)='零' then
HZ:=copy(HZ,1,length(HZ)-2)+'整'
else
HZ:=HZ+'整';
N1:='';
end;
N2:='';
end;
HZ:=HZ+N1+N2;
X:=X+1
end;
Result:=HZ;
end;
procedure TForm20.Button5Click(Sender: TObject);
begin
with ADOQuery6do
begin
close;
SQL.Clear;
SQL.Add('select sum(o_jine)''jine'' from out where o_no='''+edit2.text+'''');
open;
edit9.Text :=Fieldbyname('jine').asstring;
Edit8.Text:= RMB(StrToFloat(Edit9.Text));
end;
end;
procedure TForm20.Button5Click(Sender: TObject);
begin
with ADOQuery6do
begin
close;
SQL.Clear;
SQL.Add('select sum(o_jine)''jine'' from out where o_no='''+edit2.text+'''');
open;
edit9.Text :=Fieldbyname('jine').asstring;
Edit8.Text:= RMB(StrToFloat(Edit9.Text));
end;
end;
procedure TForm20.Button3Click(Sender: TObject);
begin
RvProject1.Open;
RvProject1.SetParam('p6', edit7.text);
RvProject1.SetParam('p5', edit2.text);
RvProject1.SetParam('p4', edit5.text);
RvProject1.SetParam('p3', edit6.text);
RvProject1.SetParam('p2', edit4.text);
RvProject1.SetParam('p1', edit8.text);
RvProject1.ExecuteReport('Report3');
RvProject1.Close;
begin
RvProject1.Execute;
end;
end;
end.