The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our...

57
The system about inquiry and management in the bookshop : :

Transcript of The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our...

Page 1: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

逢 ㆙ 大 學

自 動 控 制 工 程 學 系

畢 業 專 題 報 告

書 店 查 詢 管 理 系 統

The system about inquiry and management in

the bookshop

指 導 教 授 : 蘇 文 彬

學 生 : 張 文 棟

張 簡 宗 輝

㆗ 華 民 國 九 十 年 六 月

Page 2: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

逢 ㆙ 大 學 自 動 控 制 工 程 學 系 畢 業 專 題 報 告

書 店 查 詢 管 理 系 統

The system about inquiry and management in

the bookshop

指 導 教 授 : 蘇 文 彬 學 生 : 張 文 棟

張 簡 宗 輝

Page 3: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

i

感感感感 謝謝謝謝

自從㆖學期以來,㆒直專注於畢業專題㆖,感謝蘇文彬教授在這麼漫長的㆒段

光陰裡,陪我們㆒起渡過這麼艱辛的歷程。在期㆗,我們得到不少寶貴的知識與經

驗,雖然不能說什麼大傑作,但這可是我們多月努力的成果,在此特別致㆖最誠摯

的謝意,謝謝。

在此亦感謝李宗鑫學長,在我們剛接觸到程式語言時,其以過來㆟的經驗指導

我們學習的正確方向,並在設計程式過程㆗給予我們詢問的對象,並給予我們支持

與鼓勵。

此外也感謝饒穎杰學長,我們在程式設計過程之㆗因硬體方面發生故障,而學

長亦不吝出借我們所需之相關硬體器材,使我們程式得以順利完成,在此感謝之。

另外亦要感謝育才文化廣場之蘇桂蘭女士,在我們設計初期給予我們有關於書

店運作之相關資訊,以使我們在功能設計方面能有所方向。

最後,在此僅對於我們在從設計之初直到程式完成之間,任何給予我們協助及

幫忙的師長及朋友們,獻㆖我們最誠摯無比的謝意,感謝大家。

Page 4: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

ii

㆗文摘要㆗文摘要㆗文摘要㆗文摘要

本組所發表之畢業專題名稱為書店查詢管理系統,乃是以撰寫 C++語言的方

式完成㆒應用程式,使其功能能夠模擬㆒般市面㆖書店在查詢及管理方面的需求。

工具則是使用 Builder C++4.0 為㆒輔助工具, 透過其強大的物件及其他各項功

能,並以 C++語言之撰寫使之細部功能達到我們所需之要求。

總共可以分㆔大部分 : 顧客查詢功能、模擬櫃台結帳、管理系統,除了基本

查詢部分,對於較高層私㆟密秘,我們設有密碼,以防他㆟私自闖入,進行亂寫及

刪除。除了主要部分外,我們還有㆒些小功能,例如:報表列印功能,這項貼心的

設計,可以為主㆟分㆒些麻煩。

Page 5: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

iii

ABSTRACT

The announcement of our graduate subject is “ The system about inquiry and

management in the bookshop “ It is to be completed by Builder C+ + . It can imitate

inquiry and management in some bookshops . By these programs , we reach our requests

about some detailed or other functions which can operate the system .

It can be separated three main sections : customer inquiry function、counter

imitation function、management function . Except basic inquiry section , about higher

private section , we have a secret code , which is in order to protect other people write

error data or delete . Except main sections , we also have some small functions . For

example , forms printing function , this intimate design can separate a little trouble from

hosts .

Page 6: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

iv

目錄目錄目錄目錄

頁次

感謝 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - i

㆗文摘要 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - i i

英文摘要 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - i i i

目錄 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - i v

圖目錄 ------------------------------------------------------------ vi

第㆒章 前言 ------------------------------------------------------- 1

1.1 研究動機 --------------------------------------------------- 1

1.2 研究目標 --------------------------------------------------- 1

第㆓章 內容探討 --------------------------------------------------- 2

2.1 想法與規範 ------------------------------------------------------------------------- 2

2.2 查詢與管理 ------------------------------------------------------------------------- 3

第㆔章 設計與分析 ------------------------------------------------- 4

3.1 設計過程 --------------------------------------------------------------------------- 4

3.2 流程圖 ---------------------------------------------------- 7

3.3 流程圖說明 ------------------------------------------------ 7

第㆕章 程式模擬與整理 --------------------------------------------- 9

4.1 操作說明 ----------------------------------------------- 9

4.2 模擬說明 ----------------------------------------------- 15

Page 7: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

v

4.3 程式整理分析 --------------------------------------------16

第五章 成果敘述 -------------------------------------------------17

5.1 擴充敘述 ------------------------------------------------17

5.2 成果敘述 ---------------------------------------------------------------------- 17

第六章 結論 --------------------------------------------------- 18

參考文獻 ------------------------------------------------------- 19

附錄 ----------------------------------------------------------- 20

Page 8: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

vi

圖目錄圖目錄圖目錄圖目錄

頁次

圖 3.1分析流程圖 ---------------------------------------------------7

圖 4.1程式主畫面 -------------------------------------------------------------------------- 9

圖 4.2書籍查詢畫面 ------------------------------------------------------------------------10

圖 4.3櫃檯結帳系統認證畫面 ------------------------------------------------------------11

圖 4.4櫃檯結帳系統畫面 ---------------------------------------------------------------11

圖 4.5買書功能畫面 -------------------------------------------------------------------- 12

圖 4.6退書功能畫面 -------------------------------------------------------------------- 12

圖 4.7管理系統認證畫面 -------------------------------------------------------------- 13

圖 4.8管理系統畫面 -------------------------------------------------------------------- 14

圖 4.9報表功能畫面 -------------------------------------------------------------------- 14

圖 4.10結束程式認證畫面 ------------------------------------------------------------- 15

Page 9: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

1

第㆒章第㆒章第㆒章第㆒章 前言前言前言前言

1.1 研究動機研究動機研究動機研究動機

目前書局雖為數眾多,但真正管理有效率者實佔少數,而其㆗使用相關查詢管

