Blank pages bug fix.

Changes to QuickRpt.pas to fix extra newpage from GroupHeader
=============================================================

1. In the module level implementation declare new Boolean called
'PageBroken'.

Implementation

const
  ..
  ..

Var
     .......
     .......
     PageBroken : boolean;


2. Amend methods (see below)

procedure TQRCustomBand.MakeSpace;
procedure TQRCustomBand.Print;

3. Put the new quickrpt.pas into the quickrep source directory
4. Rebuild the packages dclqrt50 and qrpt50.

---------------------------------------------------------------------------
procedure TQRCustomBand.MakeSpace;
var
  AHeight : integer;
begin
  if (ParentReport.Page.PrintOrder = ColByCol) or (ParentReport.Page.Columns = 1) then
  begin
    AHeight := round(StretchHeight(True));
    if (BandType <> rbPageFooter) and (ParentReport.AvailableSpace < AHeight) and
      (AHeight <= (ParentReport.Page.Length - (ParentReport.Page.TopMargin + ParentReport.Page.BottomMargin))) or
      (ParentReport.PageNumber = 0) then
    begin
      // Amended by QBS QRTech 22/02/01
      // this flag is true only if the last detail line busts the page
      pagebroken := (bandtype in [rbDetail]);
      // will print pageheader, groupheader
      ParentReport.NewColumn;
    end
    else // if a detail line prints without busting, reset the flag
         if bandtype = rbDetail then pagebroken := false;
  end
  else

  begin
  end;
end;

procedure TQRCustomBand.Print;
var
  I : integer;
  OrgLength : extended;
  PrintBand : boolean;
  MyChild : TQRChildBand;
  AllFinished : boolean;
  FirstPass : boolean;
begin
  PrintBand := Enabled;
  if Enabled and assigned(FBeforePrintEvent) and not (csDesigning in ComponentState) then
    FBeforePrintEvent(Self, PrintBand);

  if PrintBand then
  begin
    // Amended by QBS QRTech 22/02/01
    // condition 'and not pagebroken' added to suppress newpage from groupheader
    if ForceNewPage and not pagebroken and
        not (BandType in [rbPageHeader, rbPageFooter, rbTitle, rbOverlay]) and
         (ParentReport.PageNumber > 0)
    then
    begin
      ParentReport.DoForceNewPage;
      pagebroken := false;
    end
    else
      if ForceNewColumn and not (BandType in [rbPageHeader, rbPageFooter, rbTitle, rbOverlay]) and (ParentReport.PageNumber > 0) then
        ParentReport.ForceNewColumn
      else
        MakeSpace;
    if NotifyController <> nil then
      NotifyController.NotifyClients(qrMasterDataAdvance);
    BandFrameRect := rect(ParentReport.QRPrinter.XPos(ParentReport.CurrentX),
                          ParentReport.QRPrinter.YPos(ParentReport.CurrentY),
                          ParentReport.QRPrinter.XPos(ParentReport.CurrentX + Size.Width),
                          ParentReport.QRPrinter.YPos(ParentReport.CurrentY + Size.Length));
    if (Height <> 0) and Enabled then
    begin
      if ParentReport.FinalPass then
      begin
        with ParentReport.QRPrinter.Canvas do
        begin
          Brush.Color := Self.Color;
          Brush.Style := bsSolid;
          FillRect(BandFrameRect);
        end;
      end;
      FExpanded := 0;
      OrgLength := Size.Length;
      FirstPass := true;
      repeat
        AllFinished := true;
        for I := 0 to ControlCount - 1 do
        begin
          if Controls[I] is TQRPrintable then
          begin
            if TQRPrintable(Controls[I]).Enabled then
            begin
              if FirstPass or not TQRPrintable(Controls[I]).PrintFinished then
                TQRPrintable(Controls[I]).Print(ParentReport.CurrentX, ParentReport.CurrentY);
              AllFinished := AllFinished and TQRPrintable(Controls[I]).PrintFinished;
            end;
          end;
        end;
        if ParentReport.FinalPass then
        begin
          BandFrameRect := rect(ParentReport.QRPrinter.XPos(ParentReport.CurrentX),
                                ParentReport.QRPrinter.YPos(ParentReport.CurrentY),
                                ParentReport.QRPrinter.XPos(ParentReport.CurrentX + Size.Width),
                                ParentReport.QRPrinter.YPos(ParentReport.CurrentY + Size.Length + FExpanded + 1));

          Frame.PaintIt(ParentReport.QRPrinter.Canvas, BandFrameRect, ParentReport.QRPrinter.XFactor,
                        ParentReport.QRPrinter.YFactor);
        end;
        // the flag 'allfinished' indicates that all the printables have
        // been printed. It is FALSE if a control ran out of v. space
        if not AllFinished then
        begin
          // Amended by QBS QRTech 22/02/01
          // Added line to notify that a stretch control bust a page
          // hope it will stop groupheaders from forcing a page break
          pagebroken := true;
          ParentReport.NewColumn;
          // now reset the flag
          pagebroken := false;
          Size.Height := OrgLength;
          FExpanded := 0;
        end;
        FirstPass := false;
      until AllFinished;
      AdvancePaper;
      Size.Length := OrgLength;
    end
  end else
    if (NotifyController <> nil) and not Enabled then
      NotifyController.NotifyClients(qrMasterDataAdvance);
  if assigned(FAfterPrintEvent) and not (csDesigning in ComponentState) then
    FAfterPrintEvent(self, PrintBand);
  if HasChild then
  begin
    MyChild := ChildBand;
    if BandType = rbPageFooter then
      MyChild.BandType := rbPageFooter;
    ParentReport.PrintBand(MyChild);
    MyChild.BandType := rbChild;
  end;
end;