📄 checkbookoutdlg.cpp
字号:
// checkBookOutDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Guesthouse.h"
#include "checkBookOutDlg.h"
#include "BookroomListDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CcheckBookOutDlg dialog
CcheckBookOutDlg::CcheckBookOutDlg(CWnd* pParent /*=NULL*/)
: CDialog(CcheckBookOutDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CcheckBookOutDlg)
m_t1 = 0;
m_t2 = 0;
m_name = _T("");
m_roomnumber = _T("");
//}}AFX_DATA_INIT
}
void CcheckBookOutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CcheckBookOutDlg)
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_t1);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER3, m_t2);
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT2, m_roomnumber);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CcheckBookOutDlg, CDialog)
//{{AFX_MSG_MAP(CcheckBookOutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CcheckBookOutDlg message handlers
BOOL CcheckBookOutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_t1=CTime::GetCurrentTime()-CTimeSpan(30,0,0,0);
m_t2=CTime::GetCurrentTime();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CcheckBookOutDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
//设置查询字符串
CString str;
m_name.TrimRight(" ");
m_roomnumber.TrimRight(" ");
m_radio = GetCheckedRadioButton(IDC_RADIO1,IDC_RADIO3);
switch(m_radio)
{
case IDC_RADIO1:
if(m_name=="")
{
AfxMessageBox(_T("顾客姓名不能为空"));
return;
}
else
str="customname like '%"+m_name+"%'";
break;
case IDC_RADIO2:
if(m_roomnumber=="")
{
AfxMessageBox(_T("客房编号不能为空"));
return;
}
else
str="roomnumber like '%"+m_roomnumber+"%'";
break;
case IDC_RADIO3:
str="indate>='"+m_t1.Format("%Y-%m-%d")+"'";
str+=" and indate<='"+m_t2.Format("%Y-%m-%d")+"'";
break;
default:
MessageBox("请先择一种条件查询!");
break;
}
//打开显示查询结果的对话框
CBookroomListDlg dlg;
str+=" and checkdate IS NOT NULL";
dlg.m_Filter=str;
dlg.DoModal();
// CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -