線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2552
推到 Plurk!
推到 Facebook!

請問該如何將運算出的內容填入QuickReport?

尚未結案
myboss
一般會員


發表:25
回覆:42
積分:13
註冊:2004-01-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-20 14:08:55 IP:220.131.xxx.xxx 未訂閱
大家好,我有問題想要請教: 有三個資料表,一個是專案資料,另一個是專案使用材料資料,及材料資料表 專案資料表: 專案代號 施工地址 電話 PJ001 台北市 02-22222222 PJ002 台北縣 02-22222223 專案使用材料: 專案代號 材料代號 數量 PJ001 MA001 20 PJ001 MA020 10 材料資料表: 材料代號 材料名稱 單位 MA001 19"液晶螢幕 台 MA020 RJ45網路線 米 現在公司指定要列印的表單是A3格式 施工地址 電話 材料一(19"液晶螢幕) RJ45網路線‧‧‧材料N 台北市 02-222222222 20 10 ‧ ‧ ‧ 本頁統計 統計一 統計二 ‧‧‧統計N 總共統計 統計一 統計二 ‧‧‧統計N 問大學教授結果是要用算的填入QuickReport,只是不知如何做起,該如何釐定每筆紀錄間之距離,每頁該有幾筆紀錄,該如何分頁次?希望有人能範例示之! PS:每次使用之材料不同但不超過24個,材料不只50個 發表人 - taishyang 於 2005/03/20 23:38:30
ubong
一般會員


發表:2
回覆:42
積分:23
註冊:2002-10-02

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-03-20 15:18:17 IP:218.163.xxx.xxx 未訂閱
我目前使用BCB6.0 Personal版本,沒有 QuickReport功能,僅就記憶所及告訴 你,當你在一個新的Form 貼上QuickReport 元件,其中有一個Band 是你貼上要列印元件之處,你按滑鼠右鍵會有一個設定印表大小的選項,你只要設定紙張大小,QuickReport 會幫你產生一樣的環境,你只要在要列印的位置貼上DbText( 記得是這樣),連結上你要列印的資料表欄位,如要經過運算的資料,就貼上一般的Text,然後在BeforePrint()這個Event 填上處理程序再將此Text=你處理後的值就可以了。 我個人最近列印資料都使用直接列印,下列例子供你參考: #include <Printers.hpp> // 要include 此檔 <>請改回半型字 oid __fastcall TForm1::Button1Click(TObject *Sender) {  TPrinter *ptr=Printer(); // 以下部份是設定紙張大小,如用一般規格此投可省略 char *ADevice, *ADriver, *APort; THandle DeviceMode; PDeviceMode DevMode; int length,width; length=2283; width=2410;//設定自定義紙張的尺寸單位為0.1毫米(0.01cm) ADevice =new char[100]; ADriver =new char[100]; APort =new char[100]; //獲取打印機 ptr->GetPrinter(ADevice, ADriver, APort,DeviceMode); //獲取PDevMode結構 DevMode =(_devicemodeA*) GlobalLock((void *)DeviceMode); //設定可以修改的值 DevMode->dmFields = DevMode->dmFields|DM_PAPERSIZE; DevMode->dmFields = DevMode->dmFields|DM_PAPERLENGTH; DevMode->dmFields = DevMode->dmFields|DM_PAPERWIDTH; //設定要修改的值 DevMode->dmPaperSize=DMPAPER_USER;//設為自定義紙張 DevMode->dmPaperLength=length; DevMode->dmPaperWidth=width; // 至此為止     ptr->BeginDoc();// 開啟印表工作  float dots=(float)ptr->Canvas->Font->PixelsPerInch*100/2550;    //取得印表機0.1公分的點數  ptr->Canvas->Font->Name="標楷體";  for(int i=0;iText);i ){ //Edit1設定要列印的張數 if(i) ptr->NewPage(); //第二張起跳頁 ptr->Canvas->Font->Size=14;// 字型大小 ptr->Canvas->TextOut(x*dots,y*dots,custom.name); //x=左起x(mm),y=從上算起y(mm)印出客戶名稱 } ptr->EndDoc();//結束列印工作 } ubong
------
ubong
myboss
一般會員


發表:25
回覆:42
積分:13
註冊:2004-01-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-03-22 15:11:32 IP:220.131.xxx.xxx 未訂閱
ubong先生你好: QuickReport上貼Band後在Band上放置QRDBText的方法我知道,可是 專案使用材料表 上的欄位是 專案代號 材料代號 數量,而公司所要求 之表單上所要求的是動態將所使用的材料列出,也就是說可能今天使用 材料一 材料二 材料三‧‧‧材料二十,明天就變成 材料一 材料五 材料三十‧‧‧材料四十九 表單上的材料欄位會隨著日期不同而變動,不過大體上不會超過24個 另外在哪可查詢到以下_devicemodeA及GlobalLock的資料 DevMode =(_devicemodeA*) GlobalLock((void *)DeviceMode); 還有以下iText的定義 for(int i=0;iText);i ){ //Edit1設定要列印的張數 以下這行i似乎一定大於0,不就強迫跳頁了 if(i) ptr->NewPage(); //第二張起跳頁 以及下面似乎只列印custom.name一次 ptr->Canvas->TextOut(x*dots,y*dots,custom.name); //x=左起x(mm),y=從上算起y(mm)印出客戶名稱 發表人 - myboss 於 2005/03/22 15:51:51
myboss
一般會員


發表:25
回覆:42
積分:13
註冊:2004-01-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-04-13 21:01:48 IP:220.131.xxx.xxx 未訂閱
GlobalLock 已在Win32處找到,不過 DevMode =(_devicemodeA*) GlobalLock((void *)DeviceMode); 還是不懂,這是C 程式碼吧,該研讀哪些書呢? 另custom.name是否代表定義了一個 Struct Custom{ String name; }custom The GlobalLock function locks a global memory object and returns a pointer to the first byte of the object's memory block. The memory block associated with a locked memory object cannot be moved or discarded. For memory objects allocated with the GMEM_MOVEABLE flag, the function increments the lock count associated with the memory object. LPVOID GlobalLock( HGLOBAL hMem // address of the global memory object ); Parameters hMem Identifies the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function. Return Values If the function succeeds, the return value is a pointer to the first byte of the memory block. If the function fails, the return value is NULL. To get extended error information, call GetLastError. Remarks The internal data structures for each memory object include a lock count that is initially zero. For movable memory objects, GlobalLock increments the count by one, and the GlobalUnlock function decrements the count by one. For each call that a process makes to GlobalLock for an object, it must eventually call GlobalUnlock. Locked memory will not be moved or discarded, unless the memory object is reallocated by using the GlobalReAlloc function. The memory block of a locked memory object remains locked until its lock count is decremented to zero, at which time it can be moved or discarded. Memory objects allocated with the GMEM_FIXED flag always have a lock count of zero. For these objects, the value of the returned pointer is equal to the value of the specified handle. If the specified memory block has been discarded or if the memory block has a zero-byte size, this function returns NULL. Discarded objects always have a lock count of zero.
系統時間:2024-03-28 19:05:03
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!