大家帮帮我吧。QR问题,郁闷了好几天了…………

恶鱼 2004-05-13 03:12:14
我用QR做报表。现在我出来的报表就是一页到底,不会自己换页。我设过强制换页了,不行。
原代码如下。我想可能是循环上的问题。不知道怎么办好。
procedure Tqrpt_ysmx.beforepreview;
var
i:integer;
atop:integer;
aLabel:TQRLabel;
aLine:TQRShape;
d1,d2,d3:Tdate;
kh1:string;
begin
atop:=68;
d1:=ysquanbucx.date1;
d2:=ysquanbucx.date2;
kh1:=ysquanbucx.kh;

qdate.Active:=false;
qdate.SQL.Clear;
qdate.SQL.Add('select 日期 from 应收明细');
qdate.SQL.Add('where 客户='''+kh1+''' and 日期>=#'+datetostr(d1) +'# and 日期<=#'+datetostr(d2) +'# group by 日期');
qdate.Prepared;
qdate.open;

while not qdate.Eof do
begin
aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=0;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
AutoSize:=true;
AutoStretch:=True;
Font.Size:=8;
Left :=8;
Top := atop+2;
Alignment:=taLeftJustify;
d3:=qdate.Fields[0].Value;
Caption :=datetostr(d3);
end;

qmingxi.Active:=false;
qmingxi.SQL.Clear;
qmingxi.SQL.Add('select 部门,摘要,增加费,减少费 from 应收明细');
qmingxi.SQL.Add('where 客户='''+kh1+''' and 日期=#'+datetostr(d3)+'# order by 部门');
qmingxi.Prepared;
qmingxi.open;

while not qmingxi.Eof do
begin

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=66;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;


aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=0;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
AutoSize:=true;
AutoStretch:=True;
Font.Size:=8;
Left :=75;
Top := atop+2;
Alignment:=taLeftJustify;
Caption:=qmingxi.Fields[0].Value;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=125;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
//AutoSize:=;
AutoStretch:=True;
Font.Size:=8;
Left :=130;
Top := atop+2;
Alignment:=taLeftJustify;
Caption :=qmingxi.Fields[1].Value;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=433;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
AutoSize:=true;
AutoStretch:=True;
Font.Size:=8;
Left :=437;
Top := atop+2;
Alignment:=taLeftJustify;
Caption :=qmingxi.Fields[2].asstring;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=527;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
AutoSize:=true;
AutoStretch:=True;
Font.Size:=8;
Left :=531;
Top := atop+2;
Alignment:=taLeftJustify;
Caption :=qmingxi.Fields[3].AsString;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=619;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=717;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=16;
aLine.Frame.Color:=clBlack;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=0;
aLine.Top:=atop+16;
aLine.Width:=718;
aLine.Height:=1;
aLine.Frame.Color:=clBlack;
end;

atop:=atop+16;
qmingxi.Next;
end;
qyue.Active:=false;
qyue.SQL.Clear;
qyue.SQL.Add('select sum(结存)as b1 from 应收结存');
qyue.SQL.Add('where (日期=#'+datetostr(d3) +'#) and (客户='''+kh1+''') and (结存<>0)');
qyue.Prepared;
qyue.Open;
// showmessage(datetostr(d3));
// showmessage(qyue.Fields[0].AsString);

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=0;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=17;
aLine.Frame.Color:=clBlack;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=619;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=17;
aLine.Frame.Color:=clBlack;
end;

aLabel:= TQRLabel.Create(qrpt_ysmx);
aLabel.Parent := TitleBand1;
with aLabel do
begin
AutoSize:=true;
AutoStretch:=True;
Font.Size:=8;
Left :=628;
Top := atop+2;
Font.Style:=[fsBold];
Alignment:=taLeftJustify;
Caption:=qyue.Fields[0].AsString;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=0;
aLine.Top:=atop+16;
aLine.Width:=718;
aLine.Height:=1;
aLine.Frame.Color:=clBlack;
end;

aLine:= TQRShape.Create(qrpt_ysmx);
aLine.Parent := TitleBand1;
with aLine do
begin
aLine.Left:=717;
aLine.Top:=atop;
aLine.Width:=1;
aLine.Height:=17;
aLine.Frame.Color:=clBlack;
end;

atop:=atop+16;
qdate.Next;

end;
end;
end.
...全文
49 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
恶鱼 2004-05-13
  • 打赏
  • 举报
回复
先谢谢两位。以上的方法还是不行。
恶鱼 2004-05-13
  • 打赏
  • 举报
回复
我试一下看看。好像是不行的。我这个属性设过了
tonymeis 2004-05-13
  • 打赏
  • 举报
回复
和程序没有关系,我作过,要在qr中设置,即用force new page开始每一页
恶鱼 2004-05-13
  • 打赏
  • 举报
回复
能说的具体一点吗
WWWWA 2004-05-13
  • 打赏
  • 举报
回复
放在QR的BEFORE PRINT事件中试代。

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