2022年2022年酒店管理系统代码 .pdf

上传人:Che****ry 文档编号:27190368 上传时间:2022-07-23 格式:PDF 页数:31 大小:157.39KB
返回 下载 相关 举报
2022年2022年酒店管理系统代码 .pdf_第1页
第1页 / 共31页
2022年2022年酒店管理系统代码 .pdf_第2页
第2页 / 共31页
点击查看更多>>
资源描述

《2022年2022年酒店管理系统代码 .pdf》由会员分享,可在线阅读,更多相关《2022年2022年酒店管理系统代码 .pdf(31页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、附录Base.Dlg.cpp 程序 : #include stdafx.h #include MyPos.h #include BaseDlg.h #include MaterielDlg.h #include ClassDlg.h #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE = _FILE_; #endif / / CBaseDlg dialog CBaseDlg:CBaseDlg(CWnd* pParent /*=NULL*/) : CDialog(CBaseDlg:IDD, pPar

2、ent) /AFX_DATA_INIT(CBaseDlg) / NOTE: the ClassWizard will add member initialization here /AFX_DATA_INIT void CBaseDlg:DoDataExchange(CDataExchange* pDX) CDialog:DoDataExchange(pDX); /AFX_DATA_MAP(CBaseDlg) DDX_Control(pDX, IDC_TAB_BASE, m_oTabBase); /AFX_DATA_MAP BEGIN_MESSAGE_MAP(CBaseDlg, CDialog

3、) /AFX_MSG_MAP(CBaseDlg) /AFX_MSG_MAP END_MESSAGE_MAP() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 31 页 - - - - - - - - - / / CBaseDlg message handlers BOOL CBaseDlg:OnInitDialog() CDialog:OnInitDialog(); / TODO: Add extra initialization here m_oTabBase.Add

4、Page(商品类别 , &m_oClassdlg, IDD_DIALOG_CLASS); m_oTabBase.AddPage(商品资料 , &m_oMaterieldlg, IDD_DIALOG_MATERIEL); m_oTabBase.AddPage(付款方式 , &m_oPaymodedlg, IDD_DIALOG_PAYMODE); m_oTabBase.Show(); return TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should retu

5、rn FALSE CallDlg.cpp 程序:#include stdafx.h #include MyPos.h #include CallDlg.h #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE = _FILE_; #endif / / CCallDlg dialog extern CMyPosApp theApp; CCallDlg:CCallDlg(CWnd* pParent /*=NULL*/) : CDialog(CCallDlg:IDD, pParent) /AFX_DATA

6、_INIT(CCallDlg) / NOTE: the ClassWizard will add member initialization here /AFX_DATA_INIT void CCallDlg:DoDataExchange(CDataExchange* pDX) CDialog:DoDataExchange(pDX); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 31 页 - - - - - - - - - /AFX_DATA_MAP(CCallDlg

7、) DDX_Control(pDX, IDC_STATIC_CALL, m_oCallstatic); DDX_Control(pDX, IDC_EDIT_CALLBILLID, m_oCallbillid); /AFX_DATA_MAP BEGIN_MESSAGE_MAP(CCallDlg, CDialog) /AFX_MSG_MAP(CCallDlg) /AFX_MSG_MAP END_MESSAGE_MAP() / / CCallDlg message handlers void CCallDlg:OnOK() if(dowhat=imhappy) theApp.scallid=; m_

8、oCallbillid.GetWindowText(theApp.scallid); if(dowhat=pleased) m_oCallbillid.GetWindowText(dowhat); CDialog:OnOK(); BOOL CCallDlg:OnInitDialog() CDialog:OnInitDialog(); if(dowhat=pleased) m_oCallstatic.SetWindowText( 请输入桌号:); return TRUE; / return TRUE unless you set the focus to a control / EXCEPTIO

9、N: OCX Property Pages should return FALSE CheckDlg.cpp 程序:#include stdafx.h #include MyPos.h #include CheckDlg.h #include PosDlg.h 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 31 页 - - - - - - - - - #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static

10、char THIS_FILE = _FILE_; #endif / / CCheckDlg dialog extern CMyPosApp theApp; CCheckDlg:CCheckDlg(CWnd* pParent /*=NULL*/) : CDialog(CCheckDlg:IDD, pParent) /AFX_DATA_INIT(CCheckDlg) /AFX_DATA_INIT void CCheckDlg:DoDataExchange(CDataExchange* pDX) CDialog:DoDataExchange(pDX); /AFX_DATA_MAP(CCheckDlg

