📄 report2dlg.cpp
字号:
// Report2Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "HosptialMan.h"
#include "Report2Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReport2Dlg dialog
CReport2Dlg::CReport2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CReport2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReport2Dlg)
//}}AFX_DATA_INIT
}
void CReport2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReport2Dlg)
DDX_Control(pDX, IDC_YEAR_COMBO, m_year);
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(CReport2Dlg, CDialog)
//{{AFX_MSG_MAP(CReport2Dlg)
ON_CBN_SELCHANGE(IDC_YEAR_COMBO, OnSelchangeYearCombo)
ON_CBN_SELCHANGE(IDC_MONTH_COMBO, OnSelchangeMonthCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReport2Dlg message handlers
void CReport2Dlg::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;
cSql = "SELECT * FROM ReportDoctor_v WHERE 月份='" + cYear + "-" + cMonth + "'";
//设置数据源
m_adodc.SetRecordSource(cSql);
m_adodc.Refresh();
}
BOOL CReport2Dlg::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); //设置月
UpdateData(FALSE);
RefreshData();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReport2Dlg::OnSelchangeYearCombo()
{
RefreshData();
}
void CReport2Dlg::OnSelchangeMonthCombo()
{
RefreshData();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -