加急!!!!!!加急!!!!!!加急!!!!!!采用网上大虾们所说的多栏式打印的方法,为什么会出现如果所查询的数据记录数小于4的时候,没有显示,也无法打印。(1

  • 主题发起人 主题发起人 中原浪子
  • 开始时间 开始时间

中原浪子

Unregistered / Unconfirmed
GUEST, unregistred user!
加急!!!!!!加急!!!!!!加急!!!!!!采用网上大虾们所说的多栏式打印的方法,为什么会出现如果所查询的数据记录数小于4的时候,没有显示,也无法打印。(100分)<br />源程序如下:请大虾们给个解决的办法。请回复EMAIL:zero_zero@21cn.com 或者 QQ:386947
unit TicketNameRep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, QuickRpt, QRCtrls, DB, ADODB;
type
TTicketNameRepFrm = class(TForm)
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
TitleBand1: TQRBand;
QRLabel10: TQRLabel;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRShape18: TQRShape;
QRShape19: TQRShape;
QRShape21: TQRShape;
QRShape22: TQRShape;
QRShape33: TQRShape;
QRShape34: TQRShape;
QRShape35: TQRShape;
QRShape36: TQRShape;
QRShape37: TQRShape;
QRShape38: TQRShape;
QRShape39: TQRShape;
QRShape40: TQRShape;
QRShape20: TQRShape;
QRShape23: TQRShape;
QRShape24: TQRShape;
QRShape25: TQRShape;
QRShape26: TQRShape;
QRShape27: TQRShape;
QRShape28: TQRShape;
QRShape29: TQRShape;
QRShape30: TQRShape;
QRShape31: TQRShape;
QRShape32: TQRShape;
QRLabel11: TQRLabel;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel15: TQRLabel;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
QRLabel18: TQRLabel;
QRLabel19: TQRLabel;
QRLabel20: TQRLabel;
QRLabel21: TQRLabel;
QRLabel22: TQRLabel;
QRLabel23: TQRLabel;
QRLabel24: TQRLabel;
QRLabel25: TQRLabel;
QRLabel26: TQRLabel;
QRLabel27: TQRLabel;
PageFooterBand1: TQRBand;
QRShape41: TQRShape;
QRLabel28: TQRLabel;
QRShape42: TQRShape;
QRShape43: TQRShape;
QRLabel29: TQRLabel;
QRLabel30: TQRLabel;
QRShape44: TQRShape;
QRLabel31: TQRLabel;
QRLabel32: TQRLabel;
QRShape45: TQRShape;
QRShape46: TQRShape;
QRSysData1: TQRSysData;
QRSysData2: TQRSysData;
SummaryBand1: TQRBand;
QRShape47: TQRShape;
QRShape48: TQRShape;
QRShape49: TQRShape;
QRShape50: TQRShape;
QRShape51: TQRShape;
QRShape52: TQRShape;
QRShape53: TQRShape;
QRShape54: TQRShape;
QRShape55: TQRShape;
QRShape56: TQRShape;
QRShape57: TQRShape;
QRShape58: TQRShape;
QRShape59: TQRShape;
QRShape60: TQRShape;
QRShape61: TQRShape;
QRShape62: TQRShape;
LBNO_1: TQRLabel;
LBName_1: TQRLabel;
LBSex_1: TQRLabel;
LBSex_2: TQRLabel;
LBNO_2: TQRLabel;
LBName_2: TQRLabel;
ADOQuery: TADOQuery;
LBNO_end1: TQRLabel;
LBName_end1: TQRLabel;
LBSex_end1: TQRLabel;
LBNO_end2: TQRLabel;
LBSex_end2: TQRLabel;
LBName_end2: TQRLabel;
QRShape63: TQRShape;
QRShape64: TQRShape;
QRShape65: TQRShape;
QRShape66: TQRShape;
QRShape67: TQRShape;
QRShape68: TQRShape;
QRShape69: TQRShape;
QRShape70: TQRShape;
procedure QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
GetSumNo,GetDataNo,GetMidNo,GetEndNo : Integer;
GetSingleOrDouble : Boolean;
{ Private declarations }
public
{ Public declarations }
end;

var
TicketNameRepFrm: TTicketNameRepFrm;
Procedure ExecTicketNameRep(V_ID : Integer);
implementation
uses CommonConnect;
{$R *.dfm}
Procedure ExecTicketNameRep(V_ID : Integer);
begin
TicketNameRepFrm := TTicketNameRepFrm.Create(Nil);
try
with TicketNameRepFrm.ADOQuerydo
begin
if Active then
Close;
SQL.Clear;
SQL.Add('Select c.asd_name,case c.asd_sex when ''M'' then
''男'' when ''W'' then
''女'' end as asd_sex '+
'from agd_groupplandetail a,asg_sign b,asd_signdetail c '+
'where a.status <>:DeleteID_G and b.status <>:DeleteID_M and c.status <>:DeleteID_D '+
'and a.id = b.asg_id_agd and b.id = c.asd_id_asg and a.id = '''+IntToStr(V_ID)+''' ');
Parameters.ParamByName('DeleteID_G').Value := G_deleteid;
Parameters.ParamByName('DeleteID_M').Value := G_deleteid;
Parameters.ParamByName('DeleteID_D').Value := G_deleteid;
Open;
if IsEmpty then
begin
Application.MessageBox('没有数据可供打印!','消息',MB_OK+MB_ICONINFORMATION);
Exit;
end;
end;
TicketNameRepFrm.QuickRep1.Preview;
finally
TicketNameRepFrm.ADOQuery.Close;
TicketNameRepFrm.Free;
end;
end;

procedure TTicketNameRepFrm.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
var
I: integer;
begin
MoreData := True;
for I:= 1 to 2do
begin
if ADOQuery.Eof then
Break;
case I of
1: begin
Inc(GetDataNo);
LBNO_1.Caption := IntToStr(GetDataNo);
LBName_1.Caption := ADOQuery.FieldByName('asd_name').AsString;
LBSex_1.Caption := ADOQuery.FieldByName('asd_Sex').AsString;
LBNO_end1.Caption := IntToStr(GetDataNo);
LBName_end1.Caption := ADOQuery.FieldByName('asd_name').AsString ;
LBSex_end1.Caption := ADOQuery.FieldByName('asd_Sex').AsString;
end;
2: begin
Inc(GetMidNo);
LBNO_2.Caption := IntToStr(GetMidNo);
LBName_2.Caption := ADOQuery.FieldByName('asd_name').AsString;
LBSex_2.Caption := ADOQuery.FieldByName('asd_sex').AsString;
if GetSingleOrDouble = False then
begin
LBNO_end2.Caption := IntToStr(GetMidNo);
LBName_end2.Caption := ADOQuery.FieldByName('asd_name').AsString;
LBSex_end2.Caption := ADOQuery.FieldByName('asd_sex').AsString;
end;
end;
end;
ADOQuery.Next;
end;
if ADOQuery.Eof then
MoreData := False;
end;
procedure TTicketNameRepFrm.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
GetSumNo := ADOQuery.RecordCount;
GetSingleOrDouble := ODD(GetSumNo);
if GetSingleOrDouble then
GetMidNo := Trunc(GetSumNo/2)+1
else
GetMidNo := Trunc(GetSumNo/2);
LBName_end1.Caption := '';
LBNO_end1.Caption := '';
LBSex_end1.Caption := '';
LBName_end2.Caption := '';
LBNO_end2.Caption := '';
LBSex_end2.Caption := '';
ADOQuery.First;
end;

end.
 
后退
顶部