超市管理系統(tǒng)_第1頁
超市管理系統(tǒng)_第2頁
超市管理系統(tǒng)_第3頁
超市管理系統(tǒng)_第4頁
超市管理系統(tǒng)_第5頁
已閱讀5頁,還剩44頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 20102010 屆畢業(yè)論文(設(shè)計(jì))屆畢業(yè)論文(設(shè)計(jì)) 材材 料料 系 、 部: 數(shù)計(jì)系 學(xué)生姓名: 指導(dǎo)教師: 職稱 講師 專 業(yè): 計(jì)算機(jī)教育 班 級(jí): 一班 2010 年 5 月i2010 屆屆畢業(yè)論畢業(yè)論文(文(設(shè)計(jì)設(shè)計(jì)) )課題課題任任務(wù)書務(wù)書系: 數(shù)計(jì)系 專業(yè): 計(jì)算機(jī)教育 指導(dǎo)教師學(xué)生姓名課題名稱超市管理系統(tǒng)內(nèi)容及任務(wù)主要內(nèi)容:通過 visual basic 6.0 和 sql server2000 構(gòu)造出一個(gè)小型的超市管理系統(tǒng)。此系統(tǒng)能夠?qū)崿F(xiàn)以下功能:1. 庫(kù)存管理(包括錄入商品、修改和刪除商品、查詢商品)(1)錄入商品(2)修改和刪除商品(3)查詢商品2. 商品銷售(1)銷

2、售商品(2)查詢銷售情況3. 系統(tǒng)設(shè)置(1)用戶管理(2)修改密碼要求:1. 查閱相關(guān)的國(guó)內(nèi)外文獻(xiàn),按時(shí)提交開題報(bào)告;2. 論文內(nèi)容正確無誤,有一定的創(chuàng)新或個(gè)人見解;3. 開發(fā)的系統(tǒng)必須在計(jì)算機(jī)上測(cè)試通過,程序運(yùn)行良好;4. 論文必須按照學(xué)校規(guī)定的統(tǒng)一格式撰寫;5. 論文嚴(yán)禁抄襲,引用別人的成果必須在文中注明。ii擬達(dá)到的要求或技術(shù)指標(biāo)工資管理系統(tǒng)的主要任務(wù)是用計(jì)算機(jī)對(duì)各種工資信息進(jìn)行日常管理,如修改、增加、刪除及查詢等,針對(duì)系統(tǒng)服務(wù)對(duì)象的具體要求,迅速、準(zhǔn)確地完成各種信息的工作。 1可行性 要力求最大限度地滿足實(shí)際工作的需要,充分考慮各層次、各環(huán)節(jié)數(shù)據(jù)處理的實(shí)用性,滿足小型超市的管理。而且操

3、作簡(jiǎn)便實(shí)用。 2安全性 應(yīng)用軟件與數(shù)據(jù)庫(kù)系統(tǒng)的設(shè)計(jì)要做到安全可靠,防止非法用戶的入侵。數(shù)據(jù)庫(kù)的備份策略恰當(dāng),同時(shí)設(shè)置多種管理人員。以防他人盜取有用的信息。 3實(shí)用性用戶界面應(yīng)當(dāng)直觀、明了、條理清晰。實(shí)現(xiàn)了易學(xué)、易用、易管理。起止日期工作內(nèi)容備注進(jìn)度安排1 月 10 日2 月 12日2 月 14 日2 月 20日2 月 20 日4 月 18日4 月 18 日5 月 10日收集信息以及進(jìn)行系統(tǒng)整體規(guī)劃寫任務(wù)書以及開題報(bào)告開始進(jìn)行系統(tǒng)開發(fā),初步定稿對(duì)系統(tǒng)進(jìn)行進(jìn)一步修改完善,最后定稿iii主要參考資料1葉俊民,汪望珠.面向?qū)ο筌浖こ?第二版.清華大學(xué)出版社2戴志誠(chéng). sqlserver 2005 數(shù)

4、據(jù)庫(kù)系統(tǒng)開發(fā)與實(shí)例. 電子工業(yè)出版社3鄭阿奇.sql server 教程.清華大學(xué)出版社4胡勝利.動(dòng)態(tài)報(bào)表在 vb6.0 中的設(shè)計(jì)和實(shí)現(xiàn).江蘇技術(shù)師范學(xué)院學(xué)報(bào)5李占宣.數(shù)據(jù)庫(kù)中面向復(fù)雜應(yīng)用的查詢方法.電腦學(xué)習(xí)研室意見年 月 日系主管領(lǐng)導(dǎo)意見年 月 日iv株洲師專 200 屆畢業(yè)論文(設(shè)計(jì))指導(dǎo)教師評(píng)閱表系: 學(xué)生姓名學(xué) 號(hào)10107120班 級(jí)計(jì)教一班專 業(yè)計(jì)算機(jī)教育指導(dǎo)教師姓名課題名稱超市管理系統(tǒng)評(píng)語:(包括以下方面,學(xué)習(xí)態(tài)度工作量完成情況;檢索和利用文獻(xiàn)能力、外文翻譯和計(jì)算機(jī)應(yīng)用能力;學(xué)術(shù)水平或技術(shù)水平、綜合運(yùn)用知識(shí)能力和創(chuàng)新能力;限 300 字以上)是否同意參加答辯:是 否指導(dǎo)教師評(píng)定(

5、滿分:20 分)分值: 20指導(dǎo)教師簽字:年 月 日v株洲師專 200 屆畢業(yè)論文(設(shè)計(jì))評(píng)閱教師評(píng)閱表系: 學(xué)生姓名學(xué) 號(hào)10107120班 級(jí)計(jì)教一班專 業(yè)評(píng)閱教師姓名課 題評(píng)語:(對(duì)論文學(xué)術(shù)評(píng)語(包括選題意義;文獻(xiàn)利用能力;所用資料、實(shí)驗(yàn)數(shù)據(jù)和計(jì)算結(jié)果可靠性;創(chuàng)新成果及寫作規(guī)范化和邏輯性。注意對(duì)其中可能存在的剽竊、論據(jù)作假等把好關(guān),如果發(fā)現(xiàn)請(qǐng)?jiān)敿?xì)說明)針對(duì)課題內(nèi)容給設(shè)計(jì)者(作者)提出不少于 3 個(gè)問題,作為答辯時(shí)的必答題1.2.3.選題與文獻(xiàn)綜述(20 分)分值:創(chuàng)新性(15 分)分值:基礎(chǔ)理論和專門知識(shí)(35 分)分值:作者寫作、表達(dá)能力(30 分)分值:綜合評(píng)價(jià)(滿分:30 分)分值

6、: 30是否同意參加答辯是 否 評(píng)閱人(簽名): 年 月 日vi株洲師專 200 屆畢業(yè)論文(設(shè)計(jì))答辯及最終成績(jī)?cè)u(píng) 定 表系(公章): 學(xué)生姓名學(xué)號(hào)10107120班級(jí)計(jì)教一班答辯日期5 月課題名稱超市管理系統(tǒng)指導(dǎo)教師評(píng) 定成 績(jī) 評(píng) 定分值教師 1教師 2教師 3教師 4教師 5總 評(píng)課題介紹思路清晰,語言表達(dá)準(zhǔn)確,概念清楚,論點(diǎn)正確,實(shí)驗(yàn)方法科學(xué),分析歸納合理,結(jié)論嚴(yán)謹(jǐn),論文(設(shè)計(jì))有應(yīng)用價(jià)值。30必答題40答辯表現(xiàn)思維敏捷,回答問題有理論根據(jù),基本概念清楚,主要問題回答準(zhǔn)確大、深入,知識(shí)面寬。自由提問30答辯評(píng)定(滿分: 50分)分值: 50答辯小組長(zhǎng)簽名:指導(dǎo)教師評(píng)定分值:評(píng)閱教師評(píng)

7、定分值:最終評(píng)定成績(jī): 分?jǐn)?shù): 等級(jí):答辯委員會(huì)主任簽名: 年 月 日vii株株 洲洲 師師 范范 高高 等等 專專 科科 學(xué)學(xué) 校校2010 屆屆畢業(yè)設(shè)計(jì)說畢業(yè)設(shè)計(jì)說明明書書 題 目 系、部: 數(shù)計(jì)系 學(xué)生姓名: 指導(dǎo)教師: 職稱 講師專 業(yè): 計(jì)算機(jī)教育 班 級(jí): 計(jì)教一班 完成時(shí)間: 2010-5-4 viii摘 要伴隨著社會(huì)的復(fù)雜化,傳統(tǒng)的“一支筆,一本帳簿”的物品銷售管理方式也慢慢的無法適應(yīng)形勢(shì)的變化。隨著信息技術(shù)的發(fā)展,計(jì)算機(jī)已被廣泛的用于社會(huì)的各個(gè)領(lǐng)域,成為推動(dòng)社會(huì)發(fā)展的技術(shù)動(dòng)力。而在計(jì)算機(jī)應(yīng)用中,軟件的作用十分突出,軟件已經(jīng)發(fā)展成為信息技術(shù)的核心,主導(dǎo)著信息產(chǎn)品的開發(fā)和信息技術(shù)

