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

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

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

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

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

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

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

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

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

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

9、的這個系統(tǒng)中,主要有三大方面的功能,即庫存管理、商品銷售管理、系統(tǒng)設置管理。另外,利用我們利用文件來對數(shù)據進行管理,從而使系統(tǒng)更加完善,功能更加強大。關鍵詞: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)功能實現(xiàn)43.1 系統(tǒng)登錄模塊的實現(xiàn)43.2 錄入商品模塊的實現(xiàn) 53.3 修改和刪除商品的實現(xiàn) 73.4 查詢商品功能的實現(xiàn)113.5 銷售商品功能的實現(xiàn)133.6 查詢銷售情況功能的實現(xiàn)1

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

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

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

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

20、注意它的保密功能,所以我們必須為我們的系統(tǒng)設計一個用于保護本系統(tǒng)的密碼登錄功能。如圖 4.1 所示為我們超市管理管理系統(tǒng)的登錄界面。它所具有的功能是驗證用戶的登錄信息,即用戶名和對應的用戶密碼,檢驗預進入本系統(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 請輸入用戶名稱!, vbexclamation txtusername.setfocus else sql = select * from users where username = & txtusername.text & set rs = exesql(sql) if rs.eof = true then msgbox 沒有此用戶,請重新輸入用戶名!, 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 密碼不正確,請重新輸入密碼!, vbexclamation txtuserkey.setfocus txtuserkey.text = end if end if end if exit suberrhandler: msgbox 錯誤號: & err.number & 錯誤描述: & err.descriptionend sub3.2 錄入商品模塊的實現(xiàn)(1)超市管理系統(tǒng)的錄入商品功能模塊實現(xiàn)錄入商品的相關操

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

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

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

26、品的價格應為數(shù)字量!, vbexclamation txtproductinfo(2).setfocus exit sub else monprice = txtproductinfo(2).text end if if isnumeric(txtproductinfo(3).text) = false then msgbox 商品的數(shù)量應為數(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) 將進貨信息存入 productin 表 sql = insert productin values( & txtproductinfo(0).text & , & _ txtproductinfo(3).text & , & dtpind

28、ate.value & ) exesql (sql) msgbox 數(shù)據添加成功!, vbexclamation initcontrolend subprivate sub cmdclear_click() initcontrolend subprivate sub cmdexit_click() unload meend subprivate sub form_load() changeformpos frmmain, frmaddproduct cbounit.additem 個 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 修改和刪除商品的實現(xiàn)(1)當商品錄入后,根據需求可以修改、刪除商品,如圖 3.4 所示,為修改和刪除商品界面。修改和刪除商品功能模塊由編號、

30、名稱、單價、單位及備注組成,另外還有向前、向后、保存、刪除、清除及退出 6 個按鈕還有一個 ado data 控件。分為前后、保存、刪除和退出等功能。 7 圖 3.4 修改和刪除商品界面 (3)核心代碼:private sub cmdclear_click() initcontrolend subprivate sub cmddelete_click() if txtproductinfo(0).text = then msgbox 請選擇要刪除的商品編號!, 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 該項不能空!, vbexclamation txtproductinfo(i).setfocus exit sub end if next i if isnumeric(txtproductinfo(2).text) = false then msgbox 該項應為數(shù)字量!, vbexclamation txtproductinfo(2).setfocus exit sub end

34、if 向數(shù)據庫中寫數(shù)據 writedata 各控件設置初始值 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: 當數(shù)據庫中沒有記錄時,直接增加 if adodc1.recordset.recordcount = 0 then adodc1.recordset.addnew adodc1.recordset!productid = txtproductinfo(0) filldata 9 exit sub end if 查看當前記錄是否在

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

37、mber & 錯誤信息: & 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 = 個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 個 cbounit.additem 箱 cbounit.additem 瓶 cbounit.additem 盒 cbounit.additem 袋 changeformpos frmmain, meend sub 10private sub txtproductinfo_change(index as in

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

41、ctid名稱optcodeoptionbuttoncaption商品價格名稱optnameoptionbuttoncaption商品名稱名稱optpriceoptionbuttoncaption商品價格表 3.6 11(3)核心代碼private sub cmdexit_click() unload meend subprivate sub cmdqurey_click() dim strquery as string on error goto errhandler: 按商品編號查詢 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 按商品價格查詢 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 價格必須為數(shù)字量!, vbexclamation txtlowprice.setfocus exit sub end if if is

44、numeric(txthighprice.text) = false then msgbox 價格必須為數(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 錯誤號: & err.number & 錯誤信息: & 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 銷售商品功能的實現(xiàn)(1) 銷售商品的界面如圖 3.7,本功能界面共有 14 個標簽,其中一部分用來顯示商品的某些字段的標題,一部分則用來動態(tài)顯示用戶購買的商品信息(窗口上部顏色較深的一條)和操作員號、機器號。窗口上有一個 msflexgrid 控件用于顯示顧客購買商品列表;5 個文本框分別是用來輸入或顯示相關信息;4 個按鈕用于執(zhí)行商品錄入確認、取消、付款和退出該塊。圖 3.7 銷售商品

47、界面(2)控件主要屬性設置如表 3.8 13控件屬性屬性值lade1名稱lblproductinfolade1名稱lpluseridlade1名稱lplmachineidtextbox名稱txtproductidtextbox名稱txtproductqtytextbox名稱txtsumtextbox名稱txtcashtextbox名稱txtchange名稱cmdokcommandbuttoncaption確認(&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 請輸入商品編號!, vbexclamation t

50、xtproductid.setfocus else if trim(txtproductqty = ) then msgbox 請輸入商品數(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 沒有此編號商品,請重新輸入商品編號!, vbexclamation txtproductid.setfocu

51、s txtproductid.text = exit sub else 取出對應商品編號的商品名稱 strproductname = rs!productname 取出對應商品編號的商品價格 strproductprice = rs!unitprice rs.close end if end if 將當前購買的商品信息放大顯示 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 商品購賣數(shù)量加 1 intbuy = intbuy + 1 在表格中加入商品購買信息 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) 計算商品價格總和 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 設置窗體位置 changeformpos frmmain, frmsales intbuy = 0 with msgsale .formatstring = |序號|商品編碼|商品名稱|商品單價|數(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 查詢銷售情況功能的實現(xiàn)(1)查詢銷售情況窗口主要

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

溫馨提示

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

最新文檔

評論

0/150

提交評論