理系統來管理者,除少數連鎖的大書局外,其他則少之又少,而若要向電腦公司買,

除了要㆒筆花費外,再來可能又未必符合本身所需,因此若能善用所學撰寫㆒符合

經濟效益,又能量身訂作之程式,那就更完美了,故我們打算在 Builder C++語言

撰寫㆒書局管理查詢系統。

1.2研究目標研究目標研究目標研究目標

在這套系統裡,我們有㆔大部分:顧客查詢功能、模擬櫃台結帳 、管理系統。

有關這㆔大部分的詳細介紹,我們會在第㆕章有明確的內容。

在㆒般的書店裡,少不了這㆔種部分。因此我們針對這㆔種部分來進行模擬分

析,進而再作程式的撰寫。當然這㆔大基本架構還有㆒些支架,例如多樣的查詢方

法,報表列印,原本我們與教授㆒開始認為可以寫成多機作業系統,以網路方式提

出,但終究在時間有限的狀態㆘,以單機作業系統落幕,此㆒遺憾。

Page 10: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

2

第㆓章第㆓章第㆓章第㆓章 內容探討內容探討內容探討內容探討

2.1想法與規範想法與規範想法與規範想法與規範

(1)既然打算要撰寫 C++的程式來完成書店查詢管理系統,故各項功能應該

均可符合書店本身所需之要求,因此而實㆞去拜訪位於高雄縣岡山鎮的育才文化廣

場,與其負青圖書項目之管理㆟員訪談,進而得知其書店所需之各項功能,並加以

斟酌後,設定本次已單機版為架構模擬書店查詢管理系統之專題大致內容。

(2)㆒般而言,會使用到本系統之使用者共分為㆔類,其㆒為㆒般來書店欲購

買各項書籍的消費者,其㆓為位於書店櫃台,負責幫消費者結帳之櫃台店員,其㆔

則為專門負責管理各項書籍進出,並加以建檔,刪除及與出版社之間的訂書等聯絡

事宜的書籍管理者。

(3)故本程大綱內容可分為對外-來買書的消費者,對內-櫃台結帳的店員及

負責書籍管理的管理者等兩大類,及如㆖(2)所說之㆔個方向加以設計。

(4)由(3)之兩大類我們可以了解,若以消費者而言,因其所接觸到的只是較

為單純之查詢等,不會去更動到任何資料,其安全性較高,所以我們便不需要對使

用此部份功能之使用者有任何的設限,故在設計㆖應任何㆟均可使用,但就對內而

言,因為不管是櫃台負責結帳的店員或是書籍項目的管理者,因其所接觸之部份功

能屬不可返性質,故相對要求使用此項功能者之身份,必須是被允許使用者,如書

店員工或管理者,所以對此部份功能之使用必需加以設限。

Page 11: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

3

2.2 查詢與管理查詢與管理查詢與管理查詢與管理

此專題不僅能使得顧客能夠快速查閱欲找尋之書籍相關內容,使其可不透過店

員亦能找尋到本身想要選購之書籍,並可直接從查詢功能㆗知道此本書籍之相關資

訊,不僅如此亦可使書店管理者能較具效率的管理各項書籍,並在其有所缺書時可

有相關的缺書資料能加以整理,使得整體管理的效率與準確性都能加以提高。

有了㆖述各項系統的功能,使得書店查詢管理系統的結構更加完善。查詢的方

法有㆔種,即書名、作者、出版社,可憑讀者或店家的喜好而選擇。在書局的管理

部份有買書、賣書的功能,以輸入 ISBN 碼為原則。還有另㆒項功能可使店家感到

特別窩心的,那就是報表列印功能,它可使店家省去不少時間在什麼時候要購買那

些書已經快要被賣完了,尤其是㆒些暢銷書。可省去買者買書卻買不到書而要訂購

的麻煩,這樣的話買者對店家就會有好感,比較有信心,如此㆒推㆓,㆓推㆕,㆕

推八 ………㆘去的話,店家的生意就會越來越興隆。店家有了此功能,那麼也比較

容易管理。

第㆔章第㆔章第㆔章第㆔章 設計與分析設計與分析設計與分析設計與分析

Page 12: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

4

3.1設計過程設計過程設計過程設計過程

(1)此次我們是使用 C++語言並運用 C++Builder4.0 在視覺化程式開發方面各

項強大的功能加以輔助,所以在視覺化能力範圍內,我們使用 C++Builder4.0

所提供之各項功能來減少程式之撰寫量,如元件位置、表單大小等,而細部方

面在使用 C++語言加以撰寫使功能更加建全。

(2)由於此專題書店查詢管理系統,為㆒應用資料庫之程式,所以在設計初期我們

便學習相關資料庫之內容便加以使用,在撰寫資料庫應用程式之前,我們先計

劃資料的存放位置及資料表的欄位以及索引等,以建立資料庫。在我們建立資

料庫之後,我們便用 Database Desktop來建立資料表。Database Desktop是㆒

支獨立的程式,我們可以在 C++Builder的整合開發環境之外來單獨執行他,

他可以讓我們以採用視覺化的方式來使用並管理資料庫。

(3)在設計完資料表後便開始進行主要程式設計,由之前的想法㆗我們將其分為㆓

大類,㆔個方面來討論,所以若以功能及迴圈而言,除了㆒開始當然是進入主

要畫面外,我們將其分為㆔大部份,即為其㆒顧客查詢系統,其㆓為櫃台結帳

系統,其㆔為管理系統,且在之前我們亦討論過,基於安全性考量,我們對顧

客查詢系統並不加以設限,但對於櫃台結帳系統及管理系統則是有加以設限,

以過濾使用此部份功能使用者之身份。

(4)就顧客查詢系統部份,我們設計可以直接由首頁進入此系統,且因為此項功能

有用到查詢資料庫之功能,故我們亦運用 C++Builder4.0的資料存取元件(非

視覺化元件)與資料控制元件(視覺化元件),來設計資料庫在此的使用者界

面。資料存取元件都是非視覺化元件,他們主要的功能便是連結資料庫以存取

Page 13: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

5

資料,資料控制元件都是屬於視覺化元件,他們的功能大都是把資料存取元件

取得的資料集以不同的方式呈現在使用者面前,並允許使用者修改,最後可將

修的資料再存回資料庫。而我們使用資料源元件來作資料存取元件和資料控制

元件之間的橋樑,各個資料控制元件是藉由連結資料源元件而顯示資料庫㆗的

資料,而資料存取元件則是靠資料源元件傳遞訊息給資料控制元件。如此再加

㆖我們加入按鍵及其它功能鍵,使得顧客查詢系統得以有查詢及瀏灠等功能。

(5)就櫃台結帳系統部份,因為我們已經在㆒開始便設定要限制非特定㆟員不得使

用本系統,所以從首頁要進入本系統則必需先通過㆒道認證手續,在此我們將

預設的密碼寫在程式碼㆗,且將焦點定在認證頁次㆖,若不先處理認證手續則

是不能往㆘㆒步進行,且若密碼輸入錯誤時,則會彈出輸入密碼錯誤的視窗,

而程式亦會回到首頁而無法進入櫃台結帳系統,若密碼輸入正碓的話,則可進

入櫃台結帳系統畫面。櫃台結帳系統就畫面而言,我們設計的與顧客查詢系統

相似,且對於資料庫運用技巧則與顧客查詢相同,因之前已有詳細提到,故在

此就不再以說明。但就功能而言,為了符合櫃台結帳方面的需要,除了相同於

顧客查詢系統的查詢及瀏灠功能,我們亦新增了買書及退書功能。買書功能即

在消費者將其欲購買之書籍拿至櫃台結帳時,店員便能將此書之庫存量透過我

們在此以鍵盤模擬讀碼機之動作,讀取 ISBN碼而將其庫存量減㆒,並將所購

買之書籍售價作加總後顯示出來,而退書功能原理則同於買書功能,只不過其

是將庫存量加㆒而非減㆒。

(6)就管理系統部份,因其亦同於櫃台結帳系統,我們有設定過濾條件,且其原理

亦同於其認證功能,故在此我們不再多加敘述,在進入管理系統後,由於我們

Page 14: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

6

設定此系統之主要功能在於與出版社之間書的管理,所以此系統亦可說是管理

與維護資料庫㆗之資料的正確與完整性。在此與資料庫之相關連結原理均同於

以㆖兩系統,故在此我們亦只討論與前兩系統之相異處。我們在此亦是以模擬

讀碼機之動作來輸入 ISBN碼以查詢是否有此書籍之資料,並設計依資料表的

相關欄位順序得以輸入新進書籍之資料且亦可對資料庫㆗之任何資料加以修

改,當然其本身也具備簡易瀏覽的功能,而為了避免因操作之錯誤,我們也在

此部份系統㆗設計相關的除錯設計。另外,為了方便管理者能明遼庫存量不足

之相關書籍內容,我們在此畫面㆗設計了㆒個列印功能鍵,而此鍵功能能將目

前資料庫㆗庫存量少於㆔本的書籍資料顯示在預覽列印畫面㆖,使管理者自行

決定是否依此資料訂購何種書籍。並能將其資料加以列印出,以方便加以管理。

(7)之前我們以介紹過本專題共分㆔個方面加以設計,但為了不讓使用者任意的關

閉本程式,故在首頁又設計㆒功能鍵使得欲結束本程式亦要通過㆒認證手序,

若輸入密碼正確才可結束此程式。以㆖便為我們設計程式的過程。

(8)在程式經過測試後,我們亦逐項的作小幅度修正,以期使除了除錯外亦能達到

較為㆟性化之使用者介面。而在程式經過各項改善之後,我們便要包裝開發

的應用程式,在此我們使用 INPRISE 公司提供的工具軟體 InstallShield

Express來加以包裝程式,使我們所設計的程式亦能輕鬆的移至其他台電腦㆗

安裝使用。

3.2 流程圖流程圖流程圖流程圖

底㆘圖 3.1是我們根據㆖節所敘而加以設計後,針對本次書店管理查詢系統

Page 15: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

7

的整體程式所作的分析流程圖。

Inquiry 書籍查詢畫面

Approve 1 認證

Approve 2 認證

Approve 3 認證

Balance 櫃台結帳畫面

Management 管理畫面

Payment 買書畫面

Withdrawal 退書畫面

Report 報表

圖 3.1分析流程圖

3.2流程圖說明流程圖說明流程圖說明流程圖說明

(1)就流程圖而言,首頁為最高層,為程式開啟後進入之位置。

(2)㆘㆒層共分為㆕部份:第㆒為顧客查詢書籍相關資訊功能,第㆓為櫃台模擬結

帳功能,第㆔為管理系統功能,第㆕為結束程式。

(3)顧客查詢書籍相關資訊功能可直接進入,進入後則可讓顧客使用各項查詢功能

以期望能獲得所需之書籍相關資訊。

Main 首頁

Page 16: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

8

(4)櫃台模擬結帳功能則自首頁㆘須先經過認證手續,而後近入櫃台結帳功能,又

因其有負責結帳之所需,故有買書功能與退書功能來使得資料庫的資料可以

維持其完整及正確性。

(5)管理系統功能則自首頁㆘亦要先經過認證步驟,進入管理系統功能後得以在此

將出版社所送來之書籍輸入資料庫,亦將欲退回書商之叢書資料從資料庫㆗刪

除,此外還有報表功能使管理者明遼缺書狀況。

(6)而首頁最後㆒項功能便是結束程式,亦直接經由認證後,若密碼輸入正確則執

行結束程式。

第㆕章第㆕章第㆕章第㆕章 程式模擬與整理程式模擬與整理程式模擬與整理程式模擬與整理

4.1 操作說明操作說明操作說明操作說明

Page 17: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

9

如圖 4.1程式主畫面所示,在㆒開始進入程式後即可看到此畫面,再從位於畫

面㆘方的功能鍵㆗選取所需之功能後按㆘,便可進入欲使用之功能系統。

圖 4.1程式主畫面

就功能方面而言,自首頁㆘共分為㆔大部份:第㆒為顧客查詢書籍相關資訊功