8、市場(chǎng)的進(jìn)一步的開拓。軟件產(chǎn)業(yè)已成為社會(huì)信息化進(jìn)程中的一個(gè)戰(zhàn)略性產(chǎn)業(yè)。在軟件技術(shù)的應(yīng)用中軟件的開發(fā)技術(shù)尤其是應(yīng)用型軟件產(chǎn)品的開發(fā)技術(shù)成了重中之重。不斷開發(fā)適應(yīng)用戶需求、市場(chǎng)需要的新型軟件產(chǎn)品。隨著社會(huì)的發(fā)展,軟件也在不斷的更新?lián)Q代。隨著信息化的發(fā)展,為了讓管理更快捷、更準(zhǔn)確,實(shí)現(xiàn)商業(yè)活動(dòng)的信息化管理已經(jīng)成為各個(gè)領(lǐng)域的當(dāng)務(wù)之急。本次課設(shè)就是利用 visual basic 來開發(fā)的應(yīng)用系統(tǒng)的。我們的這個(gè)系統(tǒng)主要是針對(duì)小型超市管理行業(yè)的,主要是用來對(duì)商品銷售的商業(yè)活動(dòng)進(jìn)行管理的。應(yīng)用本系統(tǒng),我們可以使商品銷售管理簡(jiǎn)單而有效的運(yùn)行,這就是計(jì)算機(jī)的優(yōu)點(diǎn)。下來我來簡(jiǎn)單介紹一下我們所開發(fā)出來的這個(gè)系統(tǒng),在我們

9、的這個(gè)系統(tǒng)中,主要有三大方面的功能,即庫(kù)存管理、商品銷售管理、系統(tǒng)設(shè)置管理。另外,利用我們利用文件來對(duì)數(shù)據(jù)進(jìn)行管理,從而使系統(tǒng)更加完善,功能更加強(qiáng)大。關(guān)鍵詞:visual basic;文件;超市;系統(tǒng)ixsummarywith the social complexity, the traditional a pen, a book, sales management articles can also slow to adapt to changing situations. with the development of information technology, computers h

10、ave been widely used in various fields of society, as the technical driving force for promoting social development. in computer applications, a very prominent role in the software, the software has become the core of information technology, leading the development of information products and informa

11、tion technology market to develop further. software industry has become the information in the process of a strategic industry. software applications in the development of software technology, in particular the development of applied software technology has become the top priority. constantly develo

12、p to meet the customer needs, market needs, new software products. with the development of society, are constantly upgrading the software. with the development of information technology, in order to make management more efficient, more accurate information to achieve commercial activities in various

13、 areas of management has become an urgent task.the course design is to use visual basic to develop the application system. this system is mainly our supermarket management for small industry is primarily used for sales of goods to manage the commercial activities. application of this system, we can

14、make product sales management simple and effective operation, which is the computers advantages. i came down briefly what we have developed this system, this system in our three main areas of functionality, inventory management, sales management, and system settings management. in addition, the use

15、of the data we use to manage documents, making the system more complete, more features.key words: visual basic ;file; supermarket ;system x目 錄 摘摘 要要x第 1 章 緒 論 1第 2 章 系統(tǒng)功能介紹22.1 系統(tǒng)功能總框圖22.2 模塊功能介紹3第 3 章 系統(tǒng)功能實(shí)現(xiàn)43.1 系統(tǒng)登錄模塊的實(shí)現(xiàn)43.2 錄入商品模塊的實(shí)現(xiàn) 53.3 修改和刪除商品的實(shí)現(xiàn) 73.4 查詢商品功能的實(shí)現(xiàn)113.5 銷售商品功能的實(shí)現(xiàn)133.6 查詢銷售情況功能的實(shí)現(xiàn)1

16、73.7 用戶管理界面 20結(jié) 論23致 謝24參考文獻(xiàn)25 附 錄 26 1第 1 章 緒 論緊張而又繁忙的課程設(shè)計(jì)過去了,在這一個(gè)星期里,讓我嘗到了以前我沒有體驗(yàn)過的辛苦與勞累。經(jīng)過本次的課程設(shè)計(jì),使我克服了很多在程序設(shè)計(jì)上的弊端和難點(diǎn),也讓我體會(huì)到了沖出重圍的幸福與喜悅。編寫了幾百行的代碼最后寫出一個(gè)程序覺得很有成就感。對(duì) visual basic 的掌握提高到了一個(gè)新的水平,能夠利用 visual basic 編程平臺(tái)編寫出一個(gè)實(shí)用的程序,很大程度提高了程序綜合設(shè)計(jì)能力、分析能力和編程能力。世紀(jì)之初,以微電子、計(jì)算機(jī)、軟件和通信技術(shù)為主導(dǎo)的信息技術(shù)革命給我們生存的社會(huì)所帶來的變化令人目

