📄 qqview.cpp
字号:
// QQView.cpp : implementation of the CQQView class
//
#include "stdafx.h"
#include "QQ.h"
#include "QQDoc.h"
#include "QQView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////////////
#include "RoomRegister.h" //登记头文件
#include "ChooseRoom.h" //选房头文件
#include "ChooseFood.h" //选食物头文件
#include "ChooseServer.h" //服务点单头文件
#include "MoneyPay.h" //支付帐单头文件
#include "Checkout.h" //结帐走人头文件
#include "GuestInfoLookup.h" //客人信息查询对话框头文件
#include "RoomInfoLookup.h" //房间信息查询对话框头文件
#include "BillInfoLookup.h" //帐单信息查询对话框头文件
#include "EmployerInfoLookup.h"//职员信息查询对话框头文件
#include "Tools.h"
#include "page3.h"
#include "MainFrm.h"
#include "HotelInfoShow.h"//酒店概况显示对话框
#include "RoomDestine.h" //房间预定头文件
/////////////////////////////////////////////////////////////////////////////
// CQQView
IMPLEMENT_DYNCREATE(CQQView, CView)
BEGIN_MESSAGE_MAP(CQQView, CView)
//{{AFX_MSG_MAP(CQQView)
ON_COMMAND(ID_ROOM_REGISTER, OnRoomRegister)
ON_COMMAND(ID_ROOM_CHOOSE, OnRoomChoose)
ON_COMMAND(ID_FOOD_ORDER, OnFoodOrder)
ON_COMMAND(ID_SERVER_ORDER, OnServerOrder)
ON_COMMAND(ID_MONEY_CHECKOUT, OnMoneyCheckout)
ON_COMMAND(ID_MONEY_STOCK, OnMoneyStock)
ON_COMMAND(ID_MONEY_REPORTFORM, OnMoneyReportform)
ON_COMMAND(ID_INFOLOOK_GUEST, OnInfolookGuest)
ON_COMMAND(ID_INFOLOOK_BILL, OnInfolookBill)
ON_COMMAND(ID_INFOLOOK_EMPLOYER, OnInfolookEmployer)
ON_COMMAND(ID_INFOLOOK_FOOD, OnInfolookFood)
ON_COMMAND(ID_INFOLOOK_ROOM, OnInfolookRoom)
ON_COMMAND(ID_INFOLOOK_SERVER, OnInfolookServer)
ON_COMMAND(ID_INFOLOOK_CONSUME, OnInfolookConsume)
ON_WM_TIMER()
ON_WM_ERASEBKGND()
ON_COMMAND(ID_MONEY_PAY, OnMoneyPay)
ON_WM_CREATE()
ON_WM_LBUTTONDOWN()
ON_COMMAND(ID_ROOM_DESTINE, OnRoomDestine)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CQQView construction/destruction
HBITMAP CQQView::m_CurScreenBitmap=NULL;
BOOL CQQView::bFirstRun=TRUE;
int CQQView::nImgTypeInView=-1;//普通图像类型
CPoint CQQView::pnt=CPoint(0,0);
CQQView::CQQView()
{
// TODO: add construction code here
//赋初值
strShowText="";
bFinish=false;
bFirst=true;
InitStructData();
}
CQQView::~CQQView()
{
m_List.RemoveAll();
}
CQQView * CQQView::GetView()
{//静态成员函数
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
CView * pView = pFrame->GetActiveView();
if ( !pView )
return NULL;
// Fail if view is of wrong kind
// (this could occur with splitter windows, or additional
// views on a single document
if ( ! pView->IsKindOf( RUNTIME_CLASS(CQQView) ) )
return NULL;
return (CQQView*) pView;
}
BOOL CQQView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CQQView drawing
void CQQView::OnDraw(CDC* pDC)
{
CQQDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
LoadbgroundBitmap(pDC);//画背景
if(bFirstRun)
{
nImgTypeInView=0;
LoadWelocmeBmp(pDC);
bFirstRun=FALSE;
}
if(page3.bDrawTreeImage)
{
page3.DrawTreeImage(pDC,CPoint(50,0));
page3.bDrawTreeImage=FALSE;
}
if(page3.bDrawFrameImage)
{
page3.DrawFrameImg(pDC,CRect(page3.xStart,page3.yStart,page3.xStart+350,page3.yStart+200));
page3.bDrawFrameImage=FALSE;
}
}
/////////////////////////////////////////////////////////////////////////////
// CQQView printing
BOOL CQQView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CQQView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CQQView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CQQView diagnostics
#ifdef _DEBUG
void CQQView::AssertValid() const
{
CView::AssertValid();
}
void CQQView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CQQDoc* CQQView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CQQDoc)));
return (CQQDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CQQView message handlers
//加载背景图
void CQQView::LoadbgroundBitmap(CDC *pDC)
{//加载视的背景图
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BKBMP);
CDC m;
m.CreateCompatibleDC(pDC);//创建一个于pDC兼容的DC
m.SelectObject(&bitmap);
CRect rect;
this->GetClientRect(&rect);
pDC->BitBlt(0,0,rect.Width(),rect.Height(),&m,0,0,SRCCOPY);
m.DeleteDC();
}
void CQQView::LoadWelocmeBmp(CDC* pDC)
{//加载启动时的欢迎图像
CBitmap bitmap;
bitmap.LoadBitmap(IDB_HOTELTEXT);
CDC m;
m.CreateCompatibleDC(pDC);//创建一个于pDC兼容的DC
m.SelectObject(&bitmap);
CRect rect;
this->GetClientRect(&rect);
//// long nStartX=rect.left;
// long nStartY=rect.bottom-280;
long nStartX=rect.left+rect.Width()/10;
long nStartY=rect.top+rect.Height()/10;
BITMAP m_bitmap;//定义位图结构体来保存位图信息
bitmap.GetBitmap(&m_bitmap);//得到位图结构体,记录了位图的信息
long nWidth=m_bitmap.bmWidth;//位图宽度
long nHeight=m_bitmap.bmHeight;//位图高度
pDC->BitBlt(nStartX,nStartY,nWidth,nHeight,&m,0,0,SRCCOPY);
m.DeleteDC();
}
void CQQView::SetBitmapText(CPoint pnt,CDC*pDC, CString strText)
{//显示带有图像和文字的字符串
CBitmap bitmap;
bitmap.LoadBitmap(IDB_TEXT);
CDC m;
m.CreateCompatibleDC(pDC);
m.SelectObject(&bitmap);
pDC->SetBkMode(TRANSPARENT);//设置背景模式
pDC->BitBlt(pnt.x,pnt.y,9,9,&m,0,0,SRCCOPY);//拷贝图像
pDC->TextOut(pnt.x+15,pnt.y-5,strText);//输出文本
}
//###################################################################
/////////////////////信息管理模块
/////////////////////////////////////////////////////////////////////
void CQQView::OnRoomRegister()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CGuestRegister guestreg;
guestreg.DoModal();//登记对话框
}
void CQQView::OnRoomChoose()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CChooseRoom chooseroom;
chooseroom.DoModal();
}
void CQQView::OnRoomDestine()
{//房间预定
// TODO: Add your command handler code here
bFirstRun=FALSE;
CRoomDestine RoomDestine;
RoomDestine.DoModal();
}
void CQQView::OnFoodOrder()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CChooseFood choosefood;
choosefood.DoModal();
}
void CQQView::OnServerOrder()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CChooseServer chooseserver;
chooseserver.DoModal();
}
void CQQView::OnMoneyCheckout()
{//结帐走人
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CCheckOut checkout;
checkout.DoModal();
}
void CQQView::OnMoneyStock()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
}
void CQQView::OnMoneyReportform()
{
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
}
void CQQView::OnMoneyPay()
{//支付某个帐单的款项
// TODO: Add your command handler code here
nImgTypeInView=-1;//背景图
bFirstRun=FALSE;
CMoneyPay moneypay;
moneypay.DoModal();
}
/////////////////////////////////////////////////////////////////////
//###################################################################
////////////////////////////信息查询模块
//////////////////////////////////////////////////////////////////////
void CQQView::OnInfolookGuest()
{
// TODO: Add your command handler code her
bFirstRun=FALSE;
this->Invalidate();
this->UpdateData(TRUE);
CDC*pDC=GetDC();
CRect rect;
GetClientRect(&rect);
pDC->FillSolidRect(rect,pDC->GetBkColor());
LoadbgroundBitmap(pDC);//画背景
guestinfolookup.DoModal();//模态显示对话框
//////////////////////////////////////////////////////////////////////
//////设置每行要显示的文本
CString strlineText[12];//行文本对象
strlineText[0]="客人的手牌号码(HandCode)是: ";
strlineText[0]=strlineText[0]+guestinfolookup.HandCode;//设置显示文本
strlineText[1]="客人的名字是(Name): ";
strlineText[1]=strlineText[1]+guestinfolookup.Name;//name
strlineText[2]="客人的类型(GuestType): ";
strlineText[2]=strlineText[2]+guestinfolookup.GuestType+" ";//gueatype
strlineText[3]="客人性别(Sex): ";
strlineText[3]=strlineText[3]+guestinfolookup.Sex;//sex
strlineText[4]="客人登记时使用的证件类型(Cerificate): ";
strlineText[4]=strlineText[4]+guestinfolookup.Certificate;//Certificate
strlineText[5]="客人登记的证件号码是(CertifyCode): ";
strlineText[5]=strlineText[5]+guestinfolookup.CertifyCode;//CertifyCode
strlineText[6]="客人是否为团队成员(IsMember): ";
if(guestinfolookup.IsMember){strlineText[6]=strlineText[6]+"是";}
else{strlineText[6]=strlineText[6]+"否";}//ismember
strlineText[7]="客人是否为团队客人的主客(IsMaster): ";
if(guestinfolookup.IsMaster){strlineText[7]=strlineText[7]+"是";}
else{strlineText[7]=strlineText[7]+"否";}//ismaster
strlineText[8]="客人所在团队编号(GroupID): ";
strlineText[8]=strlineText[8]+guestinfolookup.GroupID;
strlineText[9]="客人所在团队的客人数目(GuestNum): ";CString str;str.Format("%d",guestinfolookup.GuestNum);
strlineText[9]=strlineText[9]+str;
strlineText[10]="团队的房间数目(RoomNum): ";
strlineText[10]=strlineText[10]+guestinfolookup.RoomNum;
strlineText[11]="客人所在房间的号码(RoomCode): ";
strlineText[11]=strlineText[11]+guestinfolookup.RoomCode;
int nWidth=rect.Width();
int nHeight=rect.Height();
CPoint potstart;
potstart.x=rect.left+nWidth/10;
potstart.y=rect.top+nHeight/10;
if(guestinfolookup.bSuccess)//查询数据库成功则进行操作
{
pDC->SetBkMode(TRANSPARENT);//设置背景模式
for(int i=0;i<12;i++)
{
pDC->SetBkMode(TRANSPARENT);
SetBitmapText(potstart.x,potstart.y+20*i,pDC,strlineText[i]);
}
}
//////////////////////////////////////////////////////////////////////
ClientToScreen(&rect);//将客户区域转变成屏幕坐标
m_CurScreenBitmap=::GetScreenBitmap(&rect);
nImgTypeInView=0;//文字背景图
}
void CQQView::OnInfolookBill()
{
// TODO: Add your command handler code here
bFirstRun=FALSE;
this->Invalidate();
this->UpdateData(TRUE);
CDC*pDC=GetDC();
CRect rect;
GetClientRect(&rect);//得到客户区域
pDC->FillSolidRect(rect,pDC->GetBkColor());
LoadbgroundBitmap(pDC);//画背景
CBillInfoLookup billinfolookup;
billinfolookup.DoModal();
///////////////////////////////////////////////////////////////
/////////////////显示查询文本
///////////////////////////////////////////////////////////////
CString line[6];
line[0]="帐单号: ";
line[0]=line[0]+billinfolookup.BillCode;
line[1]="客人手牌号码: ";
line[1]=line[1]+billinfolookup.HandCode;
line[2]="应付总金额: ";CString str;str.Format("%d",billinfolookup.Sum);
line[2]=line[2]+str;
line[3]="实付金额: ";str.Format("%d",billinfolookup.Paid);
line[3]=line[3]+str;
line[4]="折扣率: ";
line[4]=line[4]+billinfolookup.Rebate;
line[5]="是/否已经付款: ";
if(billinfolookup.Striked)
{
line[5]=line[5]+"是";
}
else{ line[5]=line[5]+"否";}
////////////showtext////////////////////
int nWidth=rect.Width();
int nHeight=rect.Height();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -