Q&A

  • 퀵레포트에서 onNeedData 말인데여..
안녕하세염?



존 아침입니다..



존 아침은 아침인데......저를 머리 아프게 할라는 문제가 있어서여..



제가 지금 퀵레포트로 출력물을 만드는데...



분류번호 : 1234 분류번호 : 2154 분류번호 : 1111

품 명 : 지우개 품 명 : 샤프심 품 명 : 연필

규 격 : mg 규 격 : mg 규 격 : mg



분류번호 : 1234

품 명 : 지우개 . . . .

규 격 : mg



이런 식으로 가로를 채우고 그다음에 세로는 찍고 싶거든여..



근데 여기를 뒤져보니깐 column을 바꾸는게 아니라 OnNeedData를 쓰면 된다고는 써있는데....



구체적으로 어케 써야하는지가 없어서여...



moreData가 True면 찍을수가 있다는데...



도대체 구체적으로 어케해야하는지 전혀 모르겠거든여...



내용은 dbf파일에서 (stringGrid나 dbGrid아님) 끌어오구여...



근데 또 어디서는 퀵레포트의 Dataset을 주면 안된다고도 읽은거 같은데...



넘넘 머리 아포여 f(__)



아참 퀵레포트의 event 일어나는 순서도 좀 갈쳐주세여.



예를 들면 beforePrint -> afterPrint ->... 이런식으로여..



그리고 또하나.........아니다......



이것만 답변주시면...나머지는 제가 열씨미~~ 해볼랍니다^^;