17、不暇接。我選擇超市管理系統(tǒng),它可以應(yīng)用在小型的超市管理中,為商品銷售的各項(xiàng)管理及信息保存提供了一個(gè)良好的操作環(huán)境,為這些單位提供了很大的方便。隨著科學(xué)技術(shù)的不斷提高,計(jì)算機(jī)科學(xué)日漸成熟,其強(qiáng)大的功能已為人們深刻認(rèn)識(shí),它已進(jìn)入人類社會(huì)的各個(gè)領(lǐng)域并發(fā)揮著越來越重要的作用。作為計(jì)算機(jī)應(yīng)用的一部分,使用計(jì)算機(jī)對(duì)超市管理,具有著手工管理所無法比擬的優(yōu)點(diǎn).例如:檢索迅速、查找方便、可靠性高、存儲(chǔ)量大、保密性好、壽命長(zhǎng)、成本低等。這些優(yōu)點(diǎn)能夠極大地提高超市管理的效率,從而使企業(yè)取得更大的利潤(rùn)。課程設(shè)計(jì)結(jié)束了,但是它留給我的印象是不可磨滅的。無論我以后會(huì)不會(huì)涉及這方面的研究,我想,我至少掌握了一種系統(tǒng)的研究方

18、法,我們學(xué)習(xí)的目的就在于運(yùn)用,我們運(yùn)用這種研究方法的時(shí)候會(huì)很多,我最后要感謝課程設(shè)計(jì),它的確教會(huì)我很多。 1第 2 章 系統(tǒng)功能介紹2.1 系統(tǒng)功能總框圖在本次課程設(shè)計(jì)中,我所做的課設(shè)題目是超市銷售管理系統(tǒng),根據(jù)它的基本要求和經(jīng)過我們查閱相關(guān)資料。經(jīng)過自己的研究,最后我制定出了本系統(tǒng)的總體功能。因?yàn)槲宜龅南到y(tǒng)涉及到了銷售,所以我們?yōu)樗O(shè)計(jì)了三個(gè)主要的功能模塊,即庫(kù)存管理模塊、商品銷售模塊、和系統(tǒng)設(shè)置模塊。另外還有兩個(gè)文件管理模塊,即文件的保存和文件的打開。系統(tǒng)總體功能框圖如圖 2.1 所示。超市管理系統(tǒng)商品銷售系統(tǒng)設(shè)置庫(kù)存管理圖 2.1 藥品銷售管理總框圖錄入商品修改和刪除商品查詢商品銷售商

19、品查詢銷售情況用戶管理修改密碼 22.2 模塊功能介紹在系統(tǒng)功能總框圖中我們已經(jīng)介紹了我們這個(gè)系統(tǒng)的總體功能模塊,即庫(kù)存管理模塊、商品銷售模塊、和系統(tǒng)設(shè)置模塊。下面我來具體介紹一下它們。(1)庫(kù)存管理模塊:此模塊用來錄入商品、修改和刪除商品還有查詢商品。(2)商品銷售模塊:此模塊主要用來銷售商品和查詢銷售商品的情況。(3)系統(tǒng)管理模塊:此模塊主要用來管理系統(tǒng)用戶中的一些操作,可以管理用戶和修改用戶的密碼。 3第 3 章 系統(tǒng)功能實(shí)現(xiàn)3.1 系統(tǒng)登錄模塊的實(shí)現(xiàn)(1)在此模塊中,主要實(shí)現(xiàn)對(duì)用戶登錄系統(tǒng)的管理。我們知道,對(duì)于每個(gè)軟件應(yīng)用系統(tǒng)都有其特定的使用人員,尤其是用于商業(yè)活動(dòng)的軟件系統(tǒng),就更應(yīng)該

20、注意它的保密功能,所以我們必須為我們的系統(tǒng)設(shè)計(jì)一個(gè)用于保護(hù)本系統(tǒng)的密碼登錄功能。如圖 4.1 所示為我們超市管理管理系統(tǒng)的登錄界面。它所具有的功能是驗(yàn)證用戶的登錄信息,即用戶名和對(duì)應(yīng)的用戶密碼,檢驗(yàn)預(yù)進(jìn)入本系統(tǒng)的用戶是不是合法用戶。圖 3.1 登錄界面(2)核心代碼private sub cmdok_click() dim sql as string dim rs as adodb.recordset dim strusername as string dim intuserkey as integer on error goto errhandler: if trim(txtusername

21、.text = ) then msgbox 請(qǐng)輸入用戶名稱!, vbexclamation txtusername.setfocus else sql = select * from users where username = & txtusername.text & set rs = exesql(sql) if rs.eof = true then msgbox 沒有此用戶,請(qǐng)重新輸入用戶名!, vbexclamation txtusername.setfocus else if trim(rs!userpassword) = trim(txtuserkey.text) then 4 i

