餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用Visual C++6.0的應(yīng)用_第1頁(yè)
餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用Visual C++6.0的應(yīng)用_第2頁(yè)
餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用Visual C++6.0的應(yīng)用_第3頁(yè)
餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用Visual C++6.0的應(yīng)用_第4頁(yè)
餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用Visual C++6.0的應(yīng)用_第5頁(yè)
已閱讀5頁(yè),還剩23頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、餐 廳 管 理 系 統(tǒng) 的 開(kāi) 發(fā) 及 應(yīng) 用 visual c+6.0的應(yīng)用姓名:班級(jí):餐廳管理系統(tǒng)的開(kāi)發(fā)及應(yīng)用摘要:本文是以visual c+6.0為開(kāi)發(fā)工具進(jìn)行應(yīng)用程序開(kāi)發(fā)的一個(gè)實(shí)例。主要介紹了一個(gè)餐廳管理系統(tǒng)的設(shè)計(jì)和實(shí)現(xiàn)的過(guò)程。首先,簡(jiǎn)單對(duì)本餐廳管理系統(tǒng)作個(gè)總體的介紹;其次,通過(guò)數(shù)據(jù)庫(kù)的設(shè)計(jì)和數(shù)據(jù)表的設(shè)計(jì)來(lái)介紹在visual c+6.0中使用access 2000進(jìn)行數(shù)據(jù)表設(shè)計(jì)和系統(tǒng)功能細(xì)化的方法;最后,也是本文的重點(diǎn),具體實(shí)現(xiàn)系統(tǒng)主要功能模塊的設(shè)計(jì)及重要按鈕的代碼,來(lái)體現(xiàn)使用visual c+6.0的方法和技巧。關(guān)鍵字:visual c+6.0、餐廳管理系統(tǒng)、數(shù)據(jù)庫(kù)、原代碼devel

2、opment and application of restaurant management systemname: chen haoclass: class two of computer science and technologyabstract: this system is an instance of application program development by using visual c+6.0 . it mainly introduce us the designment and realization of a management system in a res

3、taurant. its main points are as following:first,it briefly gives us a general introduction of the system.then,according to the designment of the database and database table,it tells us how to use microsoft sql server 2000 to design database table and to subdivide system function.at last but not at l

4、east, concrete realization system main function module design and important button code ,to show the methods and skills of using visual c+6.0.key words: microsoft visualc+6.0, development and application of restaurant management system, database, source code0 前 言隨著我國(guó)國(guó)民經(jīng)濟(jì)迅猛發(fā)展,餐飲業(yè)也得到了空前的發(fā)展。餐館除了給人們一個(gè)就餐

5、和娛樂(lè)的空間更要有豪華的硬件設(shè)施和優(yōu)質(zhì)的軟件服務(wù),尤其是在追求辦公智能化的今天。1 系統(tǒng)介紹1.1系統(tǒng)功能分析本客房管理系統(tǒng)主要實(shí)現(xiàn)以下的功能:1、前臺(tái)銷(xiāo)售管理:通過(guò)該管理功能,工作人員可以通過(guò)計(jì)算機(jī)進(jìn)行點(diǎn)菜、撤單、結(jié)賬、查詢、打印等服務(wù)。2、統(tǒng)計(jì)報(bào)表管理:通過(guò)該管理功能,管理員可以對(duì)餐廳某一時(shí)間段內(nèi)銷(xiāo)售清單或者某一單品進(jìn)行統(tǒng)計(jì)、打印,及時(shí)了解公司營(yíng)業(yè)狀況。3、基礎(chǔ)資料管理:通過(guò)該管理功能,管理員可以隨時(shí)增加、修改、刪除商品類別以及商品資料,通過(guò)市場(chǎng)動(dòng)向,及時(shí)對(duì)菜單及菜價(jià)進(jìn)行有效的管理。4、系統(tǒng)維護(hù)管理:通過(guò)該管理功能,系統(tǒng)管理員可以對(duì)系統(tǒng)進(jìn)行維護(hù),包括工作人員資料的增加、修改、刪除、權(quán)限設(shè)置

