?? rcxdlg.cpp
字號:
// Rcxdlg.cpp : implementation file
//
#include "stdafx.h"
#include "餐飲管理.h"
#include "Rcxdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRcxdlg dialog
extern CMyApp theApp;
CRcxdlg::CRcxdlg(CWnd* pParent /*=NULL*/)
: CDialog(CRcxdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRcxdlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CRcxdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRcxdlg)
DDX_Control(pDX, IDC_COMBO_day, m_Daycombo);
DDX_Control(pDX, IDC_COMBO_month, m_Monthcombo);
DDX_Control(pDX, IDC_COMBO_year, m_Yearcombo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRcxdlg, CDialog)
//{{AFX_MSG_MAP(CRcxdlg)
ON_BN_CLICKED(IDC_BUTTON_CHAXUN, OnButtonChaxun)
ON_BN_CLICKED(IDC_BUTTON_tuichu, OnBUTTONtuichu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRcxdlg message handlers
BOOL CRcxdlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString sql;
CString str;
sql="select distinct Year(時間) as 年份 from shouru ";
m_pRs=theApp.m_pCon->Execute((_bstr_t)sql,NULL,adCmdText);
while(m_pRs->adoEOF==0)
{
str=(char*)(_bstr_t)m_pRs->GetCollect("年份");
m_Yearcombo.AddString(str);
m_pRs->MoveNext();
}
sql="select distinct Month(時間) as 月份 from shouru ";
m_pRs=theApp.m_pCon->Execute((_bstr_t)sql,NULL,adCmdText);
while(m_pRs->adoEOF==0)
{
str=(char*)(_bstr_t)m_pRs->GetCollect("月份");
m_Monthcombo.AddString(str);
m_pRs->MoveNext();
}
sql="select distinct Day(時間) as 日期 from shouru ";
m_pRs=theApp.m_pCon->Execute((_bstr_t)sql,NULL,adCmdText);
while(m_pRs->adoEOF==0)
{
str=(char*)(_bstr_t)m_pRs->GetCollect("日期");
m_Daycombo.AddString(str);
m_pRs->MoveNext();
}
return true;
}
void CRcxdlg::OnButtonChaxun()
{
UpdateData();
CString year,month,day,totle;
if(m_Yearcombo.GetCurSel()==-1||m_Monthcombo.GetCurSel()==-1||m_Daycombo.GetCurSel()==-1)
{
AfxMessageBox("請選擇一個時間");
return;
}
m_Yearcombo.GetLBText(m_Yearcombo.GetCurSel(),year);
m_Monthcombo.GetLBText(m_Monthcombo.GetCurSel(),month);
m_Daycombo.GetLBText(m_Daycombo.GetCurSel(),day);
CString sql="select * from shouru where Year(時間)="+year+" and Month(時間)="+month+" and Day(時間)="+day+"";
m_pRs=theApp.m_pCon->Execute((_bstr_t)sql,NULL,adCmdText);
totle=(char*)(_bstr_t)m_pRs->GetCollect("日收入");
MessageBox(year+"年"+month+"月"+day+"日的收入為:"+totle+"元","日收入查詢");
}
void CRcxdlg::OnBUTTONtuichu()
{
CDialog::OnCancel();
}
void CRcxdlg::OnOK()
{
OnButtonChaxun();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -