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

📄 reportmandlg.cpp

📁 人事工资管理系统是非常通用的管理信息系统
💻 CPP
字号:
// 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()
{
	//设置记录源
	CString cSource;
	cSource = "SELECT DISTINCT iMonth AS 工资表月份"
			" FROM SalaryStatistics ORDER BY iMonth DESC";
	m_adodc.SetRecordSource(cSource);
	m_adodc.Refresh();
	//设置表格列宽度
	_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("请选择月份");
		return;
	}
	CSalaryStatistics sts;
	sts.ReportToExcel(m_datagrid.GetItem(0));
}

void CReportManDlg::OnDelButton() 
{
	if (m_adodc.GetRecordset().GetEof()) 
	{
		MessageBox("请选择月份");
		return;
	}
	if (MessageBox("是否删除当前记录","请确定", MB_YESNO) == IDYES)
	{
		CSalaryStatistics sts;
		sts.sql_delete(m_datagrid.GetItem(0));
		RefreshData();
	}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -