?? reportmandlg.cpp
字號(hào):
// ReportManDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HrSys.h"
#include "ReportManDlg.h"
#include "COMDEF.H"
#include "Columns.h"
#include "Column.h"
#include "_recordset.h"
#include "SalaryStatistics.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReportManDlg dialog
CReportManDlg::CReportManDlg(CWnd* pParent /*=NULL*/)
: CDialog(CReportManDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReportManDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CReportManDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReportManDlg)
DDX_Control(pDX, IDC_ADODC1, m_adodc);
DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReportManDlg, CDialog)
//{{AFX_MSG_MAP(CReportManDlg)
ON_BN_CLICKED(IDC_VIEW_BUTTON, OnViewButton)
ON_BN_CLICKED(IDC_DEL_BUTTON, OnDelButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReportManDlg message handlers
void CReportManDlg::RefreshData()
{
//設(shè)置記錄源
CString cSource;
cSource = "SELECT DISTINCT iMonth AS 工資表月份"
" FROM SalaryStatistics ORDER BY iMonth DESC";
m_adodc.SetRecordSource(cSource);
m_adodc.Refresh();
//設(shè)置表格列寬度
_variant_t vIndex;
vIndex = long(0);
m_datagrid.GetColumns().GetItem(vIndex).SetWidth(160);
}
BOOL CReportManDlg::OnInitDialog()
{
CDialog::OnInitDialog();
RefreshData();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReportManDlg::OnViewButton()
{
if (m_adodc.GetRecordset().GetEof())
{
MessageBox("請(qǐng)選擇月份");
return;
}
CSalaryStatistics sts;
sts.ReportToExcel(m_datagrid.GetItem(0));
}
void CReportManDlg::OnDelButton()
{
if (m_adodc.GetRecordset().GetEof())
{
MessageBox("請(qǐng)選擇月份");
return;
}
if (MessageBox("是否刪除當(dāng)前記錄","請(qǐng)確定", MB_YESNO) == IDYES)
{
CSalaryStatistics sts;
sts.sql_delete(m_datagrid.GetItem(0));
RefreshData();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -