Q&A

  • 퀵리포트//빈줄 인쇄하는거 가르쳐주세요
거래명세서 작성중입니다.

한장에 13줄 들어가는 양식을 만들려고 합니다.

각 인쇄필드는 QRlabel을 사용하구요

쿼리를 사용했습니다.

데이타가 2개라면 2개가 찍히고 나머지 11줄은 빈칸으로 인쇄하고 싶습니다.

그리고 13개 이상이라면 다음 페이지에 찍고 싶은데

Q&A를 아무리 뒤져도 답을 얻지 못하네요

한 거래처에 거래량이 적은건 1건에서 많은건 100건도 넘습니다.

데이터는 잘 인쇄됩니다.

문제는 빈칸을 인쇄못합니다.

고수님들의 고견을 듣겠습니다.

도와주십시요
3  COMMENTS
  • Profile
    KDDG_Cali 2004.04.21 21:59
    거래명세표 소스 올립니다.

    그룹밴드가 한개 포함되어 있습니다.
    그룹이 필요없다면 소스를 수정하거나 임의로 그룹을 만들어 주세요.높이를 0으로 주시면 됩니다.


    윗 부분의 소스는
    공통함수로 지정해 주시고 아래부분(거래명세표)에서 이용하시면 됩니다.


    그럼 성공하시길..




    //공통함수부분 -  프린트 널 밴드 출력

    procedure pCreateChildNullBand(agForm: TForm; agQReport: TQuickRep;
                            var agParentBand: TQRCustomBand; agDeBand: TQRCustomBand;
                   agCnt: Integer; OnAfterPrint: TAfterPrintEvent);
    var
            aChildBand                : TQRChildBand;
         aShape                        : TQRShape;
         nI,
         nJ,
         nCnt                                : Integer;
         nCurHeight                : Double;
    begin
            if agParentBand.HasChild then agParentBand.HasChild := False;
         agParentBand.HasChild        := True;
         aChildBand                        := agParentBand.ChildBand;
         with aChildBand do begin
                 Enabled                := False;
              Name                        := agParentBand.Name+'Child';
              Top                        := agDeBand.Top;
              Align                := agDeBand.Align;
              Size.Height        := 0;
              AfterPrint        :=  OnAfterPrint;
         end;
         nCurHeight := 0;
         for nI := 1 to agCnt do begin
                 nCnt := 0;
              for nJ := 0 to agDeBand.ControlCount-1 do begin
                      if agDeBand.Controls[nJ] is TQRShape then begin
                           aShape        := TQRShape.Create(agForm);
                        with aShape do begin
                                Visible                := False;
                             Enabled                := False;
                             Name                        := agParentBand.Name+'Child'+'Shape'
                                                             +fsPadL(Trim(intToStr(nI)), 2, '0')
                                                 +fsPadL(Trim(intToStr(nJ)), 2, '0');
                                            Parent                := aChildBand;
                                            Size.Top                := nCurHeight;
                                            Size.Left                := TQRShape(agDeBand.Controls[nJ]).Size.Left;
                                            Size.Height        := TQRShape(agDeBand.Controls[nJ]).Size.Height;
                                            Size.Width        := TQRShape(agDeBand.Controls[nJ]).Size.Width;
                                            Brush                := TQRShape(agDeBand.Controls[nJ]).Brush;
                                            Pen                        := TQRShape(agDeBand.Controls[nJ]).Pen;
                                            // New
                                            //Frame                := TQRShape(agDeBand.Controls[nJ]).Frame;
                                            Shape                := TQRShape(agDeBand.Controls[nJ]).Shape;
                                    end;
                                    Inc(nCnt);
                            end;
                    end;
                    //nCurHeight := nCurHeight + Round(agDeBand.Size.Height);
                    nCurHeight := nCurHeight + agDeBand.Size.Height;
            end;
    end;

    procedure pSetEnableChildNullBand(agQReport: TQuickRep; agParentBand: TQRCustomBand;
                            agDeBand: TQRCustomBand; var agChildBand: TQRCustomBand;
                   agCnt: Integer; agEnable: Boolean);
    var
            aChildBand                : TQRChildBand;
         aShape                        : TQRShape;
         nI,
         nJ,
         nCnt                                : Integer;
         nHeight : Double ;
    //     nCurHeight                : Double;
    begin
            if agEnable then begin
                 nHeight := Round(agCnt * agDeBand.Size.Height);
         end
         else begin
                 nHeight := 0;
         end;
         agChildBand.Size.Height := nHeight;
         if (agCnt>0) and (agEnable) then
                 agChildBand.Enabled := agEnable
         else begin
                 agChildBand.Enabled := False;
              Exit;
         end;

         for nJ := 0 to agChildBand.ControlCount-1 do begin
                 if (agChildBand.Controls[nJ] is TQRShape)
                      and (UpperCase(Copy(agChildBand.Controls[nJ].Name,
                                   1, Length(agParentBand.Name+'ChildShape')))
                           =UpperCase(agParentBand.Name+'ChildShape')) then begin
                   nI := StrToInt(Copy(agChildBand.Controls[nJ].Name,
                                           Length(agParentBand.Name+'ChildShape')+1, 2));
                   if nI <= agCnt then begin
                           TQRShape(agChildBand.Controls[nJ]).Visible        := agEnable;
                           TQRShape(agChildBand.Controls[nJ]).Enabled        := agEnable;
                   end;
              end;
         end;
    end;

    procedure pSetDisableChildNullBand(var agChildBand: TQRCustomBand);
    var
            nJ        : Integer;
    begin
            agChildBand.Size.Height := 0;
            agChildBand.Enabled := False;
            for nJ := 0 to agChildBand.ControlCount-1 do begin
                    if (agChildBand.Controls[nJ] is TQRShape) then begin
                            TQRShape(agChildBand.Controls[nJ]).Visible        := False;
                            TQRShape(agChildBand.Controls[nJ]).Enabled        := False;
                    end;
            end;
    end;







    // 거래명세표


    unit QGeoRae;

    interface

    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      QuickRpt, Qrctrls, ExtCtrls, Db, DBTables, Math, jpeg, DBClient;

    type
      TfrmQGeoRae = class(TForm)
        QuickRep1: TQuickRep;
        ColumnHeaderBand1: TQRBand;
        DetailBand1: TQRBand;
        PageFooterBand1: TQRBand;
        PageHeaderBand1: TQRBand;
        QRShape1: TQRShape;
        QRShape2: TQRShape;
        QRShape3: TQRShape;
        QRShape5: TQRShape;
        QRShape6: TQRShape;
        QRShape7: TQRShape;
        QRShape8: TQRShape;
        QRShape9: TQRShape;
        QRShape10: TQRShape;
        QRShape11: TQRShape;
        QRShape13: TQRShape;
        QRShape14: TQRShape;
        QRShape15: TQRShape;
        QRShape16: TQRShape;
        QRLabel1: TQRLabel;
        QRLabel2: TQRLabel;
        QRLabel3: TQRLabel;
        QRLabel5: TQRLabel;
        QRLabel6: TQRLabel;
        QRLabel7: TQRLabel;
        QRLabel8: TQRLabel;
        QRDBText2: TQRDBText;
        QRDBText3: TQRDBText;
        QRDBText5: TQRDBText;
        QRDBText6: TQRDBText;
        QRDBText7: TQRDBText;
        QRDBText8: TQRDBText;
        QRGroup1: TQRGroup;
        QRBand1: TQRBand;
        QRShape31: TQRShape;
        QRShape32: TQRShape;
        QRShape33: TQRShape;
        QRShape34: TQRShape;
        QRShape35: TQRShape;
        QRShape36: TQRShape;
        QRShape37: TQRShape;
        QRShape50: TQRShape;
        QRLabel11: TQRLabel;
        QRLabel17: TQRLabel;
        laKumk: TQRLabel;
        QRShape53: TQRShape;
        QRShape55: TQRShape;
        QRDBText17: TQRDBText;
        cdsTemp1_CONMast: TClientDataSet;
        cdsTemp_CONTRACT: TClientDataSet;
        laNo: TQRLabel;
        laBLeft: TQRLabel;
        laBRight: TQRLabel;
        qs01: TQRShape;
        qs02: TQRShape;
        qs03: TQRShape;
        qs04: TQRShape;
        qs05: TQRShape;
        qs06: TQRShape;
        qs07: TQRShape;
        qs08: TQRShape;
        qs09: TQRShape;
        qs10: TQRShape;
        qs11: TQRShape;
        qs12: TQRShape;
        qs13: TQRShape;
        qs14: TQRShape;
        qs15: TQRShape;
        qs16: TQRShape;
        qs17: TQRShape;
        qs18: TQRShape;
        qs19: TQRShape;
        qs20: TQRShape;
        qs21: TQRShape;
        qs22: TQRShape;
        qs23: TQRShape;
        qs24: TQRShape;
        qs25: TQRShape;
        qs26: TQRShape;
        qs27: TQRShape;
        qs28: TQRShape;
        qs29: TQRShape;
        qs30: TQRShape;
        la02: TQRLabel;
        la04: TQRLabel;
        la05: TQRLabel;
        la06: TQRLabel;
        la07: TQRLabel;
        la08: TQRLabel;
        la09: TQRLabel;
        la10: TQRLabel;
        la11: TQRLabel;
        la12: TQRLabel;
        la13: TQRLabel;
        la14: TQRLabel;
        la15: TQRLabel;
        la16: TQRLabel;
        la17: TQRLabel;
        la18: TQRLabel;
        la19: TQRLabel;
        la20: TQRLabel;
        QRShape17: TQRShape;
        QRLabel13: TQRLabel;
        QRShape18: TQRShape;
        QRLabel9: TQRLabel;
        QRDBText1: TQRDBText;
        QRDBText9: TQRDBText;
        QRDBText10: TQRDBText;
        QRDBText12: TQRDBText;
        QRDBText13: TQRDBText;
        QRDBText14: TQRDBText;
        ladNo: TQRLabel;
        laSangHo: TQRLabel;
        laName: TQRLabel;
        laAddr: TQRLabel;
        laEoptae1: TQRLabel;
        laEoptae2: TQRLabel;
        laJong1: TQRLabel;
        laJong2: TQRLabel;
        QRShape19: TQRShape;
        QRShape20: TQRShape;
        QRDBText15: TQRDBText;
        QRDBText16: TQRDBText;
        QRShape4: TQRShape;
        QRShape12: TQRShape;
        QRLabel4: TQRLabel;
        qdbVat1: TQRDBText;
        QRExpr1: TQRExpr;
        qExpVat1: TQRExpr;
        cdsTemp_CONTRACTF_CODENO: TStringField;
        cdsTemp_CONTRACTF_SEQNO: TFloatField;
        cdsTemp_CONTRACTF_NAME: TStringField;
        cdsTemp_CONTRACTF_SIZE: TStringField;
        cdsTemp_CONTRACTF_QTY: TStringField;
        cdsTemp_CONTRACTF_PRICE: TFloatField;
        cdsTemp_CONTRACTF_KUMK: TFloatField;
        cdsTemp_CONTRACTF_REMARK: TStringField;
        cdsTemp_CONTRACTF_VAT: TFloatField;
        laVAT1: TQRLabel;
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure FormCreate(Sender: TObject);
        procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
          var PrintReport: Boolean);
        procedure DetailBand1AfterPrint(Sender: TQRCustomBand;
          BandPrinted: Boolean);
        procedure PageHeaderBand1BeforePrint(Sender: TQRCustomBand;
          var PrintBand: Boolean);
        procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
          var PrintBand: Boolean);
      private
         procedure PFBReSizing(Value: Double);
         procedure NBAfterPrint(Sender: TQRCustomBand; BandPrinted: Boolean);
         procedure UseNullBand(agParentBand: TQRCustomBand; agDeBand: TQRCustomBand);
         procedure SetClearNullBand(agParentBand: TQRCustomBand; agDeBand: TQRCustomBand);


        { Private declarations }
      public
        { Public declarations }
      end;

    var
      frmQGeoRae: TfrmQGeoRae;

    implementation
    uses Main,CONTRACT, Commproc, PIMSDetail ;
    var  G_PFBHeight : Double;
            G_LineCount,G_LineInc,AG_No : Integer;


    {$R *.DFM}

    procedure TfrmQGeoRae.PFBReSizing(Value: Double);
    begin
            PageFooterBand1.Size.Height := Value - 3;
         QuickRep1.ResetPageFooterSize;
    end;
    procedure TfrmQGeoRae.NBAfterPrint(Sender: TQRCustomBand; BandPrinted: Boolean);
    begin
            if BandPrinted then
                 PFBReSizing(Round(QuickRep1.Page.Length-QuickRep1.Page.BottomMargin)-QRBand1.Size.Height-QuickRep1.CurrentY);
    end;

    procedure TfrmQGeoRae.UseNullBand(agParentBand: TQRCustomBand; agDeBand: TQRCustomBand);
    var
            A_Null                        : Integer;
            A_ChildBand                : TQRCustomBand;
    begin
            A_Null := Floor((QuickRep1.Page.Length-QuickRep1.Page.BottomMargin
                                     - QuickRep1.CurrentY-QRBand1.Size.Height-PageFooterBand1.Size.Height)
                        / Round(agDeBand.Size.Height));

         if (A_Null <> 0) and (G_LineInc >= G_LineCount) then
         begin
                 A_ChildBand := agParentBand.ChildBand;
              pSetEnableChildNullBand(QuickRep1, agParentBand, agDeBand, A_ChildBand, A_Null, True);

         end
         else
         begin
                 if A_Null = 0 then
                      PFBReSizing(Round(QuickRep1.Page.Length-QuickRep1.Page.BottomMargin)-QRBand1.Size.Height-QuickRep1.CurrentY);
         end;

    end;

    procedure TfrmQGeoRae.SetClearNullBand(agParentBand: TQRCustomBand; agDeBand: TQRCustomBand);
    var
            A_ChildBand                : TQRCustomBand;
    begin
         A_ChildBand := agParentBand.ChildBand;
         pSetEnableChildNullBand(QuickRep1, agParentBand, agDeBand, A_ChildBand, 30, False);
    end;


    procedure TfrmQGeoRae.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
         Action := caFree ;
    end;

    procedure TfrmQGeoRae.FormCreate(Sender: TObject);
    var A_Sitecode,A_CodeNo : string ;
    begin
            if G_CallForm = 'PIMS' then  // 일정에서 부른 경우
         begin
              A_Sitecode := frmPIMSDetail.cdsConMast.fieldbyname('F_SITECODE').Asstring ;
              A_CodeNo   := frmPIMSDetail.cdsConMast.fieldbyname('F_CODENO').Asstring ;
         end
         else
         begin
              A_Sitecode := frmCONTRACT.laSiteCode.Caption ;
              A_CodeNo   := frmCONTRACT.laDate.Caption + frmCONTRACT.laNo.Caption ;
         end ;

         QRGroup1.Height := 0 ;

         with cdsTemp_CONTRACT do
         begin
              CommandText := 'Select F_CODENO, F_SEQNO,F_NAME,F_SIZE,F_QTY,F_PRICE,F_KUMK,F_REMARK,F_KUMK * 0.1 as F_VAT from CONTRACT' +#13#10+
                   format('where F_SITECODE = ''%s'' and F_CODENO = ''%s'' ',[A_Sitecode, A_CodeNo] ) +#13#10+
                          'ORDER BY F_CODENO, F_SEQNO' ;
              Active := True ;
         end ;

         with cdsTemp1_CONMast do
         begin
              CommandText := 'select A.F_CODENO,A.F_NAPDATE,A.F_NAPKUMK,A.F_REMARK,A.F_VATYOYUL,B.F_SANO,B.F_SITEFULLNAME,B.F_ADDRESS,B.F_DAEPYO,B.F_EOPJONG,B.F_EOPTAE' +#13#10+
                             'FROM  CONMAST A, SITEMAST B' +#13#10+
                             'where B.F_KUBUN = ''C'' and B.F_SITECODE = A.F_SITECODE' +#13#10+
                      format('  and A.F_SITECODE = ''%s'' and A.F_CODENO = ''%s'' '
                               ,[A_Sitecode, A_CodeNo ]) ;
              Active := True ;
         end ;


            if cdsTemp1_CONMast.fieldbyname('F_VATYOYUL').Asfloat = 100 then
         begin
              laVat1.Enabled := True ;

              qdbVat1.Enabled := False ;
              qExpVat1.Enabled := False ;
         end ;




    end;

    procedure TfrmQGeoRae.QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    begin
         G_PFBHeight        := Round(PageFooterBand1.Size.Height);
            G_LineCount        := cdsTemp_CONTRACT.RecordCount;
            G_LineInc             := 0;

         pCreateChildNullBand(frmQGeorae, QuickRep1,
                                 TQRCustomBand(DetailBand1), TQRCustomBand(DetailBand1), 50,
                        NBAfterPrint);

         AG_No := 0 ;
    end;

    procedure TfrmQGeoRae.DetailBand1AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
    begin
            Inc(G_LineInc);
            UseNullBand(Sender, TQRCustomBand(DetailBand1));
    end;

    procedure TfrmQGeoRae.PageHeaderBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    begin
    //     laSiteName.Caption := frmCONTRACT.cdsConMast.fieldbyname('F_SiteFullName').Asstring+' 귀중' ;
         laKumk.Caption :=  fKumHan(cdsTemp1_CONmast.fieldbyname('F_NAPKUMK').Asfloat,'한문')+
                           '정(₩'+fsNumberSep(cdsTemp1_CONmast.fieldbyname('F_NAPKUMK').Asfloat) +')' ;

            PFBReSizing(G_PFBHeight);
    end;

    procedure TfrmQGeoRae.DetailBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    begin
         inc(AG_No) ;
         laNo.Caption := inttostr(AG_No) ;
    end;

    end.




  • Profile
    김종현 2004.04.21 23:01
    어떻게 말로 표현을 드릴수가..............

    아직 실행은 시켜보지 않았으나

    딱 보는순간 될것 같습니다.

    정말 감사합니다.

    꾸벅.......................항상 좋은일만 생기실 겁니다..........
  • Profile
    냐옹이 2007.04.19 06:43
    안되는데요..Delphi버젼이 어케 되는데요?

    TAfterPrintEvent...요기서 Error
    fsPadL 요것도 없다고 나오구,,

    다른것은 해보지도 못하고요~
    고수님..더 상세히 가르침을 주세요~


    Uses Qrctrls........
    요거는 어디에 있는 놈인가요?
    저는 없어요~