一、双击QuickRep1的OnNeedData事件,输入如下代码:
procedure Tform1.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
MoreData:=True;
//允许打印记录边条
with Tabel1do
begin
if not Eof then
begin
RLb1.Caption:=FieldByName('FixingName').AsString;
RLb2.Caption:=FieldByName('JustClass').AsString;
RLb3.Caption:=FieldByName('JustTotal').AsString;
RLb4.Caption:=FieldByName('WaitClass').AsString;
RLb5.Caption:=FieldByName('WaitTotal').AsString;
RLb6.Caption:=FieldByName('Repair').AsString;
RLb7.Caption:=FieldByName('Jobpay').AsString;
RLb8.Caption:=FieldByName('Total').AsString;
FJustTotal:= FJustTotal +FieldByName('JustTotal').AsFloat;
FWaitTotal:= FWaitTotal +FieldByName('WaitTotal').AsFloat;
FRepair:= FRepair +FieldByName('Repair').AsFloat;
FJobpay:= FJobpay +FieldByName('Jobpay').AsFloat;
FTotal:=FTotal+FieldByName('Total').AsFloat;
end
else
begin
//设定每页打印13行,最后一页不够13行时用空行代替。
打印行数可根据 //实际情况要求设定。
if FNum< 14 then
begin
RLb1.Caption:='';
RLb2.Caption:='';
RLb3.Caption:='';
RLb4.Caption:='';
RLb5.Caption:='';
RLb6.Caption:='';
RLb7.Caption:='';
RLb8.Caption:='';
end;
end;
if not Eof then
Next
else
if FNum=14 then
begin
MoreData:=False;// 不打印记录边条
FNum:=0;
First;
end;
Inc(FNum);
end;
end;
二、双击QRSubDetail1的OnAfterPrint事件,输入如下代码:
procedure Tform1.QRSubDetail1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
begin
if FNum=14 then
begin
if not Table1.Eof then
begin
Form1.QuickRep1.NewColumn;//建立新页
FNum:=1;
end;
end;
end;
三、双击QRSubDetail1的OnBeforePrint事件,输入如下代码:
procedure Tform1.QRSubDetail1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
if FNum=14 then
begin
RSL1.Caption:=FloatToStr(FJustTotal);
RSL2.Caption:=FloatToStr(FWaitTotal);
RSL3.Caption:=FloatToStr(FRepair);
RSL4.Caption:=FloatToStr(FJobpay);
RSL5.Caption:=FloatToStr(FTotal);
PrintBand:=True;//打印明细边条
FJustTotal:=0;
FWaitTotal:=0;
FRepair:=0;
FJobpay:=0;
FTotal:=0;
end else
PrintBand:=False;
//不打印明细边条
end;
四、双击Form1的On Create事件,输入如下代码:
procedure Tform1.FormCreate(Sender: TObject);
begin
FNum:=1;
FJustTotal:=0;
FWaittotal:=0;
FRepair:=0;
FJobpay:=0;
FTotal:=0;
end;
在2000下走纸问题没解决,如果你解决了请给我一份