能:在進入顧客查詢書籍內容相關畫面後,首先顧客可從㆘拉功能表㆖選擇欲查詢

種類,共 有『書名』、『作者』、『出版社』㆔種可選,選擇後並在輸入名稱的格子㆗

輸入相關字,然後按確定鍵後,便會將使用者所查詢之書籍相關內容結果顯示在畫

面㆗。

Page 18: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

10

圖 4.2書籍查詢畫面

第㆓為櫃台的模擬系統,模擬櫃台結帳並因書籍之賣出而作㆒些存取的動作,

在經過輸入密碼的認證手續後,便可進入模擬櫃台結帳系統。就畫面而言,基本㆖

略同於之前的顧客查詢書面,但我們在種類㆖又增加㆒項「ISBN」碼的查詢,且由

於櫃台有負責書籍販售及結帳之功能,故又「買書」功能鍵,並透過模擬讀碼機,

讀取 ISBN 碼之功能,除了對庫存的數量做修改外,亦將售價做加總後顯示於視窗

㆗,不過在此我們是以鍵盤輸入代替讀碼機之動作,此外,又有「退書」之功能鍵

以免顧客在購買後,又拿回退書,有此功能,使得櫃台結帳系統之功能更加完備。

Page 19: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

11

圖 4.3櫃檯結帳系統認證畫面

圖 4.4櫃檯結帳系統畫面

Page 20: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

12

圖 4.5買書功能畫面

圖 4.6退書功能畫面

Page 21: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

13

第㆔為管理系統,主要負責進退書之管理,要進入本系統之前則必需先通過

管理系統認證手續,若密碼輸入正碓的話,則可進入管理系統畫面。在此我們亦是

使用鍵盤模擬讀碼機之動作,將先讀取 ISBN碼並查詢資料庫㆗是否有此本進書的

資料,並將其結果顯示出來,以方便管理㆟員做新資料之建檔或只需變更庫存量即

可,配合 ISBN 碼查詢,本畫面亦有簡易的瀏覽功能,並能新增、修改、或刪除書

籍之相關資訊,並設有若干防錯機置,防止使用者不當使用,另外本系統並有㆒列

印鍵能將庫存量低於㆔本以㆘之書籍簡易內容整理顯示出 ,以使管理者能明瞭庫存

㆗的缺書或提醒管理者向出版社訂購所需書籍。

圖 4.7管理系統認證畫面

Page 22: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

14

圖 4.8管理系統畫面

圖 4.9報表功能畫面

Page 23: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

15

就結束程式方面,亦點選結束本系統功能鍵後便會彈出認證視窗,其操作原理

與之前認證功能相同,若密碼輸入正確則執行結束程式。

圖 4.10結束程式認證畫面

4.2 模擬說明模擬說明模擬說明模擬說明

模擬結果可得以㆘幾點:

(1)首重資料庫㆗之書籍相關資料之正確性,如何避免因不當之操作而破壞資料之

正確性。

(2)迴圈之完整性,以免執行程式時產生當機或因迴圈設計之不完整而執行錯誤。

Page 24: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

16

(3)㆟性化之設計,設計後期則著重於如何改善程式使其達到較㆟性化,並以方便

初次使用者也能輕易㆖手為目標做小幅度之修正。

(4)正確包裝完整程式,使完成之程式得以輕易的移至其他部電腦使用,而達到其

完整性。

(5) 安裝於其他部電腦後之測試,將完整程式移至其他部電腦安裝後,測試其相關

之各項功能使用。

4.3 程式整理分析程式整理分析程式整理分析程式整理分析

有關的程式介紹,我們會在後面的附錄㆗提出。

Page 25: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

17

第五章第五章第五章第五章 成果敘述成果敘述成果敘述成果敘述

5.1 擴充敘述擴充敘述擴充敘述擴充敘述

因本專題乃是以㆒單機版來模擬書店查詢管理系統,故在擴充性㆖可有很大的

空間,如繼續研究,則可擴充為網路版本,但應該要注意若多部電腦在同時存取資

料庫時,其優先權的問題,以避免書籍相關資料出現錯誤,而破壞了資料的正確性。

5.2 成果敘述成果敘述成果敘述成果敘述

雖然為單機作業系統,但如作為小家規模經營的書店,我想單機版的應用程式

應該足以提供店家想要的功能,又如果想在更大家,幾層樓的大規模的書局,當然

我們單機版的程式是會不夠的,這時候則需要網路作業系統以連線的方式呈現。

現在在市面㆖已經有很多的書店管理系統包括了圖書館的作業系統,當初我們在選

擇要做圖書館的作業系統,或者是書店的管理系統而傷透了腦筋,最後才決定要作

書店查詢管理系統,因為圖書館的作業模式實在規模太大了,而且複雜程度很高,

相關作業㆟員也多,因此為了求我們還是初學者,因此選擇了書店查詢管理系統,

雖然是棄玉求瓦,但我們在期間,學習到不少對於此作業程式軟體的認識與應用,

我們感覺到這套的作業程式真的很適合初學者學習 Build C + +的㆒項實作。

Page 26: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

18

第六章第六章第六章第六章 結論結論結論結論

由本畢業專題我們設計了㆒個書店查詢管理系統,得以模擬㆒般書店所需之管

理或查詢功能,亦使得書店在擴充本專題後可以得到㆒個較高效率的管理經營方式。

前前後後為了這項程式花了數月的時間,在此間我們找了不少相關的資料以應

以後專題的需求,當然我們也請教教授不少問題,教授常傾囊相授及提供珍貴的意

見以作為日後專題未來發展的方針,在此再次感謝老師的用心良苦。

在期間,我們又以問網路作業模式居多,老師也提出很多的相關資訊,後來因

時間有限而作罷。每當想起常常感到惋惜,有辜老師的期望,在此表出歉意。

雖然是單機版的作業系統,但我們總認為小而精緻,以最短的程式來達到最大

的要求,可以說是最輕巧最實用的作業程式,若未來後者有興趣學習的話,可以以

此作為實作加以實習,說不定可以青出於藍更勝於藍,作出網路版的作業模式。

Page 27: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

19

參考文獻參考文獻參考文獻參考文獻

[1] Herbert Schildt著,高明林湘茗譯,C++自學手冊,美商麥格羅希爾國際股份有限

公司,1999年 10月

[2] Jesse Liberty 著,大新資訊譯,C++24 小時自學手冊,第㆔波資訊股份有限公限

司,1999年 7月

[3] 張皓傑著,Borland C++Builder 程式設計聖經 4.0,和碩科技文化有限公司,1999

年 9月

[4] 李勁鄭浩著,精通 C++Builder4.0,文魁資訊股份有限公司,1999年 10月

[5] 李勁著,精通 C++Builder4.0 與 SQL Server7.0,文魁資訊股份有限公司,1999 年

10月

Page 28: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

20

附錄附錄附錄附錄

Ubalance.h程式 #ifndef UBalanceH #define UBalanceH //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> #include <Db.hpp> #include <DBGrids.hpp> #include <DBTables.hpp> #include <Grids.hpp> #include <DBCtrls.hpp> #include <ExtCtrls.hpp> //------------------------------------------------------------------- class TBalance : public TForm { __published: // IDE-managed Components TBitBtn *BitBtn1; TBitBtn *BitBtn2; TBitBtn *BitBtn3; TDBGrid *DBGrid1; TComboBox *ComboBox1; TLabel *Label1; TLabel *Label2; TEdit *Edit1; TBitBtn *BitBtn4; TDBNavigator *DBNavigator1; TBitBtn *BitBtn5; void __fastcall BitBtn3Click(TObject *Sender); void __fastcall BitBtn1Click(TObject *Sender); void __fastcall BitBtn4Click(TObject *Sender); void __fastcall BitBtn2Click(TObject *Sender); void __fastcall BitBtn5Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TBalance(TComponent* Owner); }; extern PACKAGE TBalance *Balance; //------------------------------------------------------------------- #endif

Page 29: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

21

Upayment.h程式 #ifndef UPaymentH #define UPaymentH //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> //------------------------------------------------------------------- class TPayment : public TForm { __published: // IDE-managed Components TEdit *Edit1; TEdit *Edit2; TLabel *Label1; TLabel *Label2; TBitBtn *BitBtn1; TBitBtn *BitBtn2; void __fastcall BitBtn2Click(TObject *Sender); void __fastcall BitBtn1Click(TObject *Sender); void __fastcall FormShow(TObject *Sender); private: // User declarations public: // User declarations __fastcall TPayment(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TPayment *Payment; //------------------------------------------------------------------- #endif

Page 30: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

22

Uwithdrawal.h程式 #ifndef UWithdrawalH #define UWithdrawalH //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> //------------------------------------------------------------------- class TWithdrawal : public TForm { __published: // IDE-managed Components TEdit *Edit1; TLabel *Label1; TEdit *Edit2; TLabel *Label2; TBitBtn *BitBtn1; TBitBtn *BitBtn2; void __fastcall BitBtn2Click(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall BitBtn1Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TWithdrawal(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TWithdrawal *Withdrawal; //------------------------------------------------------------------- #endif

Page 31: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

23

UApprove2.h程式 #ifndef UApprove2H #define UApprove2H //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> //------------------------------------------------------------------- class TApprove2 : public TForm { __published: // IDE-managed Components TBitBtn *BitBtn1; TBitBtn *BitBtn2; TBitBtn *BitBtn3; TEdit *Edit1; TLabel *Label1; void __fastcall BitBtn1Click(TObject *Sender); void __fastcall BitBtn2Click(TObject *Sender); void __fastcall BitBtn3Click(TObject *Sender); void __fastcall FormShow(TObject *Sender); private: // User declarations public: // User declarations __fastcall TApprove2(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TApprove2 *Approve2; //------------------------------------------------------------------- #endif

Page 32: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

24

Umanagement.h程式 #ifndef UManagementH #define UManagementH //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> #include <Db.hpp> #include <DBCtrls.hpp> #include <DBTables.hpp> #include <Mask.hpp> #include <Dialogs.hpp> #include <ExtCtrls.hpp> //------------------------------------------------------------------- class TManagement : public TForm { __published: // IDE-managed Components TLabel *Label1; TLabel *Label2; TLabel *Label3; TLabel *Label4; TLabel *Label5; TLabel *Label6; TLabel *Label7; TLabel *Label8; TDataSource *DataSource1; TTable *Table1; TStringField *Table1ISBN; TStringField *Table1NAME; TStringField *Table1AUTHORS; TStringField *Table1PUBLISHER; TStringField *Table1SEAT; TFloatField *Table1AGREE; TFloatField *Table1SALE; TFloatField *Table1STOCK; TDBEdit *DBEdit1; TDBEdit *DBEdit2; TDBEdit *DBEdit3; TDBEdit *DBEdit4; TDBEdit *DBEdit5; TDBEdit *DBEdit6; TDBEdit *DBEdit7; TDBEdit *DBEdit8;

Page 33: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

25