6、等以及公司銷(xiāo)售數(shù)據(jù)的清除。1.2 系統(tǒng)開(kāi)發(fā)的目的和意義 在現(xiàn)代的餐飲服務(wù)行業(yè)中,由于食客流量的加劇增長(zhǎng),傳統(tǒng)的手動(dòng)方法已經(jīng)不能適應(yīng)現(xiàn)代社會(huì)的需要,各大中小型餐館需要使用計(jì)算機(jī)進(jìn)行現(xiàn)代化管理,針對(duì)這種情況,有必要開(kāi)發(fā)一個(gè)“餐廳管理系統(tǒng)”來(lái)進(jìn)行管理工作,因此,這樣一個(gè)小型餐廳管理系統(tǒng)便應(yīng)運(yùn)而生了。由于時(shí)間倉(cāng)促和水平有限,不當(dāng)之處在所難免,留待以后進(jìn)一步整理和完善。3 系統(tǒng)功能模塊實(shí)現(xiàn)經(jīng)過(guò)以上的設(shè)計(jì)分析,已經(jīng)基本上完成了對(duì)本系統(tǒng)整體功能結(jié)構(gòu)以及數(shù)據(jù)庫(kù)等方面的設(shè)計(jì)工作,下面將使用已選定的前臺(tái)開(kāi)發(fā)工具powerbuilder 9.0來(lái)具體實(shí)現(xiàn)各個(gè)功能模塊。3.1 系統(tǒng)登錄窗口實(shí)現(xiàn)系統(tǒng)登錄窗口是保證系統(tǒng)的

7、使用安全,不能任由其他人進(jìn)入。其用戶名和口令正確才能進(jìn)入該系統(tǒng)。如圖3-2所示。圖 3-2 系統(tǒng)登錄窗口為使系統(tǒng)在用戶登錄時(shí)記錄其用戶名,可以根據(jù)用戶名自動(dòng)判斷用戶的操作權(quán)限,可以使用哪些系統(tǒng)功能,應(yīng)創(chuàng)建一個(gè)結(jié)構(gòu)變量user。為使整個(gè)應(yīng)用程序在使用提示對(duì)話框時(shí)方便,需要?jiǎng)?chuàng)建一個(gè)自定義提示框函數(shù)。其代碼為:afxmessagebox(請(qǐng)輸入用戶名和密碼!);return; “確定”按鈕的clicked事件代碼為:else/if user enter name and password./成生sql語(yǔ)句cstring sql=select * from users where loginid=+m

8、_logid+ and psd=+m_pwd+;try/查詢數(shù)據(jù)庫(kù),看是否有此用戶和密碼m_precordset.createinstance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),adopenstatic,adlockoptimistic,adcmdtext);/如果沒(méi)有此用戶和密碼,再查詢是否有此用戶if(m_precordset-adoeof)afxmessagebox(用戶名或密碼錯(cuò)誤!);elsethea=(lp

9、ctstr)(_bstr_t)m_precordset-getcollect(name);theapp.pwd=m_pwd;cdialog:onok();return;m_precordset-close();catch(_com_error e)/捕捉異常cstring temp;temp.format(讀取用戶名和密碼錯(cuò)誤:%s,e.errormessage();afxmessagebox(temp);return;3.2 主窗口實(shí)現(xiàn)主窗口是應(yīng)用系統(tǒng)的平臺(tái),其中包括該系統(tǒng)的所有功能。如圖3-3所示。進(jìn)入系統(tǒng)后,在listbox控制控件中會(huì)自動(dòng)顯示所有未結(jié)賬單據(jù)以及其所對(duì)應(yīng)的信息(默認(rèn)為第一

10、條單據(jù))。圖 3-3 主窗口主窗口listbox事件代碼為:cstring stemp,sql,sbillid;int ioption; _recordsetptr m_precordset;ioption = m_olistbill.getcursel();m_olistbill.gettext(ioption, sbillid);/得到選中項(xiàng)的文本theapp.scallid=sbillid;/get current bill id./clear the edit ctrl.m_otableno.setwindowtext();m_opeasons.setwindowtext();sql=

11、select * from salebill where id=+sbillid+;trym_precordset.createinstance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),adopenstatic,adlockoptimistic,adcmdtext);if(!m_precordset-adoeof)m_otableno.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcolle

12、ct(tableno);m_opeasons.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcollect(peoples);m_ocheck.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcollect(sales);m_ostatus.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcollect(status);m_obegintime.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcollect(b

13、egindate);m_oendtime.setwindowtext(lpctstr)(_bstr_t)m_precordset-getcollect(enddate);float ftotal=(float)m_precordset-getcollect(total);cstring stotal;stotal.format(%.2f,ftotal);m_ototal.setwindowtext(stotal);ftotal=(float)m_precordset-getcollect(acttotal);stotal.format(%.2f,ftotal);m_oacttotal.setw

14、indowtext(stotal);m_precordset-close();catch(_com_error e)/捕捉異常cstring temp;temp.format(讀取單據(jù)頭到編輯框出錯(cuò):%s,e.errormessage();afxmessagebox(temp);return;readtoformlist(sbillid);/get bill items from database.3.2.1 點(diǎn)菜窗口實(shí)現(xiàn)點(diǎn)菜窗口會(huì)顯示所有商品類別的列表,以及每一個(gè)類別所對(duì)應(yīng)的商品名稱和價(jià)格,顧客可隨意進(jìn)行選擇。如圖3-4所示。圖 3-4 點(diǎn)菜窗口主窗口的“點(diǎn)菜”按鈕的clicked事件代碼:

15、/得到系統(tǒng)時(shí)間ctime now=ctime:getcurrenttime();snowtime=now.format(_t(%y-%m-%d %h:%m:%s);sbillno=gennewbillid();sql=insert into salebill (id,begindate,status,total,acttotal,paymode,floor) values (+sbillno+,+snowtime+,等待,0,0,1,+sfloor+);try _variant_t recordsaffected;theapp.m_pconnection-execute(_bstr_t)sql

16、,&recordsaffected,adcmdtext);catch(_com_error e)/捕捉異常cstring temp;temp.format(開(kāi)單生成單據(jù)出錯(cuò):%s,e.errormessage();afxmessagebox(temp);return;m_ostatus.setwindowtext(等待);m_obegintime.setwindowtext(snowtime);m_ototal.setwindowtext(0.00);m_oacttotal.setwindowtext(0.00);m_olistbill.addstring(sbillno);m_olistbi

17、ll.selectstring(-1,sbillno);theapp.scallid=sbillno;/get current bill id.m_oformlist.deleteallitems();rect rect;m_oformlist.getwindowrect(&rect);m_obutton.movewindow(440,95, rect.right/40, rect.bottom/35);m_obutton.bringwindowtotop();m_obutton.showwindow(sw_show);/從隱藏變?yōu)轱@示如果希望選擇某商品,可直接點(diǎn)擊列表框中的商品,然后單擊“選

18、擇”按鈕,“選擇”按鈕的clicked事件代碼為:if(theapp.smname=)afxmessagebox(請(qǐng)選擇商品!);return;elselresult res=:sendmessage(theapp.pwnd, wm_apply, 0, 0);cdialog:onok();3.2.2 結(jié)賬窗口實(shí)現(xiàn)選擇主窗口上顯示的未結(jié)賬單據(jù),單擊窗口上面的“結(jié)賬”按鈕,結(jié)賬窗口就被打開(kāi),在窗口上會(huì)自動(dòng)顯示該單據(jù)所對(duì)應(yīng)的商品信息以及消費(fèi)金額信息,管理員可手工輸入折扣率以及付款金額,系統(tǒng)會(huì)自動(dòng)找零。如圖3-5所示。圖 3-5 結(jié)賬窗口點(diǎn)擊“結(jié)賬”按鈕clicked事件代碼為:/得到系統(tǒng)時(shí)間ctim

19、e now=ctime:getcurrenttime();snowtime=now.format(_t(%y-%m-%d %h:%m:%s);sql=update salebill set enddate=+snowtime+,sales=+thea+,total=+stotal+,acttotal=+sbilltotal+,status=已結(jié)帳,paymode=+spayid+ where id=+theapp.scallid+;try _variant_t recordsaffected;theapp.m_pconnection-execute(_bstr_t)sql,&re

20、cordsaffected,adcmdtext);catch(_com_error e)/捕捉異常cstring temp;temp.format(結(jié)帳單據(jù)頭更新數(shù)據(jù)庫(kù)出錯(cuò):%s,e.errormessage();afxmessagebox(temp);return;/output the checkout time and paymode to the print.theapp.snowtimep=snowtime;theapp.spaymodep=spaymode;theapp.sconsume=stotal;theapp.sactsum=sbilltotal;/insert data i

21、nto paydetail.cstring sclass,scontotal,sdiscount,sacttotal,svaltotal;int nitemcount=m_ochecklist.getitemcount();/表項(xiàng)總數(shù)for(int i=0;iexecute(_bstr_t)sql,&recordsaffected,adcmdtext);catch(_com_error e)/捕捉異常cstring temp;temp.format(結(jié)帳付款明細(xì)(paydetail)插入數(shù)據(jù)出錯(cuò):%s,e.errormessage();afxmessagebox(temp);return;只有

22、掛賬權(quán)限的人才可進(jìn)行掛賬?!皰熨~”按鈕的clicked事件代碼為:if(!theapp.verifypower(hang)afxmessagebox(沒(méi)有權(quán)限掛帳!);return;cstring sql;sql=update salebill set status=掛帳 where id=+theapp.scallid+;try _variant_t recordsaffected;theapp.m_pconnection-execute(_bstr_t)sql,&recordsaffected,adcmdtext);catch(_com_error e)/捕捉異常cstring temp;

23、temp.format(結(jié)帳掛帳更新數(shù)據(jù)庫(kù)出錯(cuò):%s,e.errormessage();afxmessagebox(temp);return;enddialog(1);/close the dialog.3.3 統(tǒng)計(jì)報(bào)表窗口實(shí)現(xiàn)管理員可以對(duì)一段時(shí)間內(nèi)的餐廳銷(xiāo)售情況進(jìn)行統(tǒng)計(jì)包括總銷(xiāo)售情況以及所有單品的銷(xiāo)售情況以便經(jīng)營(yíng)者隨時(shí)調(diào)整餐廳市場(chǎng)方向,數(shù)據(jù)以xcl格式顯示。如圖3-6所示。圖 3-6 統(tǒng)計(jì)報(bào)表窗口單擊“統(tǒng)計(jì)”按鈕,系統(tǒng)會(huì)自動(dòng)將數(shù)據(jù)顯示在左側(cè)控件中,“統(tǒng)計(jì)”按鈕的clicked事件代碼為:switch(nselect)/get if it is discount.case idc_radio_

24、week:n=0;m_olisttitle.setwindowtext(* 銷(xiāo)售匯總報(bào)表 *);break;case idc_radio_single:n=1;m_olisttitle.setwindowtext(* 單品報(bào)表 *);break;default:break;int ncount=m_olistreport.getcount()-1;for(int i=ncount;i=0;i-)/clear report listbox.m_olistreport.deletestring(i);sql=select * from company;try m_precordset.create

25、instance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),adopenstatic,adlockoptimistic,adcmdtext);if(!m_precordset-adoeof) sfloor=(lpctstr)(_bstr_t)m_precordset-getcollect(floornumber); scompany=(lpctstr)(_bstr_t)m_precordset-getcollect(companyname)

26、;m_precordset-close();catch(_com_error e)/捕捉異常cstring sdate;sdate.format(讀取樓層號(hào)出錯(cuò):%s,e.errormessage();afxmessagebox(sdate);m_olistreport.addstring( );int ns=32-scompany.getlength()-sfloor.getlength();cstring space= ;for(int j=0;j=+sbegin+ and enddateexecute(_bstr_t)sql,&recordsaffected,adcmdtext);cat

27、ch(_com_error e)/捕捉異常cstring errormessage;errormessage.format(增加同級(jí)分類出錯(cuò):%s,e.errormessage();afxmessagebox(errormessage);m_oclassname.setwindowtext(newclassname);m_otreeclass.insertitem(lpctstr)(_bstr_t)(newclassname), hparentitem, null);/insert an item into current parent.點(diǎn)擊“刪除”按鈕,系統(tǒng)會(huì)刪除此類別?!皠h除”按鈕的cli

28、cked事件代碼為:if(afxmessagebox(確定刪除此類別嗎?,mb_yesno)=idyes)trym_precordset.createinstance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),adopendynamic,adlockpessimistic,adcmdtext);if(!m_precordset-bof)/if current record is not the first record.curid=vari

29、anttocstring(m_precordset-getcollect(id);if(atol(curid)=1)messagebox(不能刪除id為1的類別!,m_classname);return;if (treesumrecordcount(curid)=0)if(countmateriel(curid)0)messagebox(此類別下已有商品,不能刪除!);elsem_precordset-delete(adaffectcurrent);/刪除當(dāng)前記錄m_otreeclass.deleteitem(hcuritem);if (treesumrecordcount(curid)0)m

30、essagebox(不能刪除結(jié)點(diǎn)類別!,m_classname);m_precordset-update();m_precordset-close();catch(_com_error e)/捕捉異常cstring errormessage;messagebox(刪除類別出錯(cuò)!,m_classname);3.8 商品資料窗口實(shí)現(xiàn)管理員可對(duì)每一種商品類別下的資料進(jìn)行修改包括名稱、價(jià)格等。如圖3-8所示。圖 3-8 商品資料窗口單擊“新增”按鈕,為該類別增加新的商品信息,“新增”按鈕的clicked事件代碼為:m_omname.setwindowtext();m_omprice.setwindow

31、text();m_omshopcode.setwindowtext();m_ombarcode.setwindowtext();lnewid=gennewid();單擊“刪除”按鈕,刪除該類別的商品信息,“刪除”按鈕的clicked事件代碼為:sql=select * from materiel where name=+stemp+;try m_precordset.createinstance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),a

32、dopenstatic,adlockoptimistic,adcmdtext); lclassid=(long)(m_precordset-getcollect(classid);if(afxmessagebox(確定刪除此商品嗎?,mb_yesno)=idyes)m_precordset-delete(adaffectcurrent);/刪除當(dāng)前記錄elsereturn;m_precordset-update(); catch(_com_error e)/捕捉異常cstring temp;temp.format(刪除商品出錯(cuò):%s,e.errormessage();afxmessagebox

33、(temp);return;3.9 系統(tǒng)維護(hù)窗口實(shí)現(xiàn)管理員可以修改用戶資料,并清除數(shù)據(jù)庫(kù)中的冗余數(shù)據(jù)。如圖3-9所示。圖 3-9 系統(tǒng)維護(hù)窗口進(jìn)入該窗口后,系統(tǒng)會(huì)將用戶信息顯示在界面中,管理員可對(duì)信息進(jìn)行修改并設(shè)置權(quán)限。用戶信息進(jìn)行修改后,單擊“保存”按鈕,可將用戶信息保存到數(shù)據(jù)庫(kù)中,“保存”按鈕的clicked事件代碼為:/檢查數(shù)據(jù)完整性if(m_username.isempty()|m_logname.isempty()|m_upwd.isempty()afxmessagebox(請(qǐng)輸入姓名、登錄名稱和密碼!);return;if(lnewidatol(suserid)snewid.format(%d,lnewid);if(brepeat(name)=true)afxmessagebox(用戶名重復(fù),請(qǐng)重新輸入!);return;try m_precordset.createinstance(adodb.recordset);m_precordset-open(_variant_t)sql,_variant_t(idispatch*)theapp.m_pconnection,true),adopenstatic,adlockoptimistic,adcmdtext); m_precordset-addnew();/insert the c

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 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)論