22、ntuserid = rs!userid intjobid = rs!jobid rs.close me.hide frmmain.show unload me else msgbox 密碼不正確,請(qǐng)重新輸入密碼!, vbexclamation txtuserkey.setfocus txtuserkey.text = end if end if end if exit suberrhandler: msgbox 錯(cuò)誤號(hào): & err.number & 錯(cuò)誤描述: & err.descriptionend sub3.2 錄入商品模塊的實(shí)現(xiàn)(1)超市管理系統(tǒng)的錄入商品功能模塊實(shí)現(xiàn)錄入商品的相關(guān)操

23、作,如圖 3.2 所示。為藥品采購(gòu)功能界面藥品采購(gòu)功能模塊由編號(hào)、名稱、單價(jià)、數(shù)量、單位、進(jìn)貨時(shí)間還有備注組成,另外還有添加、清除和退出三個(gè)按鈕。此對(duì)話框由 2 個(gè)文本框控制數(shù)組、1 個(gè)組合框、1 個(gè) dtpicker 控件用來顯示日期或接受日期輸入、3 個(gè)按鈕構(gòu)成,實(shí)現(xiàn)錄入商品功能,主要輸入編號(hào)、名稱、單價(jià)、數(shù)量、單位進(jìn)貨時(shí)間及備注后單擊添加即可完成,對(duì)庫(kù)存中進(jìn)行補(bǔ)充商品。圖 3.2 藥品采購(gòu)功能模塊(2)主要控件如表 3.3: 5控件屬性屬性值textbos(數(shù)組)名稱txtproductinfotextbos(數(shù)組)名稱txtsupplierinfocombobox名稱cbounit名稱

24、cbobirthdaydtpickerformat1-dtpshortdate名稱cmdaddcommandbuttoncaption添加(&a)名稱cmdclearcommandbuttoncaption添加(&c)名稱cmdexitcommandbuttoncaption添加(&e)表 3.3 錄入商品窗口控件屬性設(shè)置(3)核心代碼:private sub cmdadd_click() dim i as integer dim sql as string dim monprice as currency 判斷商品信息的某些項(xiàng)是否為空 for i = 0 to 3 if trim(txtpr

25、oductinfo(i) = then msgbox 此項(xiàng)不允許為空!, vbexclamation txtproductinfo(i).setfocus exit sub end if next i 判斷某些項(xiàng)的數(shù)據(jù)類型是否正確 if isnumeric(txtproductinfo(0).text) = false then msgbox 商品編號(hào)應(yīng)為數(shù)字量!, vbexclamation txtproductinfo(0).setfocus exit sub end if if isnumeric(txtproductinfo(2).text) = false then msgbox 商

26、品的價(jià)格應(yīng)為數(shù)字量!, vbexclamation txtproductinfo(2).setfocus exit sub else monprice = txtproductinfo(2).text end if if isnumeric(txtproductinfo(3).text) = false then msgbox 商品的數(shù)量應(yīng)為數(shù)字量!, vbexclamation txtproductinfo(3).setfocus exit sub end if 將商品信息存入 products 表 sql = insert products(productid,productname,un

27、itprice,unit,remark) & _ 6 values( & txtproductinfo(0).text & , & _ txtproductinfo(1).text & , & monprice & , sql = sql & cbounit.text & , & txtproductinfo(4).text & ) exesql (sql) 將進(jìn)貨信息存入 productin 表 sql = insert productin values( & txtproductinfo(0).text & , & _ txtproductinfo(3).text & , & dtpind

28、ate.value & ) exesql (sql) msgbox 數(shù)據(jù)添加成功!, vbexclamation initcontrolend subprivate sub cmdclear_click() initcontrolend subprivate sub cmdexit_click() unload meend subprivate sub form_load() changeformpos frmmain, frmaddproduct cbounit.additem 個(gè) cbounit.additem 箱 cbounit.additem 瓶 cbounit.additem 盒 c

29、bounit.additem 袋 dtpindate.value = nowend subprivate sub initcontrol() dim i as integer for i = 0 to 4 txtproductinfo(i).text = next i txtproductinfo(0).setfocusend subprivate sub txtproductinfo_change(index as integer)end sub3.3 修改和刪除商品的實(shí)現(xiàn)(1)當(dāng)商品錄入后,根據(jù)需求可以修改、刪除商品,如圖 3.4 所示,為修改和刪除商品界面。修改和刪除商品功能模塊由編號(hào)、

30、名稱、單價(jià)、單位及備注組成,另外還有向前、向后、保存、刪除、清除及退出 6 個(gè)按鈕還有一個(gè) ado data 控件。分為前后、保存、刪除和退出等功能。 7 圖 3.4 修改和刪除商品界面 (3)核心代碼:private sub cmdclear_click() initcontrolend subprivate sub cmddelete_click() if txtproductinfo(0).text = then msgbox 請(qǐng)選擇要?jiǎng)h除的商品編號(hào)!, vbexclamation txtproductinfo(0).setfocus exit sub end if exesql (de

31、lete products where productid = & txtproductinfo(0).text & ) adodc1.refresh initcontrolend subprivate sub cmdexit_click() unload meend subprivate sub cmdnext_click() if adodc1.recordset.eof = false then if adodc1.recordset.bof = true then adodc1.recordset.movefirst end if adodc1.recordset.movenext e