TPrintDialog *PrintDialog1; TPanel *Panel1; TLabel *Label9; TEdit *Edit1; TBitBtn *BitBtn1; TPanel *Panel2; TBitBtn *BitBtn4; TBitBtn *BitBtn5; TBitBtn *BitBtn6; TBitBtn *BitBtn7; TBitBtn *BitBtn8; TBitBtn *BitBtn9; TBitBtn *BitBtn10; TBitBtn *BitBtn11; TBitBtn *BitBtn12; TBitBtn *BitBtn2; TBitBtn *BitBtn3; void __fastcall BitBtn3Click(TObject *Sender); void __fastcall BitBtn4Click(TObject *Sender); void __fastcall BitBtn5Click(TObject *Sender); void __fastcall BitBtn6Click(TObject *Sender); void __fastcall BitBtn7Click(TObject *Sender); void __fastcall BitBtn8Click(TObject *Sender); void __fastcall BitBtn9Click(TObject *Sender); void __fastcall BitBtn10Click(TObject *Sender); void __fastcall BitBtn11Click(TObject *Sender); void __fastcall BitBtn12Click(TObject *Sender); void __fastcall FormCreate(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall BitBtn1Click(TObject *Sender); void __fastcall BitBtn2Click(TObject *Sender); private: //參考文獻[1][2] void EnterModifyMode(); //自訂修改函數 void LeaveModifyMode(); //自訂瀏覽函數 public: // User declarations __fastcall TManagement(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TManagement *Management; //------------------------------------------------------------------- #endif

Page 34: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

26

Ureport.h程式 #ifndef UReportH #define UReportH //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <ExtCtrls.hpp> #include <Qrctrls.hpp> #include <QuickRpt.hpp> #include <QRExport.hpp> //------------------------------------------------------------------- class TReport : public TForm { __published: // IDE-managed Components TQuickRep *QuickRep1; TQRBand *QRBand1; TQRBand *QRBand2; TQRBand *QRBand3; TQRBand *QRBand4; TQRLabel *QRLabel1; TQRSysData *QRSysData1; TQRLabel *QRLabel2; TQRLabel *QRLabel3; TQRLabel *QRLabel4; TQRLabel *QRLabel5; TQRLabel *QRLabel6; TQRLabel *QRLabel7; TQRSysData *QRSysData2; TQRDBText *QRDBText1; TQRDBText *QRDBText2; TQRDBText *QRDBText3; TQRDBText *QRDBText4; TQRLabel *QRLabel8; TQRSysData *QRSysData3; TQRTextFilter *QRTextFilter1; private: // User declarations public: // User declarations __fastcall TReport(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TReport *Report; //------------------------------------------------------------------- #endif

Page 35: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

27

UApprove3.h程式 #ifndef UApprove3H #define UApprove3H //------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> //------------------------------------------------------------------- class TApprove3 : public TForm { __published: // IDE-managed Components TBitBtn *BitBtn1; TBitBtn *BitBtn2; TBitBtn *BitBtn3; TEdit *Edit1; TLabel *Label1; void __fastcall BitBtn2Click(TObject *Sender); void __fastcall BitBtn3Click(TObject *Sender); void __fastcall BitBtn1Click(TObject *Sender); void __fastcall FormShow(TObject *Sender); private: // User declarations public: // User declarations __fastcall TApprove3(TComponent* Owner); }; //------------------------------------------------------------------- extern PACKAGE TApprove3 *Approve3; //------------------------------------------------------------------- #endif

Page 36: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

28

UMain.cpp 程式 //參考文獻[3] #include <vcl.h> #pragma hdrstop #include "UMain.h" #include "UApprove1.h" #include "UApprove2.h" #include "UApprove3.h" #include "UBalance.h" #include "UInquiry.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TMain *Main; //------------------------------------------------------------------- __fastcall TMain::TMain(TComponent* Owner) : TForm(Owner) { WindowState=wsMaximized; } //------------------------------------------------------------------- void __fastcall TMain::BitBtn1Click(TObject *Sender) { Inquiry->Show(); Main->Hide(); } //------------------------------------------------------------------- void __fastcall TMain::BitBtn2Click(TObject *Sender) { Approve1->ShowModal(); } //------------------------------------------------------------------- void __fastcall TMain::BitBtn3Click(TObject *Sender) { Approve2->ShowModal(); } //------------------------------------------------------------------- void __fastcall TMain::BitBtn4Click(TObject *Sender) { Approve3->ShowModal(); }

Page 37: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

29

Uinquiry.cpp程式 #include <vcl.h> #pragma hdrstop #include "UInquiry.h" #include "UMain.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TInquiry *Inquiry; //參考文獻[4] __fastcall TInquiry::TInquiry(TComponent* Owner) : TForm(Owner) { WindowState=wsMaximized; ComboBox1->Items->Add("書名"); ComboBox1->Items->Add("作者"); ComboBox1->Items->Add("出版社"); } //參考文獻[5] void __fastcall TInquiry::BitBtn3Click(TObject *Sender) { Main->Show(); Inquiry->Hide(); Management->Table1->Filtered=false; } //------------------------------------------------------------------- void __fastcall TInquiry::BitBtn1Click(TObject *Sender) { AnsiString S; if(ComboBox1->Text=="書名") { S="Name='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else if(ComboBox1->Text=="作者") { S="Authors='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else if(ComboBox1->Text=="出版社")

Page 38: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

30

{ S="Publisher='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else { ShowMessage("請選擇欲查詢的種類"); } Edit1->Text=""; ComboBox1->Text=""; if (Management->Table1->RecordCount==0) { ShowMessage("很抱歉!您所查詢之書籍內容本書局並無相關資料" "若需要進㆒步服務請洽服務㆟員,謝謝!!! "); } } //------------------------------------------------------------------- void __fastcall TInquiry::BitBtn2Click(TObject *Sender) { Edit1->Text=""; ComboBox1->Text=""; Management->Table1->Filtered=false; }

Page 39: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

31

UApprove1.cpp程式 #include <vcl.h> #pragma hdrstop #include "UApprove1.h" #include "UBalance.h" #include "UMain.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TApprove1 *Approve1; //------------------------------------------------------------------- __fastcall TApprove1::TApprove1(TComponent* Owner) : TForm(Owner) { } //------------------------------------------------------------------- void __fastcall TApprove1::BitBtn1Click(TObject *Sender) { if(Edit1->Text=="QWE") { Balance->Show(); Approve1->Close(); Main->Hide(); } else { ShowMessage("輸入密碼錯誤!!!"); } Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TApprove1::BitBtn2Click(TObject *Sender) { Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TApprove1::BitBtn3Click(TObject *Sender) { Main->Show(); Edit1->Text=""; Approve1->Close(); } //-------------------------------------------------------------------

Page 40: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

32

void __fastcall TApprove1::FormShow(TObject *Sender) { Edit1->SetFocus(); } //-------------------------------------------------------------------

Page 41: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

33

Ubalance.cpp程式 #include <vcl.h> #pragma hdrstop #include "UBalance.h" #include "UApprove1.h" #include "UMain.h" #include "UPayment.h" #include "UWithdrawal.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TBalance *Balance; //------------------------------------------------------------------- __fastcall TBalance::TBalance(TComponent* Owner) : TForm(Owner) { WindowState=wsMaximized; ComboBox1->Items->Add("ISBN"); ComboBox1->Items->Add("書名"); ComboBox1->Items->Add("作者"); ComboBox1->Items->Add("出版社"); } //------------------------------------------------------------------- void __fastcall TBalance::BitBtn3Click(TObject *Sender) { Main->Show(); Balance->Hide(); Management->Table1->Filtered=false; } //------------------------------------------------------------------- void __fastcall TBalance::BitBtn1Click(TObject *Sender) { Management->Table1->Filtered=false; Edit1->Text=""; ComboBox1->Text=""; Payment->Show(); } //------------------------------------------------------------------- void __fastcall TBalance::BitBtn4Click(TObject *Sender) { AnsiString S;

Page 42: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

34

if(ComboBox1->Text=="ISBN") { S="ISBN='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else if(ComboBox1->Text=="書名") { S="Name='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else if(ComboBox1->Text=="作者") { S="Authors='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else if(ComboBox1->Text=="出版社") { S="Publisher='"+Edit1->Text+"*'"; Management->Table1->Filter=S; Management->Table1->Filtered=true; } else { ShowMessage("請選擇欲查詢的種類"); } Edit1->Text=""; ComboBox1->Text=""; if (Management->Table1->RecordCount==0) { ShowMessage("並無所查詢之書籍內容相關資料"); } } //------------------------------------------------------------------- void __fastcall TBalance::BitBtn2Click(TObject *Sender) { Management->Table1->Filtered=false; Edit1->Text=""; ComboBox1->Text=""; Withdrawal->Show(); } //-------------------------------------------------------------------

Page 43: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

35

void __fastcall TBalance::BitBtn5Click(TObject *Sender) { Edit1->Text=""; ComboBox1->Text=""; Management->Table1->Filtered=false; } //-------------------------------------------------------------------

Page 44: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

36

Upayment.cpp程式 #include <vcl.h> #pragma hdrstop #include "UPayment.h" #include "UBalance.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TPayment *Payment; //------------------------------------------------------------------- __fastcall TPayment::TPayment(TComponent* Owner) : TForm(Owner) { } //------------------------------------------------------------------- void __fastcall TPayment::BitBtn2Click(TObject *Sender) { Edit1->Text=""; Balance->Show(); Payment->Hide(); } //--------------------------------------------------------------------------- void __fastcall TPayment::BitBtn1Click(TObject *Sender) { //------------------------------------------------------------------- bool isSucceeded = false; TLocateOptions SearchOption; SearchOption << loCaseInsensitive; isSucceeded = Management->Table1->Locate("ISBN", Edit1->Text, SearchOption ); if(isSucceeded == false) { ShowMessage("無此書資料"); return; } // int stock, sale, money; stock = Management->Table1->FieldByName("STOCK")->AsInteger; if( (stock-1) <0 ) { ShowMessage("已無庫存");

Page 45: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

37

return; } // sale = Management->Table1->FieldByName("SALE")->AsInteger; money = StrToInt(Edit2->Text); money = money + sale; Edit2->Text = IntToStr(money); // stock--; Management->Table1->Edit(); Management->Table1->FieldByName("STOCK")->AsInteger = stock; Management->Table1->Post(); Edit1->Text = ""; } //------------------------------------------------------------------- void __fastcall TPayment::FormShow(TObject *Sender) { Edit2->Text="0"; Edit1->SetFocus(); } //-------------------------------------------------------------------

Page 46: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

38

Uwithdrawal.cpp程式 #include <vcl.h> #pragma hdrstop #include "UWithdrawal.h" #include "UBalance.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TWithdrawal *Withdrawal; //------------------------------------------------------------------- __fastcall TWithdrawal::TWithdrawal(TComponent* Owner) : TForm(Owner) { } //------------------------------------------------------------------- void __fastcall TWithdrawal::BitBtn2Click(TObject *Sender) { Edit1->Text=""; Balance->Show(); Withdrawal->Hide(); } //------------------------------------------------------------------- void __fastcall TWithdrawal::FormShow(TObject *Sender) { Edit2->Text="0"; Edit1->SetFocus(); } //------------------------------------------------------------------- void __fastcall TWithdrawal::BitBtn1Click(TObject *Sender) { //------------------------------------------------------------------- bool isSucceeded = false; TLocateOptions SearchOption; SearchOption << loCaseInsensitive; isSucceeded = Management->Table1->Locate("ISBN", Edit1->Text, SearchOption ); if(isSucceeded == false) { ShowMessage("無此書資料"); return; }

Page 47: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

39

int stock, sale, money; stock = Management->Table1->FieldByName("STOCK")->AsInteger; sale = Management->Table1->FieldByName("SALE")->AsInteger; money = StrToInt(Edit2->Text); money = money + sale; Edit2->Text = IntToStr(money); stock++; Management->Table1->Edit(); Management->Table1->FieldByName("STOCK")->AsInteger = stock; Management->Table1->Post(); Edit1->Text = ""; } //-------------------------------------------------------------------

