⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 report1dlg.cpp

📁 医院管理系统在CV++条件下的完整性开发>>>
💻 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 + -