11、) DDX_Control(pDX, IDC_EDIT_CONSUME, m_oConsume); DDX_Control(pDX, IDC_EDIT_CDISCOUNT, m_oCdiscount); DDX_Control(pDX, IDC_EDIT_RECEIVE, m_oReceive); DDX_Control(pDX, IDC_EDIT_CHANGE, m_oChange); DDX_Control(pDX, IDC_EDIT_TOTALM, m_oTotalm); DDX_Control(pDX, IDC_COMBO_PAYMODE, m_oCombopay); DDX_Cont

12、rol(pDX, IDC_LIST_CHECKLIST, m_oChecklist); /AFX_DATA_MAP BEGIN_MESSAGE_MAP(CCheckDlg, CDialog) /AFX_MSG_MAP(CCheckDlg) ON_BN_CLICKED(IDC_BUTTON_CHECKOK, OnButtonCheckok) ON_EN_CHANGE(IDC_EDIT_RECEIVE, OnChangeEditReceive) ON_NOTIFY(NM_CLICK, IDC_LIST_CHECKLIST, OnClickListChecklist) ON_EN_CHANGE(ID

13、C_EDIT_CDISCOUNT, OnChangeEditCdiscount) ON_BN_CLICKED(IDC_BUTTON_RF, OnButtonRf) ON_BN_CLICKED(IDC_BUTTON_HANG, OnButtonHang) /AFX_MSG_MAP 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 31 页 - - - - - - - - - END_MESSAGE_MAP() / / CCheckDlg message handlers BO

14、OL CCheckDlg:OnInitDialog() CDialog:OnInitDialog(); /设置 list 控件的文字和背景颜色m_oChecklist.SetBkColor(RGB(255,255,255); m_oChecklist.SetTextBkColor(RGB(161,223,212); /清空 list 控件的数据for(int delcolumn=100;delcolumn=0;delcolumn-) m_oChecklist.DeleteColumn(delcolumn); /设置 list 对话框的列DWORD dwStyle; RECT rect; LV_

15、COLUMN lvc; dwStyle = m_oChecklist.GetStyle(); dwStyle |= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ; m_oChecklist.SetExtendedStyle(dwStyle); m_oChecklist.GetClientRect(&rect); lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH |LVCF_FMT; lvc.fmt=LVCFMT_LEFT; lvc.iSubItem = 0; lvc.pszTe

16、xt = _T( 商品类别 ); lvc.cx = 110; m_oChecklist.InsertColumn(1,&lvc); lvc.iSubItem = 1; lvc.pszText = _T( 消费金额 ); lvc.cx = 90; m_oChecklist.InsertColumn(2,&lvc); lvc.iSubItem = 2; lvc.pszText = _T( 可折扣金额 ); lvc.cx = 90; m_oChecklist.InsertColumn(3,&lvc); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - -

17、- - - - 名师精心整理 - - - - - - - 第 5 页,共 31 页 - - - - - - - - - lvc.iSubItem = 3; lvc.pszText = _T( 折扣 %); lvc.cx = 60; m_oChecklist.InsertColumn(4,&lvc); lvc.iSubItem = 4; lvc.pszText = _T( 结帐金额 ); lvc.cx = 90; m_oChecklist.InsertColumn(5,&lvc); /Add paymode to combobox. _RecordsetPtr m_pRecordset; CSt

18、ring sql=select * from PAYMODE; try m_pRecordset.CreateInstance(ADODB.Recordset); m_pRecordset-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText); while(!m_pRecordset-adoEOF) m_oCombopay.AddString(LPCTSTR)(_bstr_t)m_pRecordset-GetCollect(NAM

19、E); m_pRecordset-MoveNext(); m_pRecordset-Close(); m_oCombopay.SetCurSel(0);/Select the 1st string of combobox. catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 读取付款方式到组合框出错:%s,e.ErrorMessage(); AfxMessageBox(temp); /Read class consume to list. ReadtoList(theApp.scallid); /Sum bill Items mone

20、y from database. CString stotal; float ftotal=0; sql=Select SUM(ITEMTOTAL) as SSS from SALEDETAIL where BILLID=+theApp.scallid+; try 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 31 页 - - - - - - - - - m_pRecordset.CreateInstance(ADODB.Recordset); m_pRecordset

21、-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText); _variant_t vtemp = m_pRecordset-GetCollect(SSS); if(vtemp.dblVal0) ftotal=(float)m_pRecordset-GetCollect(SSS); else ftotal=0; stotal.Format(%.2f,ftotal); m_oTotalm.SetWindowText(stotal); m

22、_oConsume.SetWindowText(stotal); catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 计算单据商品金额出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should return FALSE void CCheckDlg:OnButtonCheckok() CString

23、stotal,sbilltotal,spayID,sql,spaymode,snowtime; long lpayID; _RecordsetPtr m_pRecordset; m_oConsume.GetWindowText(stotal); m_oTotalm.GetWindowText(sbilltotal); int nselect=m_oCombopay.GetCurSel(); m_oCombopay.GetLBText(nselect,spaymode); lpayID=GetPaymodeID(spaymode); spayID.Format(%d,lpayID); if(fc

24、hangeExecute(_bstr_t)sql,&RecordsAffected,adCmdText); catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 单据头更新数据库出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return; /output the checkout time and paymode to the print. theApp.snowtimep=snowtime; theApp.spaymodep=spaymode; theApp.sconsume=stotal;

25、 theApp.sactsum=sbilltotal; /Insert data into PAYDETAIL. CString sclass,scontotal,sdiscount,sacttotal,svaltotal; int nItemCount=m_oChecklist.GetItemCount();/表项总数for(int i=0;iExecute(_bstr_t)sql,&RecordsAffected,adCmdText); catch(_com_error e)/ 捕捉异常 CString temp; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - -

26、- - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 31 页 - - - - - - - - - temp.Format(结帐 付 款明细 (PAYDETAIL)插入数据出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return; /When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg. LRESULT Res=:SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0);

27、CDialog:OnOK(); long CCheckDlg:GetPaymodeID(CString payname) long paymodeID; _RecordsetPtr m_pRecordset; CString sql=Select * from PAYMODE where NAME=+payname+; try m_pRecordset.CreateInstance(ADODB.Recordset); m_pRecordset-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenS

28、tatic,adLockOptimistic,adCmdText); paymodeID=(long)m_pRecordset-GetCollect(ID); catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 获取付款方式ID 出错 :%s,e.ErrorMessage(); AfxMessageBox(temp); return paymodeID; void CCheckDlg:OnChangeEditReceive() / TODO: If this is a RICHEDIT control, the control wil

29、l not / send this notification unless you override the CDialog:OnInitDialog() / function and call CRichEditCtrl().SetEventMask() / with the ENM_CHANGE flag ORed into the mask. CString sreceive,schange,stotal; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 31 页

30、- - - - - - - - - m_oChange.SetWindowText(); m_oReceive.GetWindowText(sreceive); m_oTotalm.GetWindowText(stotal); fchange=atof(sreceive)-atof(stotal); if(fchange=0) schange.Format(%.2f,fchange); m_oChange.SetWindowText(schange); void CCheckDlg:ReadtoList(CString sbillid) _RecordsetPtr m_pRecordset;

31、/Must define it in function! CString sql,sclassname,sclassname1,sctotal; long lclassid; float fctotal=0; sql=Select Sum(ITEMTOTAL) as XXX,CLASSID from SALEDETAIL where BILLID=+sbillid+ group by CLASSID ; /删除所有list 中的数据。m_oChecklist.DeleteAllItems(); int numline=0; try m_pRecordset.CreateInstance(ADO

32、DB.Recordset); m_pRecordset-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText); LV_ITEM lvitem; lvitem.pszText=; lvitem.mask=LVIF_TEXT; lvitem.iSubItem=0; while(!m_pRecordset-adoEOF) lvitem.iItem=numline; m_oChecklist.InsertItem(&lvitem); /读

33、出数据写入到list 中lclassid= (long)m_pRecordset-GetCollect(CLASSID); sclassname=GetClassName(lclassid); sclassname1=sclassname.Left(sclassname.GetLength()-4); m_oChecklist.SetItemText(numline,0,sclassname1);/Read class name to 0 column. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - -

34、- - - - 第 10 页,共 31 页 - - - - - - - - - fctotal=(float)m_pRecordset-GetCollect(XXX); sctotal.Format(%.2f,fctotal); m_oChecklist.SetItemText(numline,1,sctotal);/Read class consume total to 1st column. if(sclassname.Right(1)=0) m_oChecklist.SetItemText(numline,2,0.00);/Read class consume discount tota

35、l to 2nd column. else m_oChecklist.SetItemText(numline,2,sctotal); m_oChecklist.SetItemText(numline,3,100); m_oChecklist.SetItemText(numline,4,sctotal);/Read class consume act total to 4th column. numline+; m_pRecordset-MoveNext(); m_pRecordset-Close(); catch(_com_error e)/ 捕捉异常 CString temp; temp.F

36、ormat( 结帐 列表读入商品出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return; CString CCheckDlg:GetClassName(long lclassid) _RecordsetPtr m_pRecordset; /Must define it in function! CString sql,sclassid,sname,sdiscount; sclassid.Format(%d,lclassid); sql=Select NAME,DISCOUNT from MATERIELCLASS where ID=+sclass

37、id+; try m_pRecordset.CreateInstance(ADODB.Recordset); m_pRecordset-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText); if(!m_pRecordset-adoEOF) sname=(LPCTSTR)(_bstr_t)m_pRecordset-GetCollect(NAME); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - -

38、 - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 31 页 - - - - - - - - - sdiscount=(LPCTSTR)(_bstr_t)m_pRecordset-GetCollect(DISCOUNT); sname=sname+xxx+sdiscount; catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 获取类别名称出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return sname; void CCheckDlg:OnCl

39、ickListChecklist(NMHDR* pNMHDR, LRESULT* pResult) /得到当前选中的行POSITION pos = m_oChecklist.GetFirstSelectedItemPosition(); /如果选中一行if(pos) int nItem = m_oChecklist.GetNextSelectedItem(pos); CString sdiscount=m_oChecklist.GetItemText(nItem,3); m_oCdiscount.SetWindowText(sdiscount); *pResult = 0; void CChe

40、ckDlg:OnChangeEditCdiscount() / TODO: If this is a RICHEDIT control, the control will not / send this notification unless you override the CDialog:OnInitDialog() / function and call CRichEditCtrl().SetEventMask() / with the ENM_CHANGE flag ORed into the mask. CString sdiscountsum,sdiscount,ssum; flo

41、at fdiscountsum,fsum; long ldiscount; LV_ITEM lvitem; lvitem.pszText=; lvitem.mask=LVIF_TEXT; /得到当前选中的行POSITION pos = m_oChecklist.GetFirstSelectedItemPosition(); /如果选中一行名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 31 页 - - - - - - - - - if(pos) int nItem =

42、m_oChecklist.GetNextSelectedItem(pos); sdiscountsum=m_oChecklist.GetItemText(nItem,2); fdiscountsum=atof(sdiscountsum); m_oCdiscount.GetWindowText(sdiscount); ldiscount=atol(sdiscount); if(ldiscount100|ldiscount0) MessageBox(请确定折扣大于0 并且小于100!); return; if(ldiscountVerifyDicsount() CString temp; temp

43、.Format( 折扣不能小于%d!,VerifyDicsount(); AfxMessageBox(temp); return; fsum=ldiscount*fdiscountsum/100; ssum.Format(%.2f,fsum); if(fdiscountsum=0)/If the class could not be discount. sdiscountsum=m_oChecklist.GetItemText(nItem,1); ssum=sdiscountsum; lvitem.iItem=nItem; m_oChecklist.InsertItem(&lvitem); m

44、_oChecklist.SetItemText(nItem,3,sdiscount); m_oChecklist.SetItemText(nItem,4,ssum); float ftotal=0; int nItemCount=m_oChecklist.GetItemCount();/表项总数for(int i=0;iExecute(_bstr_t)sql,&RecordsAffected,adCmdText); catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 结帐 RF 更新数据库出错:%s,e.ErrorMessage(); Af

45、xMessageBox(temp); return; /When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg. LRESULT Res=:SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0); EndDialog(1);/Close the dialog. void CCheckDlg:OnButtonHang() if(!theApp.VerifyPower(Hang) AfxMessageBox( 没有权限挂帐!); return; 名师资料总结 - -

46、 -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 14 页,共 31 页 - - - - - - - - - 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)/ 捕捉异

47、常 CString temp; temp.Format( 结帐 挂帐更新数据库出错:%s,e.ErrorMessage(); AfxMessageBox(temp); return; EndDialog(1);/Close the dialog. long CCheckDlg:VerifyDicsount() CString sql; _RecordsetPtr m_pRecordset; long ldiscount; sql=Select DISCOUNT from USERS where NAME=+theApp.name+; try m_pRecordset.CreateInstanc

48、e(ADODB.Recordset); m_pRecordset-Open(_variant_t)sql,_variant_t(IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText); if(!m_pRecordset-adoEOF) ldiscount=(long)m_pRecordset-GetCollect(DISCOUNT); catch(_com_error e)/ 捕捉异常 CString temp; temp.Format( 读取用户权限出错:%s,e.ErrorMessage(

49、); AfxMessageBox(temp); return -1; return ldiscount; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 31 页 - - - - - - - - - ClassDlg.cpp 文件代码:#include stdafx.h #include MyPos.h #include ClassDlg.h #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char

50、 THIS_FILE = _FILE_; #endif / / CClassDlg dialog extern CMyPosApp theApp; CClassDlg:CClassDlg(CWnd* pParent /*=NULL*/) : CDialog(CClassDlg:IDD, pParent) /AFX_DATA_INIT(CClassDlg) m_classname = _T(); m_radiodiscount = -1; m_tempid = 0; /AFX_DATA_INIT void CClassDlg:DoDataExchange(CDataExchange* pDX)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