Page 48: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

40

UApprove2.cpp程式 #include <vcl.h> #pragma hdrstop #include "UApprove2.h" #include "UMain.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TApprove2 *Approve2; //------------------------------------------------------------------- __fastcall TApprove2::TApprove2(TComponent* Owner) : TForm(Owner) { } //------------------------------------------------------------------- void __fastcall TApprove2::BitBtn1Click(TObject *Sender) { if(Edit1->Text=="QWE") { Management->Show(); Approve2->Close(); Main->Hide(); } else { ShowMessage("輸入密碼錯誤!!!"); } Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TApprove2::BitBtn2Click(TObject *Sender) { Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TApprove2::BitBtn3Click(TObject *Sender) { Main->Show(); Edit1->Text=""; Approve2->Close();

Page 49: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

41

} //------------------------------------------------------------------- void __fastcall TApprove2::FormShow(TObject *Sender) { Edit1->SetFocus(); } //-------------------------------------------------------------------

Page 50: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

42

Umanagement.cpp程式 #include <vcl.h> #pragma hdrstop #include "UManagement.h" #include "UApprove2.h" #include "UMain.h" #include "UReport.h" #include "UInquiry.h" #include "UBalance.h" #include "UPayment.h" #include "UWithdrawal.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TManagement *Management; //------------------------------------------------------------------- __fastcall TManagement::TManagement(TComponent* Owner) : TForm(Owner) { WindowState=wsMaximized; } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn3Click(TObject *Sender) { Main->Show(); Management->Hide(); } //------------------------------------------------------------------- void TManagement::EnterModifyMode() { BitBtn4->Enabled=False; BitBtn5->Enabled=False; BitBtn6->Enabled=False; BitBtn7->Enabled=False; BitBtn8->Enabled=False; BitBtn9->Enabled=False; BitBtn10->Enabled=False; BitBtn11->Enabled=True; BitBtn12->Enabled=True; } void TManagement::LeaveModifyMode() { BitBtn4->Enabled=True; BitBtn5->Enabled=True;

