这是我写的打印国税发票的一段代码,可能不是很好,仅供参考,还望赐教
procedure TForm2.ConvertVarchar;
var
reminder,i,sum:integer;
chinese_num:string;
begin
QRLabel68.caption:='X';
QRLabel69.caption:='X';
QRLabel70.caption:='X';
QRLabel71.caption:='X';
QRLabel72.caption:='X';
QRLabel73.caption:='X';
QRLabel74.caption:='X';
QRLabel75.caption:='X';
QRLabel76.caption:='X'; i:=1;
sum:=StrToInt(FloatTOStr(SumPrice*100));
while sum>0 do
begin
Reminder:= sum mod 10;
case Reminder of
0:chinese_num:='零';
1:chinese_num:='壹';
2:chinese_num:='貳';
3:chinese_num:='參';
4:chinese_num:='肆';
5:chinese_num:='伍';
6:chinese_num:='陸';
7:chinese_num:='柒';
8:chinese_num:='捌';
9:chinese_num:='玖';
end;
case I of
1:QRLabel68.caption:=chinese_num;
2:QRLabel69.caption:=chinese_num;
3:QRLabel70.caption:=chinese_num;
4:QRLabel71.caption:=chinese_num;
5:QRLabel72.caption:=chinese_num;
6:QRLabel73.caption:=chinese_num;
7:QRLabel74.caption:=chinese_num;
8:QRLabel75.caption:=chinese_num;
9:QRLabel76.caption:=chinese_num;
end;
Sum:=Sum div 10;
Inc(I);
end;
end;
procedure TForm2.ConvertVarchar;
var
reminder,i,sum:integer;
chinese_num:string;
begin
QRLabel68.caption:='X';
QRLabel69.caption:='X';
QRLabel70.caption:='X';
QRLabel71.caption:='X';
QRLabel72.caption:='X';
QRLabel73.caption:='X';
QRLabel74.caption:='X';
QRLabel75.caption:='X';
QRLabel76.caption:='X'; i:=1;
sum:=StrToInt(FloatTOStr(SumPrice*100));
while sum>0 do
begin
Reminder:= sum mod 10;
case Reminder of
0:chinese_num:='零';
1:chinese_num:='壹';
2:chinese_num:='貳';
3:chinese_num:='參';
4:chinese_num:='肆';
5:chinese_num:='伍';
6:chinese_num:='陸';
7:chinese_num:='柒';
8:chinese_num:='捌';
9:chinese_num:='玖';
end;
case I of
1:QRLabel68.caption:=chinese_num;
2:QRLabel69.caption:=chinese_num;
3:QRLabel70.caption:=chinese_num;
4:QRLabel71.caption:=chinese_num;
5:QRLabel72.caption:=chinese_num;
6:QRLabel73.caption:=chinese_num;
7:QRLabel74.caption:=chinese_num;
8:QRLabel75.caption:=chinese_num;
9:QRLabel76.caption:=chinese_num;
end;
Sum:=Sum div 10;
Inc(I);
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货