32、nd if if adodc1.recordset.eof = false then readdata end ifend subprivate sub cmdprevious_click() 8 if adodc1.recordset.bof = false then if adodc1.recordset.eof = true then adodc1.recordset.movelast end if adodc1.recordset.moveprevious end if if adodc1.recordset.bof = false then readdata end ifend su

33、bprivate sub cmdsave_click() dim i as integer for i = 0 to 2 if trim(txtproductinfo(i).text) = then msgbox 該項(xiàng)不能空!, vbexclamation txtproductinfo(i).setfocus exit sub end if next i if isnumeric(txtproductinfo(2).text) = false then msgbox 該項(xiàng)應(yīng)為數(shù)字量!, vbexclamation txtproductinfo(2).setfocus exit sub end

34、if 向數(shù)據(jù)庫(kù)中寫數(shù)據(jù) writedata 各控件設(shè)置初始值 initcontrolend subprivate sub readdata() txtproductinfo(0) = adodc1.recordset!productid txtproductinfo(1) = adodc1.recordset!productname txtproductinfo(2) = adodc1.recordset!unitprice if isnull(adodc1.recordset!remark) = true then txtproductinfo(3).text = else txtprodu

35、ctinfo(3) = adodc1.recordset!remark end if cbounit.text = adodc1.recordset!unitend subprivate sub writedata() on error goto errhandler: 當(dāng)數(shù)據(jù)庫(kù)中沒有記錄時(shí),直接增加 if adodc1.recordset.recordcount = 0 then adodc1.recordset.addnew adodc1.recordset!productid = txtproductinfo(0) filldata 9 exit sub end if 查看當(dāng)前記錄是否在

36、數(shù)據(jù)庫(kù)中存在 adodc1.recordset.movefirst adodc1.recordset.find productid = & txtproductinfo(0).text & if not adodc1.recordset.eof then 當(dāng)前記錄存在 filldata exit sub else 當(dāng)前記錄部存在 adodc1.recordset.addnew adodc1.recordset!productid = txtproductinfo(0) filldata exit sub end iferrhandler: 顯示錯(cuò)誤信息 msgbox 錯(cuò)誤號(hào): & err.nu

37、mber & 錯(cuò)誤信息: & err.description, vbexclamationend subprivate sub filldata() adodc1.recordset!productname = txtproductinfo(1) adodc1.recordset!unitprice = txtproductinfo(2) adodc1.recordset!unit = cbounit.text adodc1.recordset!remark = txtproductinfo(3) adodc1.recordset.update adodc1.refreshend subpri

38、vate sub initcontrol() dim i as integer for i = 0 to 3 txtproductinfo(i).text = txtproductinfo(0).setfocus next i cbounit.text = 個(gè)end subprivate sub form_load() changeformpos frmmain, frmproductquery adodc1.connectionstring = provider=sqloledb.1;integrated security=sspi;persist security info=false;i

39、nitial catalog=pos;data source=40f4d4dcb9dc46c adodc1.recordsource = select * from products adodc1.commandtype = 1 adodc1.refresh cbounit.additem 個(gè) cbounit.additem 箱 cbounit.additem 瓶 cbounit.additem 盒 cbounit.additem 袋 changeformpos frmmain, meend sub 10private sub txtproductinfo_change(index as in

40、teger)end sub3.4 查詢商品功能的實(shí)現(xiàn)(1)超市管理系統(tǒng)的查詢功能模塊,如圖 3.5 所示,為查詢商品功能界面。本功能界面由 1 個(gè) ado data 控件用來連接數(shù)據(jù)源;1 個(gè) datagrid 控件用來顯示查詢的數(shù)據(jù);3 個(gè)optionbutton 控件用來選擇查詢條件;1 個(gè)組合框用來選擇商品編號(hào),3 個(gè)文本框用來輸入商品名稱,商品價(jià)格。圖 3.5 查詢商品功能模塊界面(2)各控件的說明如表 3.6控件屬性屬性值textbos名稱txtproductnametextbos名稱txtlowpricetextbos名稱txthighpricecombobox名稱cboprodu