Page 51: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

43

BitBtn6->Enabled=True; BitBtn7->Enabled=True; BitBtn8->Enabled=True; BitBtn9->Enabled=True; BitBtn10->Enabled=True; BitBtn11->Enabled=False; BitBtn12->Enabled=False; } void __fastcall TManagement::BitBtn4Click(TObject *Sender) { Table1->First(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn5Click(TObject *Sender) { Table1->Prior(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn6Click(TObject *Sender) { Table1->Next(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn7Click(TObject *Sender) { Table1->Last(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn8Click(TObject *Sender) { DBEdit1->SetFocus(); BitBtn1->Default=false; Table1->Insert(); EnterModifyMode(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn9Click(TObject *Sender) { Table1->Edit(); EnterModifyMode(); }

Page 52: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

44

//------------------------------------------------------------------- void __fastcall TManagement::BitBtn10Click(TObject *Sender) { if (MessageBox(NULL,"確定將此書資料從資料庫㆗刪除","警告!", MB_OKCANCEL)==IDOK) { Table1->Delete(); } } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn11Click(TObject *Sender) { if(DBEdit1->Text=="") { ShowMessage("未輸入 ISBN"); } else if(DBEdit2->Text=="") { ShowMessage("未輸入書名"); } else if(DBEdit3->Text=="") { ShowMessage("未輸入作者"); } else if(DBEdit4->Text=="") { ShowMessage("未輸入出版社"); } else if(DBEdit5->Text=="") { ShowMessage("未輸入位置"); } else if(DBEdit6->Text=="") { ShowMessage("未輸入訂價"); } else if(DBEdit7->Text=="") { ShowMessage("未輸入售價"); } else if(DBEdit8->Text=="") { ShowMessage("未輸入庫存量"); }

Page 53: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

45

else { Table1->Post(); LeaveModifyMode(); } } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn12Click(TObject *Sender) { Table1->Cancel(); LeaveModifyMode(); } //------------------------------------------------------------------- void __fastcall TManagement::FormCreate(TObject *Sender) { Table1->Open(); } //------------------------------------------------------------------- void __fastcall TManagement::FormClose(TObject *Sender, TCloseAction &Action) { Table1->Close(); } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn1Click(TObject *Sender) { bool isSucceeded = false; TLocateOptions SearchOption; SearchOption << loCaseInsensitive; isSucceeded = Table1->Locate("ISBN", Edit1->Text, SearchOption ); if(isSucceeded == false) { ShowMessage("資料庫㆗無此書資料"); Edit1->Text=""; return; } DBEdit1->Text=Table1->FieldByName("ISBN")->AsString; DBEdit2->Text=Table1->FieldByName("NAME")->AsString; DBEdit3->Text=Table1->FieldByName("AUTHORS")->AsString; DBEdit4->Text=Table1->FieldByName("PUBLISHER")->AsString; DBEdit5->Text=Table1->FieldByName("SEAT")->AsString; DBEdit6->Text=Table1->FieldByName("AGREE")->AsInteger; DBEdit7->Text=Table1->FieldByName("SALE")->AsInteger; DBEdit8->Text=Table1->FieldByName("STOCK")->AsInteger;

Page 54: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

46

Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TManagement::BitBtn2Click(TObject *Sender) { Table1->Filter="STOCK<3"; Table1->Filtered=true; if (Management->Table1->RecordCount==0) { ShowMessage("資料庫㆗未有庫存低於㆔本之書籍"); } else { Report->QuickRep1->PreviewModal(); } Table1->Filtered=false; } //-------------------------------------------------------------------

Page 55: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

47

Ureport.cpp程式 #include <vcl.h> #pragma hdrstop #include "UReport.h" #include "UManagement.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TReport *Report; //------------------------------------------------------------------- __fastcall TReport::TReport(TComponent* Owner) : TForm(Owner) { } //-------------------------------------------------------------------

Page 56: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

48

UApprove3.cpp程式 #include <vcl.h> #pragma hdrstop #include "UApprove3.h" #include "UMain.h" //------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TApprove3 *Approve3; //------------------------------------------------------------------- __fastcall TApprove3::TApprove3(TComponent* Owner) : TForm(Owner) { } //------------------------------------------------------------------- void __fastcall TApprove3::BitBtn2Click(TObject *Sender) { Edit1->Text=""; } //------------------------------------------------------------------- void __fastcall TApprove3::BitBtn3Click(TObject *Sender) { Main->Show(); Edit1->Text=""; Approve3->Close(); } //------------------------------------------------------------------- void __fastcall TApprove3::BitBtn1Click(TObject *Sender) { if(Edit1->Text=="QWE") { Main->Close(); } else { ShowMessage("輸入密碼錯誤!!!"); } Edit1->Text=""; } //-------------------------------------------------------------------

Page 57: The system about inquiry and management in the bookshop · 2011. 6. 7. · The announcement of our graduate subject is “ The system about inquiry and management in the bookshop

49

void __fastcall TApprove3::FormShow(TObject *Sender) { Edit1->SetFocus(); } //-------------------------------------------------------------------