꼭 답변주세여~~(-- #)

3  COMMENTS
  • Profile
    송병철 2001.08.09 07:43


    unit Fzap400;



    interface



    uses

    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

    Qrctrls, quickrpt, ExtCtrls,APL;



    type

    TfrmZAP400 = class(TForm)

    QuickRep1: TQuickRep;

    ColumnHeaderBand1: TQRBand;

    QRDb: TQRBand;

    PageFooterBand1: TQRBand;

    PageHeaderBand1: TQRBand;

    QRPHb: TQRBand;

    lbTitle: TQRLabel;

    QRLabel2: TQRLabel;

    lbquery: TQRLabel;

    QRShape4: TQRShape;

    QRShape1: TQRShape;

    QRShape2: TQRShape;

    QRShape3: TQRShape;

    QRLabel3: TQRLabel;

    QRLabel4: TQRLabel;

    QRLabel5: TQRLabel;

    QRLabel6: TQRLabel;

    QRShape10: TQRShape;

    QRShape9: TQRShape;

    QRShape8: TQRShape;

    QRShape11: TQRShape;

    QRShape5: TQRShape;

    QRShape6: TQRShape;

    QRShape7: TQRShape;

    lbCell1: TQRLabel;

    lbCell2: TQRLabel;

    lbCell3: TQRLabel;

    lbCell4: TQRLabel;

    QRSysData1: TQRSysData;

    QRLabel1: TQRLabel;

    QRShape14: TQRShape;

    QRShape15: TQRShape;

    QRShape16: TQRShape;

    QRShape12: TQRShape;

    QRShape17: TQRShape;

    QRShape13: TQRShape;

    lbCell5: TQRLabel;

    lbCell6: TQRLabel;

    QRLabel7: TQRLabel;

    QRLabel8: TQRLabel;

    QRLabel9: TQRLabel;

    QRLabel10: TQRLabel;

    procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    procedure QuickRep1BeforePrint(Sender: TQuickRep;

    var PrintReport: Boolean);

    private

    { Private declarations }

    cnt : Integer;

    public

    { Public declarations }

    end;



    var

    frmZAP400: TfrmZAP400;



    implementation



    {$R *.DFM}

    uses

    dtask,fzaq400, acs, Fzaq400C;



    procedure TfrmZAP400.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    begin

    if gbJobName = '현보유현황(1)' then begin

    with frmZAQ400.ExtSummaryGrid1 do

    begin

    MoreData := True;

    lbCell1.Caption := ClearGridChar(Cells[0, cnt]);

    lbCell2.Caption := Cells[1, cnt];

    lbCell3.Caption := Cells[2, cnt];

    lbCell4.Caption := Cells[3, cnt];

    lbCell5.Caption := Cells[4, cnt];

    lbCell6.Caption := Cells[5, cnt];

    MoreData := cnt <= RowCount-1;

    Inc(cnt);

    end;

    end else

    if gbJobName = '현보유현황(2)' then begin

    with frmZAQ400C.ExtSummaryGrid1 do

    begin

    MoreData := True;

    lbCell1.Caption := ClearGridChar(Cells[0, cnt]);

    lbCell2.Caption := Cells[1, cnt];

    lbCell3.Caption := Cells[2, cnt];

    lbCell4.Caption := Cells[3, cnt];

    lbCell5.Caption := Cells[4, cnt];

    lbCell6.Caption := Cells[5, cnt];

    MoreData := cnt <= RowCount-1;

    Inc(cnt);

    end;

    end;{end if }

    end;



    procedure TfrmZAP400.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: Boolean);

    begin

    cnt := 1;



    if gbJobName = '현보유현황(1)' then begin

    lbQuery.Caption := frmZAQ400.label2.Caption;

    end else

    if gbJobName = '현보유현황(2)' then begin

    lbQuery.Caption := frmZAQ400C.label2.Caption;

    end;



    QRLabel1.Caption := Bipyo__;

    end;





    jewel wrote:

    > 안녕하세염?

    >

    > 존 아침입니다..

    >

    > 존 아침은 아침인데......저를 머리 아프게 할라는 문제가 있어서여..

    >

    > 제가 지금 퀵레포트로 출력물을 만드는데...

    >

    > 분류번호 : 1234 분류번호 : 2154 분류번호 : 1111

    > 품 명 : 지우개 품 명 : 샤프심 품 명 : 연필

    > 규 격 : mg 규 격 : mg 규 격 : mg

    >

    > 분류번호 : 1234

    > 품 명 : 지우개 . . . .

    > 규 격 : mg

    >

    > 이런 식으로 가로를 채우고 그다음에 세로는 찍고 싶거든여..

    >

    > 근데 여기를 뒤져보니깐 column을 바꾸는게 아니라 OnNeedData를 쓰면 된다고는 써있는데....

    >

    > 구체적으로 어케 써야하는지가 없어서여...

    >

    > moreData가 True면 찍을수가 있다는데...

    >

    > 도대체 구체적으로 어케해야하는지 전혀 모르겠거든여...

    >

    > 내용은 dbf파일에서 (stringGrid나 dbGrid아님) 끌어오구여...

    >

    > 근데 또 어디서는 퀵레포트의 Dataset을 주면 안된다고도 읽은거 같은데...

    >

    > 넘넘 머리 아포여 f(__)

    >

    > 아참 퀵레포트의 event 일어나는 순서도 좀 갈쳐주세여.

    >

    > 예를 들면 beforePrint -> afterPrint ->... 이런식으로여..

    >

    > 그리고 또하나.........아니다......

    >

    > 이것만 답변주시면...나머지는 제가 열씨미~~ 해볼랍니다^^;

    >

    > 꼭 답변주세여~~(-- #)

  • Profile
    jewel 2001.08.10 01:25
    제가 머리가 너무 나쁜탓일까여?



    저는 아무리 드려다바두.......이해가 안가여..



    저한테는 OnNeedData에서 가로로 찍을수 있는 방법이 중요하거든여



    그러니깐....



    ----------------------

    1 2 3



    4 5 6

    .

    .



    --------------------------



    이런식으로 찍을수 있는 방법이 필요하거든여...



    gbJobName = '현보유현황(1)'==> 이게 먼지는 잘 몰겠지만....하여간 지금 폼에 있는 변수는 아닌거 가튼데.......



    어쨌든 제가 보기에는 옆으로 찍어주는 예제는 아닌거 가토서여..



    아닌가여? f(__)



    진짜로 너무 모르겠어여.....



    앙~~~~~~~!



    송병철 wrote:

    >

    > unit Fzap400;

    >

    > interface

    >

    > uses

    > Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

    > Qrctrls, quickrpt, ExtCtrls,APL;

    >

    > type

    > TfrmZAP400 = class(TForm)

    > QuickRep1: TQuickRep;

    > ColumnHeaderBand1: TQRBand;

    > QRDb: TQRBand;

    > PageFooterBand1: TQRBand;

    > PageHeaderBand1: TQRBand;

    > QRPHb: TQRBand;

    > lbTitle: TQRLabel;

    > QRLabel2: TQRLabel;

    > lbquery: TQRLabel;

    > QRShape4: TQRShape;

    > QRShape1: TQRShape;

    > QRShape2: TQRShape;

    > QRShape3: TQRShape;

    > QRLabel3: TQRLabel;

    > QRLabel4: TQRLabel;

    > QRLabel5: TQRLabel;

    > QRLabel6: TQRLabel;

    > QRShape10: TQRShape;

    > QRShape9: TQRShape;

    > QRShape8: TQRShape;

    > QRShape11: TQRShape;

    > QRShape5: TQRShape;

    > QRShape6: TQRShape;

    > QRShape7: TQRShape;

    > lbCell1: TQRLabel;

    > lbCell2: TQRLabel;

    > lbCell3: TQRLabel;

    > lbCell4: TQRLabel;

    > QRSysData1: TQRSysData;

    > QRLabel1: TQRLabel;

    > QRShape14: TQRShape;

    > QRShape15: TQRShape;

    > QRShape16: TQRShape;

    > QRShape12: TQRShape;

    > QRShape17: TQRShape;

    > QRShape13: TQRShape;

    > lbCell5: TQRLabel;

    > lbCell6: TQRLabel;

    > QRLabel7: TQRLabel;

    > QRLabel8: TQRLabel;

    > QRLabel9: TQRLabel;

    > QRLabel10: TQRLabel;

    > procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    > procedure QuickRep1BeforePrint(Sender: TQuickRep;

    > var PrintReport: Boolean);

    > private

    > { Private declarations }

    > cnt : Integer;

    > public

    > { Public declarations }

    > end;

    >

    > var

    > frmZAP400: TfrmZAP400;

    >

    > implementation

    >

    > {$R *.DFM}

    > uses

    > dtask,fzaq400, acs, Fzaq400C;

    >

    > procedure TfrmZAP400.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    > begin

    > if gbJobName = '현보유현황(1)' then begin

    > with frmZAQ400.ExtSummaryGrid1 do

    > begin

    > MoreData := True;

    > lbCell1.Caption := ClearGridChar(Cells[0, cnt]);

    > lbCell2.Caption := Cells[1, cnt];

    > lbCell3.Caption := Cells[2, cnt];

    > lbCell4.Caption := Cells[3, cnt];

    > lbCell5.Caption := Cells[4, cnt];

    > lbCell6.Caption := Cells[5, cnt];

    > MoreData := cnt <= RowCount-1;

    > Inc(cnt);

    > end;

    > end else

    > if gbJobName = '현보유현황(2)' then begin

    > with frmZAQ400C.ExtSummaryGrid1 do

    > begin

    > MoreData := True;

    > lbCell1.Caption := ClearGridChar(Cells[0, cnt]);

    > lbCell2.Caption := Cells[1, cnt];

    > lbCell3.Caption := Cells[2, cnt];

    > lbCell4.Caption := Cells[3, cnt];

    > lbCell5.Caption := Cells[4, cnt];

    > lbCell6.Caption := Cells[5, cnt];

    > MoreData := cnt <= RowCount-1;

    > Inc(cnt);

    > end;

    > end;{end if }

    > end;

    >

    > procedure TfrmZAP400.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: Boolean);

    > begin

    > cnt := 1;

    >

    > if gbJobName = '현보유현황(1)' then begin

    > lbQuery.Caption := frmZAQ400.label2.Caption;

    > end else

    > if gbJobName = '현보유현황(2)' then begin

    > lbQuery.Caption := frmZAQ400C.label2.Caption;

    > end;

    >

    > QRLabel1.Caption := Bipyo__;

    > end;

    >

    >

    > jewel wrote:

    > > 안녕하세염?

    > >

    > > 존 아침입니다..

    > >

    > > 존 아침은 아침인데......저를 머리 아프게 할라는 문제가 있어서여..

    > >

    > > 제가 지금 퀵레포트로 출력물을 만드는데...

    > >

    > > 분류번호 : 1234 분류번호 : 2154 분류번호 : 1111

    > > 품 명 : 지우개 품 명 : 샤프심 품 명 : 연필

    > > 규 격 : mg 규 격 : mg 규 격 : mg

    > >

    > > 분류번호 : 1234

    > > 품 명 : 지우개 . . . .

    > > 규 격 : mg

    > >

    > > 이런 식으로 가로를 채우고 그다음에 세로는 찍고 싶거든여..

    > >

    > > 근데 여기를 뒤져보니깐 column을 바꾸는게 아니라 OnNeedData를 쓰면 된다고는 써있는데....

    > >

    > > 구체적으로 어케 써야하는지가 없어서여...

    > >

    > > moreData가 True면 찍을수가 있다는데...

    > >

    > > 도대체 구체적으로 어케해야하는지 전혀 모르겠거든여...

    > >

    > > 내용은 dbf파일에서 (stringGrid나 dbGrid아님) 끌어오구여...

    > >

    > > 근데 또 어디서는 퀵레포트의 Dataset을 주면 안된다고도 읽은거 같은데...

    > >

    > > 넘넘 머리 아포여 f(__)

    > >

    > > 아참 퀵레포트의 event 일어나는 순서도 좀 갈쳐주세여.

    > >

    > > 예를 들면 beforePrint -> afterPrint ->... 이런식으로여..

    > >

    > > 그리고 또하나.........아니다......

    > >

    > > 이것만 답변주시면...나머지는 제가 열씨미~~ 해볼랍니다^^;

    > >

    > > 꼭 답변주세여~~(-- #)

  • Profile
    송병철 2001.08.10 20:18
    > 저한테는 OnNeedData에서 가로로 찍을수 있는 방법이 중요하거든여

    >

    > 그러니깐....



    이미 스트링 그리드에서 아래와 같은 형식으로 DisPlay되어 있어야 합니다



    > ----------------------

    > 1 2 3

    >

    > 4 5 6

    > .

    > .

    >

    > --------------------------



    그다음 레포트의 OnNeedData에서 그대로 불러오면 됩니다.



    리포트의 DetailBand에 라벨 1 , 2, 3 만 3개 올려 놓고



    > gbJobName = '현보유현황(1)'==> 이게 먼지는 잘 몰겠지만....하여간 지금 폼에 있는 변수는 아닌거 가튼데.......



    아래의 예제는 하나의 보기 사례입니다. 참조하시라고 보여드린건데...넘 어려웠나요^^





    > > procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    > > procedure QuickRep1BeforePrint(Sender: TQuickRep;

    > > var PrintReport: Boolean);

    > > private

    > > { Private declarations }

    > > cnt : Integer;

    > > public

    > > { Public declarations }

    > > end;

    > >

    > > var

    > > frmZAP400: TfrmZAP400;

    > >

    > > implementation

    > >

    > > {$R *.DFM}

    > > uses

    > > dtask,fzaq400, acs, Fzaq400C;

    > >

    > > procedure TfrmZAP400.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);

    > > begin

    > > if gbJobName = '현보유현황(1)' then begin <--이건 무시하시고



    > > with frmZAQ400.ExtSummaryGrid1 do <-- 불러오고자 하는 폼의 스트링그리드에서

    > > begin

    > > MoreData := True;



    lbCell1... 등등은 이미 리포트의 DetailBand에서 디자인된 레포트 라벨이겠지요



    Label1.Caption := Cells[0(세로 즉 Colum의 위치입니다),cnt(가로 즉 RowCount입니다.) ];

    Label2.Caption := Cells[1,cnt];

    Label3.Caption := Cells[2,cnt];



    > > lbCell1.Caption := ClearGridChar(Cells[0, cnt]);

    > > lbCell2.Caption := Cells[1, cnt];

    > > lbCell3.Caption := Cells[2, cnt];

    > > lbCell4.Caption := Cells[3, cnt];

    > > lbCell5.Caption := Cells[4, cnt];

    > > lbCell6.Caption := Cells[5, cnt];





    > > MoreData := cnt <= RowCount-1; <-- Moredata는 RowCount로 지정한 변수 Cnt 가 스트링그리드의 RowCount 수 만큼 계속할때까지 증가합니다..

    그러면 레포트의 디테일벤드의 수가 이만큼 증가하겠지요



    > > Inc(cnt); <-- 계속 Cnt를 증가시킵니다. 왜냐하면 OnNeedData한 Row가 출력될때마다 MoreData가 얼마까지 Row를 증가시켜야 하는지 알아야 되겠지요



    > >

    > > procedure TfrmZAP400.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: Boolean);

    > > begin

    > > cnt := 1;

    > >

    > > if gbJobName = '현보유현황(1)' then begin



    > > lbQuery.Caption := frmZAQ400.label2.Caption; <-- 이부분은 ColumHeder나 Title , PageHeader에 찍을 Caption을 뿌려줍니다..



    이상 제가 설명할 수 있는 부분입니다..

    나머진 교재나 예제 프로그램들(DelPhi DemoQuickrptQr3에 needdata)을 참조해보세요



    그럼 즐프를.......