41、ctid名稱optcodeoptionbuttoncaption商品價(jià)格名稱optnameoptionbuttoncaption商品名稱名稱optpriceoptionbuttoncaption商品價(jià)格表 3.6 11(3)核心代碼private sub cmdexit_click() unload meend subprivate sub cmdqurey_click() dim strquery as string on error goto errhandler: 按商品編號(hào)查詢 if optcode.value = true then if trim(cboproductid.text

42、) = then strquery = select * from products else strquery = select * from products where productid = & cboproductid & end if end if 按商品名稱查詢 if optname.value = true then if trim(txtproductname.text) = then strquery = select * from products else strquery = select * from products where productname like

43、% & txtproductname.text & % end if end if 按商品價(jià)格查詢 if optprice.value = true then if trim(txtlowprice.text) = and trim(txthighprice.text) = then strquery = select * from products else if isnumeric(txtlowprice.text) = false then msgbox 價(jià)格必須為數(shù)字量!, vbexclamation txtlowprice.setfocus exit sub end if if is

44、numeric(txthighprice.text) = false then msgbox 價(jià)格必須為數(shù)字量!, vbexclamation txthighprice.setfocus exit sub end if strquery = select * from products where unitprice= & txtlowprice.text & _ and unitprice= & txthighprice.text end if end if adodc1.commandtype = 1 adodc1.recordsource = strquery adodc1.refres

45、h exit suberrhandler: msgbox 錯(cuò)誤號(hào): & err.number & 錯(cuò)誤信息: & err.description, vbexclamatioend sub 12private sub form_load() dim rs as new adodb.recordset dim sql as string sql = select productid from products set rs = exesql(sql) rs.movefirst while not rs.eof cboproductid.additem rs!productid rs.movenex

46、t wend optcode.value = true changeformpos frmmain, frmproductqueryend subprivate sub o_click()end sub3.5 銷售商品功能的實(shí)現(xiàn)(1) 銷售商品的界面如圖 3.7,本功能界面共有 14 個(gè)標(biāo)簽,其中一部分用來顯示商品的某些字段的標(biāo)題,一部分則用來動(dòng)態(tài)顯示用戶購(gòu)買的商品信息(窗口上部顏色較深的一條)和操作員號(hào)、機(jī)器號(hào)。窗口上有一個(gè) msflexgrid 控件用于顯示顧客購(gòu)買商品列表;5 個(gè)文本框分別是用來輸入或顯示相關(guān)信息;4 個(gè)按鈕用于執(zhí)行商品錄入確認(rèn)、取消、付款和退出該塊。圖 3.7 銷售商品

47、界面(2)控件主要屬性設(shè)置如表 3.8 13控件屬性屬性值lade1名稱lblproductinfolade1名稱lpluseridlade1名稱lplmachineidtextbox名稱txtproductidtextbox名稱txtproductqtytextbox名稱txtsumtextbox名稱txtcashtextbox名稱txtchange名稱cmdokcommandbuttoncaption確認(rèn)(&o)名稱cmdcancelcommandbuttoncaption取消(&c)名稱cmdpaymentcommandbuttoncaption付賬名稱cmdquitcommandbut

48、toncaption退出(&q)名稱msgsalecols6msflexgridrows2 表 3.8(3)主要代碼:dim intbuy as integerprivate sub cmdcancel_click() lblproductinfo.caption = txtproductid.text = txtproductqty = txtsum.text = txtcash.text = txtchange.text = msgsale.rows = 1 intbuy = 0 txtproductid.setfocusend subprivate sub cmdok_click() d

49、im sql as string dim rs as adodb.recordset dim lngidspace as long dim lngnamespace as long dim lngpricespace as long dim lngstringlen as long dim strproductname as string dim strproductprice as string dim intproductqty as integer 14 if trim(txtproductid.text = ) then msgbox 請(qǐng)輸入商品編號(hào)!, vbexclamation t

50、xtproductid.setfocus else if trim(txtproductqty = ) then msgbox 請(qǐng)輸入商品數(shù)量!, vbexclamation txtproductqty.setfocus exit sub end if sql = select * from products where productid = & txtproductid.text & set rs = exesql(sql) if rs.eof = true then msgbox 沒有此編號(hào)商品,請(qǐng)重新輸入商品編號(hào)!, vbexclamation txtproductid.setfocu

