?? report1dlg.cpp
字號:
// Report1Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "HosptialMan.h"
#include "Report1Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReport1Dlg dialog
CReport1Dlg::CReport1Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CReport1Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReport1Dlg)
//}}AFX_DATA_INIT
}
void CReport1Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReport1Dlg)
DDX_Control(pDX, IDC_YEAR_COMBO, m_year);
DDX_Control(pDX, IDC_TYPE_COMBO, m_type);
DDX_Control(pDX, IDC_MONTH_COMBO, m_month);
DDX_Control(pDX, IDC_ADODC1, m_adodc);
DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReport1Dlg, CDialog)
//{{AFX_MSG_MAP(CReport1Dlg)
ON_CBN_SELCHANGE(IDC_YEAR_COMBO, OnSelchangeYearCombo)
ON_CBN_SELCHANGE(IDC_MONTH_COMBO, OnSelchangeMonthCombo)
ON_CBN_SELCHANGE(IDC_TYPE_COMBO, OnSelchangeTypeCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReport1Dlg message handlers
BOOL CReport1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
CTime t = CTime::GetCurrentTime(); //讀取當前系統日期
int iYear, iMonth;
iYear = t.GetYear();
iMonth = t.GetMonth();
m_year.SetCurSel(iYear - 2000); //設置年
m_month.SetCurSel(iMonth - 1); //設置月
m_type.SetCurSel(0); //設置類型
UpdateData(FALSE);
RefreshData();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReport1Dlg::RefreshData()
{
UpdateData(true);
//讀取月份信息
CString cYear, cMonth;
int index;
index = m_year.GetCurSel();
m_year.GetLBText(index, cYear);
index = m_month.GetCurSel();
m_month.GetLBText(index, cMonth);
// 刷新記錄
CString cSql;
if (m_type.GetCurSel() == 0) //查詢藥品銷售情況
{
cSql = "SELECT * FROM ReportMedicine_v WHERE 銷售日期='";
cSql += cYear + "-" + cMonth + "'";
}
else
{
cSql = "SELECT * FROM ReportItems_v WHERE 銷售日期='";
cSql += cYear + "-" + cMonth + "'";
}
//設置數據源
m_adodc.SetRecordSource(cSql);
m_adodc.Refresh();
}
void CReport1Dlg::OnSelchangeYearCombo()
{
RefreshData();
}
void CReport1Dlg::OnSelchangeMonthCombo()
{
RefreshData();
}
void CReport1Dlg::OnSelchangeTypeCombo()
{
RefreshData();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -