全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1786
推到 Plurk!
推到 Facebook!

Qreport列印橫式的資料

答題得分者是:Justmade
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-19 17:02:13 IP:61.219.xxx.xxx 未訂閱
以下是一個關於保養資料的Table Sno:序號 TNo:設備代號 TPNO:設備部位代號 MDAte:保養日期 TableA ======================= SNo,TNo,TPNo,Mdate ----------------------- 920601001,A1,01,920601 920601002,A1,02,920603 920601003,A2,01,920605 920601004,A2,02,920611 920601005,A3,01,920620 920601006,A3,02,920627 920601007,A3,03,920628 920701001,A1,01,920701 920701002,A1,01,920711 920701003,A2,01,920715 920701004,A2,02,920716 920701005,A3,01,920718 920701006,A3,02,920719 920701007,A3,03,920725 920801001,A1,01,920801 920801002,A1,02,920806 920801003,A2,01,920809 920801004,A2,02,920815 920801005,A3,01,920806 920801006,A3,02,920809 920801007,A3,03,920815 ======================== 可以用Qreport印出保養情形嗎? YY表示已保養(Mdate的資料存在) Page1. 01 02 03 04 05 06 07 08 09 10 11 12 -->月份 ** ** ** ** ** YY YY YY ** ** ** ** -->A1,01 ** ** ** ** ** YY YY YY ** ** ** ** -->A1,02 Page2. 01 02 03 04 05 06 07 08 09 10 11 12 -->月份 ** ** ** ** ** YY YY YY ** ** ** ** -->A2,01 ** ** ** ** ** YY YY YY ** ** ** ** -->A2,02 Page3. 01 02 03 04 05 06 07 08 09 10 11 12 -->月份 ** ** ** ** ** YY YY YY ** ** ** ** -->A3,01 ** ** ** ** ** YY YY YY ** ** ** ** -->A3,02 ** ** ** ** ** YY YY YY ** ** ** ** -->A3,03 請各位幫忙想想如何實踐出上面的想法
ddy
站務副站長


發表:262
回覆:2105
積分:1169
註冊:2002-07-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-20 13:54:35 IP:61.218.xxx.xxx 未訂閱
建議先將TABLE A 資料,先行轉換成報表想輸出的樣子 會比較簡單 加油~~ < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=8147403&CC=182217">
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-21 13:47:18 IP:218.16.xxx.xxx 未訂閱
用 Query , select 時 order by Tno, Tpno Detail before print 時 記住 Tno 及 Tpno for i := 9201 to 9212 先對比 Tno / Tpno 是否相同若不相同則 Break (記得將剩下 Label 設 **) 對比現記錄Mdate 的頭四個字是不等於 i 若是的話將相對月份的 Label 設成 YY,Query.Next 直到頭四個字不等於 i 若否的話將相對月份的 Label 設成 ** end// for i 將記錄回跳一筆 (prior) 因為到下一次 Detail 時會自動跳一筆 你可以加個 Group , Expression 設 Tno, 另設開新頁,便可不同 Tno 印在不同頁 參考一下: http://delphi.ktop.com.tw/topic.php?TOPIC_ID=30868 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=35773 發表人 - Justmade 於 2003/08/21 13:54:16
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-22 10:52:28 IP:61.219.xxx.xxx 未訂閱
Justmade兄 感謝您的指導 已經完成了但是有一個問題    在列印時 YY 會一直持續列印出來-----程式中以'H'呈現    ========================= SNo,EQM_No,EQM_PNo,EQM_date -------------------------------- 920601001  ,A1,  01,  920601 920601002  ,A1,  02,  920603 920701001  ,A1,  03,  920605 920601001  ,A1,  01,  920701 920701001  ,A1,  03,  920705    假設是以上的狀況 A1,02,9207並無資料但列印時對應七月的Label仍會印出來 應該是延續A1,02,9206的資料而印出來的 我要如何讓每一個Detail都是獨立的,Label.Caption不會受到上一筆 資料所影響 EX.列印結果 no: A1 --------------------------------------- pno,01-02-03-04-05-06-07-08-09-10-11-12 --------------------------------------- 01 ,**-**-**-**-**-H-H-**-**-**-**-** 02 ,**-**-**-**-**-H-H-**-**-**-**-** 03 ,**-**-**-**-**-H-H-**-**-**-**-** 紅色H是錯誤的 以下是我的程式請Justmade兄幫忙看一下 再次指導 謝謝 procedure TFmRepHisMain_1.QRBand3BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean); var M_NO,M_PNO,M_DATE:String; begin M_NO:=Query1.FieldByName('EQM_NO').AsString; M_PNO:=Query1.FieldByName('EQM_PNO').AsString; try Query1.Next; while (Query1.FieldByName('EQM_NO').AsString = M_NO) and (Query1.FieldByName('EQM_PNO').AsString = M_PNO) and not Query1.Eof do begin M_Date:=MidStr(Query1.FieldByName('EQM_DATE').AsString,5,2); If M_Date='01' then QRLabel3.Caption:='H'; If M_Date='02' then QRLabel4.Caption:='H'; If M_Date='03' then QRLabel5.Caption:='H'; If M_Date='04' then QRLabel6.Caption:='H'; If M_Date='05' then QRLabel7.Caption:='H'; If M_Date='06' then QRLabel8.Caption:='H'; If M_Date='07' then QRLabel9.Caption:='H'; If M_Date='08' then QRLabel10.Caption:='H'; If M_Date='09' then QRLabel11.Caption:='H'; If M_Date='10' then QRLabel12.Caption:='H'; If M_Date='11' then QRLabel13.Caption:='H'; If M_Date='12' then QRLabel14.Caption:='H'; Query1.Next; end; finally if not Query1.Eof then Query1.Prior; end; end;
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-23 13:38:59 IP:218.16.xxx.xxx 未訂閱
簡化一下    
procedure TFmRepHisMain_1.QRBand3BeforePrint(Sender: TQRCustomBand;  var PrintBand: Boolean);
var
   M_NO,M_PNO:String;
   i, M_Date : integer;
begin
   M_NO:=Query1.FieldByName('EQM_NO').AsString;
   M_PNO:=Query1.FieldByName('EQM_PNO').AsString;       For i := 3 to 12 do
      QRBand3.FindControl(Format('QRLabel%d',[i])).Caption := '**'; // 先還原所有 label 為 **       try
      Query1.Next; 這句應不用罷??否則第一個 record 不就沒處理了??
      while (Query1.FieldByName('EQM_NO').AsString = M_NO) and (Query1.FieldByName('EQM_PNO').AsString = M_PNO) and not query1.Eof do
         begin
           M_Date:= StrToInt(MidStr(Query1.FieldByName('EQM_DATE').AsString,5,2));
           QRBand3.FindControl(Format('QRLabel%d',[M_Date   2])).Caption := 'H'; 
           Query1.Next;
         end;
   finally
      if not Query1.Eof then Query1.Prior;
  end;
end;
發表人 - Justmade 於 2003/08/23 13:41:08
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-08-26 09:02:09 IP:61.219.xxx.xxx 未訂閱
Justmade兄 For i := 3 to 12 do QRBand3.FindControl(Format('QRLabel%d',[i])).Caption := '**'; // 先還原所有 label 為 ** 好像有點問題 執行時發生錯誤 Undeclared identifier 'FindControl' 我在編輯時 QBand3. --->只有FindChildControl及FindComponment兩個Function 並無FindControl的function 我有疏忽的地方? 另外Format的部分也有錯誤 也請Justmade兄再指教
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-08-28 08:31:22 IP:61.219.xxx.xxx 未訂閱
引言: 建議先將TABLE A 資料,先行轉換成報表想輸出的樣子 會比較簡單 加油~~ < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=8147403&CC=182217">
ddy副站長的方法是可行的,可是要時改成每日的保養資料 均要秀在報表上恐怕會很大費周章 ex. A2 01 920102 A2 01 920103 A2 01 920104 秀在報表上 A1 -- 01 02 03 04 05 06 07 08 09 10 11 12 01 ** 02 HH 03 HH 04 HH 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 -----------------------------------------------
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-09-02 19:24:40 IP:218.172.xxx.xxx 未訂閱
我已經做出來了就是在我原來的"複雜"的程式中 先將12個Label的Caption先設成'**' 這樣就可以了 但我還是想知道Justmade兄提供的正確的程式 以讓小弟學習比較具水準的設計方法
系統時間:2024-05-02 8:41:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!