51、s txtproductid.text = exit sub else 取出對(duì)應(yīng)商品編號(hào)的商品名稱 strproductname = rs!productname 取出對(duì)應(yīng)商品編號(hào)的商品價(jià)格 strproductprice = rs!unitprice rs.close end if end if 將當(dāng)前購(gòu)買的商品信息放大顯示 lngidspace = 8 - len(txtproductid.text) lngnamespace = 15 - 2 * len(strproductname) lngpricespace = 9 - len(strproductprice) lblproduct

52、info.caption = txtproductid & space(2 * lngidspace) & strproductname & space(2 * lngnamespace) & strproductprice & space(2 * lngpricespace) & txtproductqty 商品購(gòu)賣數(shù)量加 1 intbuy = intbuy + 1 在表格中加入商品購(gòu)買信息 fillgrid strproductname, strproductpriceend subprivate sub cmdpayment_click() dim sql as string dim i

53、ntcount as integer dim intproductid as integer dim intproductqty as integer dim curproductprice as currency dim cursum as currency for intcount = 1 to intbuy curproductprice = msgsale.textmatrix(intcount, 4) intproductqty = msgsale.textmatrix(intcount, 5) 計(jì)算商品價(jià)格總和 cursum = cursum + curproductprice *

54、 intproductqty next intcount 15 for intcount = 1 to intbuy intproductid = msgsale.textmatrix(intcount, 2) intproductqty = msgsale.textmatrix(intcount, 5) if frmluserid = 0 then exit sub sql = insert sales values( & intproductid & , & frmluserid & , & intproductqty & ,getdate() exesql

55、 (sql) next intcount txtsum.text = cursum txtcash.setfocusend subprivate sub cmdquit_click() unload meend subprivate sub form_activate() dim sql as string dim rs as adodb.recordset sql = select * from machineuser where userid = & frmluserid & set rs = exesql(sql) lblmachineid.caption = rs!ma

56、chineid lbluserid.caption = frmluserid txtproductid.setfocusend subprivate sub form_load() dim i as integer 設(shè)置窗體位置 changeformpos frmmain, frmsales intbuy = 0 with msgsale .formatstring = |序號(hào)|商品編碼|商品名稱|商品單價(jià)|數(shù)量 .colwidth(0) = 0 .colwidth(1) = 1100 .colwidth(2) = 1400 .colwidth(3) = 1600 .colwi

57、dth(4) = 1600 .colwidth(5) = 1600 .rows = 1 end withend subprivate sub msgsale_click()end subprivate sub txtcash_change() dim curcash as currency 16 if txtcash.text = then exit sub curcash = txtcash.text txtchange.text = curcash - txtsumend subprivate sub fillgrid(byval strproductname as string, byv

58、al curunitprice as currency) with msgsale .rows = .rows + 1 .textmatrix(intbuy, 1) = intbuy .textmatrix(intbuy, 2) = txtproductid.text .textmatrix(intbuy, 3) = strproductname .textmatrix(intbuy, 4) = curunitprice .textmatrix(intbuy, 5) = txtproductqty.text end withend sub3.6 查詢銷售情況功能的實(shí)現(xiàn)(1)查詢銷售情況窗口主要

59、用于查詢員工的銷售業(yè)績(jī)。用戶可以查詢所有人員的銷售情況,也可查詢某一個(gè)員工的銷售情況,該查詢還可以支持按時(shí)間段進(jìn)行查詢。本功能界面如圖 3.9,有 2 個(gè)標(biāo)簽用于說明輸入的信息;1 個(gè)組合框用于用戶選擇查詢的員工姓名;1 個(gè) checkbox 控件用來選擇是否附加時(shí)間作為查詢條件;2 個(gè) dtpicker 控件用于輸入查詢的起始時(shí)間,一個(gè)【查詢】根據(jù)用戶輸入的查詢條件向數(shù)據(jù)庫(kù)發(fā)出查詢指令,一個(gè)用于退出應(yīng)用的【退出】按鈕;一個(gè) ado data 控件用于鏈接數(shù)據(jù)庫(kù),一個(gè) datagrid 控件用于顯示查詢的結(jié)果。圖 3.9 查詢銷售情況 17(2)控件主要屬性設(shè)置如表 3.10控件屬性屬性值co

60、mbobox名稱cbousernamecheckbox名稱chktimeotpicker名稱dtpstartdateotpicker名稱dtpenddate名稱cmdquerycommandbuttoncaption查詢(&q)名稱cmdexitcommandbuttoncaption退出(&e)表 3.10(3) 主要代碼:private sub cmdexit_click() unload meend subprivate sub cmdquery_click() dim strcmand as string on error goto errhandler 姓名為空查詢?nèi)繂T工的銷售情況

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論