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

📄 dwagecollect.cpp

📁 一个有关人事系统的所有代码和有关文件包括里面小量数据库。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// DWagecollect.cpp : implementation file
//

#include "stdafx.h"
#include "Rsglxt.h"
#include "DWagecollect.h"
#include "ExternDllHeader.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDWagecollect dialog
extern CRsglxtApp theApp;

CDWagecollect::CDWagecollect(CWnd* pParent /*=NULL*/)
	: CDialog(CDWagecollect::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDWagecollect)
	//}}AFX_DATA_INIT
}


void CDWagecollect::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDWagecollect)
	DDX_Control(pDX, IDC_BTN_SEL, m_BtnQuery);
	DDX_Control(pDX, IDC_BTN_PRINT, m_BtnPrint);
	DDX_Control(pDX, IDC_DATEEND, m_DateEnd);
	DDX_Control(pDX, IDC_DATESTART, m_DateStart);
	DDX_Control(pDX, IDC_EDTCONDITION, m_EdtCondition);
	DDX_Control(pDX, IDC_COMEMBLEM, m_ComEmblem);
	DDX_Control(pDX, IDC_COMFIELD5, m_Attend_Comfield);
	DDX_Control(pDX, IDC_COMFIELD4, m_Staff_Comfield);
	DDX_Control(pDX, IDC_COMFIELD3, m_StaffYear_Comfield);
	DDX_Control(pDX, IDC_COMFIELD2, m_Dep_Comfield);
	DDX_Control(pDX, IDC_COMFIELD1, m_DepYear_Comfield);
	DDX_Control(pDX, IDC_WAGEGRID9, m_Attend_Grid);
	DDX_Control(pDX, IDC_WAGEGRID8, m_Staff_Grid1);
	DDX_Control(pDX, IDC_WAGEGRID7, m_StaffYear_Grid1);
	DDX_Control(pDX, IDC_WAGEGRID6, m_Dep_Grid1);
	DDX_Control(pDX, IDC_WAGEGRID5, m_DepYear_Grid1);
	DDX_Control(pDX, IDC_WAGEGRID4, m_Staff_Grid);
	DDX_Control(pDX, IDC_WAGEGRID3, m_StaffYear_Grid);
	DDX_Control(pDX, IDC_WAGEGRID2, m_Dep_Grid);
	DDX_Control(pDX, IDC_WAGEGRID1, m_DepYear_Grid);
	DDX_Control(pDX, IDC_LIST_COLLECT, m_ListCollect);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDWagecollect, CDialog)
	//{{AFX_MSG_MAP(CDWagecollect)
	ON_LBN_SELCHANGE(IDC_LIST_COLLECT, OnSelchangeListCollect)
	ON_NOTIFY(NM_DBLCLK, IDC_WAGEGRID1, OnDblclkWagegrid1)
	ON_NOTIFY(NM_DBLCLK, IDC_WAGEGRID2, OnDblclkWagegrid2)
	ON_NOTIFY(NM_DBLCLK, IDC_WAGEGRID3, OnDblclkWagegrid3)
	ON_NOTIFY(NM_DBLCLK, IDC_WAGEGRID4, OnDblclkWagegrid4)
	ON_BN_CLICKED(IDC_BTN_SEL, OnBtnSel)
	ON_BN_CLICKED(IDC_BTN_PRINT, OnBtnPrint)
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDWagecollect message handlers

BOOL CDWagecollect::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	Init();
	m_BtnQuery.LoadPic(IDB_BIT_Query,IDB_BIT_Query,IDB_BIT_Query);
	m_BtnPrint.LoadPic(IDB_BIT_Print,IDB_BIT_Print,IDB_BIT_Print);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDWagecollect::OnSelchangeListCollect() 
{
	// TODO: Add your control notification handler code here
	CString sText,sql;
	RxRecordset srst;
	m_ListCollect.GetText(m_ListCollect.GetCurSel(),sText);
	if(sText=="部门工资年度汇总")
	{
		sql.Format("select * from 部门工资年度汇总");
		m_Text=sText;
    	m_DepYear_Grid.ShowWindow(SW_SHOW);
		m_DepYear_Grid1.ShowWindow(SW_SHOW);
		m_Dep_Grid.ShowWindow(SW_HIDE);
		m_Dep_Grid1.ShowWindow(SW_HIDE);
		m_StaffYear_Grid.ShowWindow(SW_HIDE);
		m_StaffYear_Grid1.ShowWindow(SW_HIDE);
		m_Staff_Grid.ShowWindow(SW_HIDE);
		m_Staff_Grid1.ShowWindow(SW_HIDE);
		m_Attend_Grid.ShowWindow(SW_HIDE);

		m_DepYear_Comfield.ShowWindow(SW_SHOW);
		m_Dep_Comfield.ShowWindow(SW_HIDE);
		m_StaffYear_Comfield.ShowWindow(SW_HIDE);
		m_Staff_Comfield.ShowWindow(SW_HIDE);
		m_Attend_Comfield.ShowWindow(SW_HIDE);
		m_DateStart.EnableWindow(false);
		m_DateEnd.EnableWindow(false);
		m_EdtCondition.SetWindowText("");

		sql.Format("select * from 部门工资年度汇总");
		srst.Open(sql,adCmdText);
		m_DepYear_Grid.AddCellValue(srst);

	}
	if(sText=="部门工资汇总")
	{
		
		m_Text=sText;
		m_DepYear_Grid.ShowWindow(SW_HIDE);
		m_DepYear_Grid1.ShowWindow(SW_HIDE);
		m_Dep_Grid.ShowWindow(SW_SHOW);
		m_Dep_Grid1.ShowWindow(SW_SHOW);
		m_StaffYear_Grid.ShowWindow(SW_HIDE);
		m_StaffYear_Grid1.ShowWindow(SW_HIDE);
		m_Staff_Grid.ShowWindow(SW_HIDE);
		m_Staff_Grid1.ShowWindow(SW_HIDE);
		m_Attend_Grid.ShowWindow(SW_HIDE);

		m_DepYear_Comfield.ShowWindow(SW_HIDE);
		m_Dep_Comfield.ShowWindow(SW_SHOW);
		m_StaffYear_Comfield.ShowWindow(SW_HIDE);
		m_Staff_Comfield.ShowWindow(SW_HIDE);
		m_Attend_Comfield.ShowWindow(SW_HIDE);
		m_DateStart.EnableWindow(true);
		m_DateEnd.EnableWindow(true);
		m_EdtCondition.SetWindowText("");

		sql.Format("select * from 部门工资明细汇总");
		srst.Open(sql,adCmdText);
		m_Dep_Grid.AddCellValue(srst);

	
	}
	if(sText=="员工工资年度汇总")
	{
		
		m_Text=sText;
		m_DepYear_Grid.ShowWindow(SW_HIDE);
		m_DepYear_Grid1.ShowWindow(SW_HIDE);
		m_Dep_Grid.ShowWindow(SW_HIDE);
		m_Dep_Grid1.ShowWindow(SW_HIDE);
		m_StaffYear_Grid.ShowWindow(SW_SHOW);
		m_StaffYear_Grid1.ShowWindow(SW_SHOW);
		m_Staff_Grid.ShowWindow(SW_HIDE);
		m_Staff_Grid1.ShowWindow(SW_HIDE);
		m_Attend_Grid.ShowWindow(SW_HIDE);

		m_DepYear_Comfield.ShowWindow(SW_HIDE);
		m_Dep_Comfield.ShowWindow(SW_HIDE);
		m_StaffYear_Comfield.ShowWindow(SW_SHOW);
		m_Staff_Comfield.ShowWindow(SW_HIDE);
		m_Attend_Comfield.ShowWindow(SW_HIDE);
		m_DateStart.EnableWindow(false);
		m_DateEnd.EnableWindow(false);
		m_EdtCondition.SetWindowText("");

		sql.Format("select * from 员工年度工资汇总");
		srst.Open(sql,adCmdText);
		m_StaffYear_Grid.AddCellValue(srst);

	}
	if(sText=="员工工资汇总")
	{
	
		m_Text=sText;
		m_DepYear_Grid.ShowWindow(SW_HIDE);
		m_DepYear_Grid1.ShowWindow(SW_HIDE);
		m_Dep_Grid.ShowWindow(SW_HIDE);
		m_Dep_Grid1.ShowWindow(SW_HIDE);
		m_StaffYear_Grid.ShowWindow(SW_HIDE);
		m_StaffYear_Grid1.ShowWindow(SW_HIDE);
		m_Staff_Grid.ShowWindow(SW_SHOW);
		m_Staff_Grid1.ShowWindow(SW_SHOW);
		m_Attend_Grid.ShowWindow(SW_HIDE);

		m_DepYear_Comfield.ShowWindow(SW_HIDE);
		m_Dep_Comfield.ShowWindow(SW_HIDE);
		m_StaffYear_Comfield.ShowWindow(SW_HIDE);
		m_Staff_Comfield.ShowWindow(SW_SHOW);
		m_Attend_Comfield.ShowWindow(SW_HIDE);

		m_DateStart.EnableWindow(true);
		m_DateEnd.EnableWindow(true);
		m_EdtCondition.SetWindowText("");

		sql.Format("select * from 员工工资明细汇总");
		srst.Open(sql,adCmdText);
		m_Staff_Grid.AddCellValue(srst);

		
	}
	if(sText=="员工考勤信息汇总")
	{
	   
		m_Text=sText;
		m_DepYear_Grid.ShowWindow(SW_HIDE);
		m_DepYear_Grid1.ShowWindow(SW_HIDE);
		m_Dep_Grid.ShowWindow(SW_HIDE);
		m_Dep_Grid1.ShowWindow(SW_HIDE);
		m_StaffYear_Grid.ShowWindow(SW_HIDE);
		m_StaffYear_Grid1.ShowWindow(SW_HIDE);
		m_Staff_Grid.ShowWindow(SW_HIDE);
		m_Staff_Grid1.ShowWindow(SW_HIDE);
		m_Attend_Grid.ShowWindow(SW_SHOW);

		m_DepYear_Comfield.ShowWindow(SW_HIDE);
		m_Dep_Comfield.ShowWindow(SW_HIDE);
		m_StaffYear_Comfield.ShowWindow(SW_HIDE);
		m_Staff_Comfield.ShowWindow(SW_HIDE);
		m_Attend_Comfield.ShowWindow(SW_SHOW);

		m_DateStart.EnableWindow(true);
		m_DateEnd.EnableWindow(true);
		m_EdtCondition.SetWindowText("");

		sql.Format("select * from 员工考勤视图");
		srst.Open(sql,adCmdText);
		m_Attend_Grid.AddCellValue(srst);

		
	}
}

void CDWagecollect::OnDblclkWagegrid1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	RxRecordset rRst;
	CString sSQL,sText,sText1,TableName;
	if(m_DepYear_Grid.GetHotItem()<0)
		return;
	m_HotItem=m_DepYear_Grid.GetHotItem();
	sText=this->m_DepYear_Grid.GetItemText(m_DepYear_Grid.GetHotItem(),0);
	sText1=this->m_DepYear_Grid.GetItemText(m_DepYear_Grid.GetHotItem(),1);
	sSQL.Format("select * from 部门工资明细汇总 where 所属部门='%s' and 工资所属年份='%s'",sText1,sText);
	rRst.Open(sSQL,adCmdText);
	m_DepYear_Grid1.AddCellValue(rRst);
	*pResult = 0;
}

void CDWagecollect::OnDblclkWagegrid2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	RxRecordset rRst;
	CString sSQL,sdep,syear,smonth,TableName;
	if(m_Dep_Grid.GetHotItem()<0)
		return;
	m_HotItem=m_Dep_Grid.GetHotItem();
	sdep=this->m_Dep_Grid.GetItemText(m_Dep_Grid.GetHotItem(),0);
	syear=this->m_Dep_Grid.GetItemText(m_Dep_Grid.GetHotItem(),1);
	smonth=this->m_Dep_Grid.GetItemText(m_Dep_Grid.GetHotItem(),3);
	sSQL.Format("select * from 员工工资汇总 where 所属部门='%s' and 工资所属年份='%s'and 工资所属月份='%s'",sdep,syear,smonth);
	rRst.Open(sSQL,adCmdText);
	m_Dep_Grid1.AddCellValue(rRst);
	*pResult = 0;
}

void CDWagecollect::OnDblclkWagegrid3(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	RxRecordset rRst;
	CString sSQL,sstaffID,syear,smonth,TableName;
	if(m_StaffYear_Grid.GetHotItem()<0)
		return;
	m_HotItem=m_StaffYear_Grid.GetHotItem();
	syear=this->m_StaffYear_Grid.GetItemText(m_StaffYear_Grid.GetHotItem(),0);
	sstaffID=this->m_StaffYear_Grid.GetItemText(m_StaffYear_Grid.GetHotItem(),1);
	sSQL.Format("select * from 员工工资明细汇总 where 工资所属年份='%s'and 员工编号='%s'",syear,sstaffID);
	rRst.Open(sSQL,adCmdText);
	m_StaffYear_Grid1.AddCellValue(rRst);
	*pResult = 0;
}

void CDWagecollect::OnDblclkWagegrid4(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	RxRecordset rRst;
	CString sSQL,sstaffID,syear,smonth,TableName;
	if(m_Staff_Grid.GetHotItem()<0)
		return;
	m_HotItem=m_Staff_Grid.GetHotItem();
	syear=this->m_Staff_Grid.GetItemText(m_Staff_Grid.GetHotItem(),0);
	smonth=this->m_Staff_Grid.GetItemText(m_Staff_Grid.GetHotItem(),1);
	sstaffID=this->m_Staff_Grid.GetItemText(m_Staff_Grid.GetHotItem(),2);
	sSQL.Format("select * from 工资视图 where 工资所属年份='%s'and 工资所属月份='%s' and 员工编号='%s'",syear,smonth,sstaffID);
	rRst.Open(sSQL,adCmdText);
	m_Staff_Grid1.AddCellValue(rRst);
	*pResult = 0;
}

void CDWagecollect::Init()
{
	RxRecordset rst1,rst2,rst3,rst4,rst5;
	m_ListCollect.InsertString(0,"部门工资年度汇总");
	m_ListCollect.InsertString(1,"部门工资汇总");
	m_ListCollect.InsertString(2,"员工工资年度汇总");
	m_ListCollect.InsertString(3,"员工工资汇总");
	m_ListCollect.InsertString(4,"员工考勤信息汇总");

	m_DepYear_Grid.ReadOnly(true);
	m_DepYear_Grid.SetDataBase("部门工资年度汇总",adCmdTable);
	m_Dep_Grid.ReadOnly(true);
	m_Dep_Grid.SetDataBase("部门工资明细汇总",adCmdTable);
	m_StaffYear_Grid.ReadOnly(true);
	m_StaffYear_Grid.SetDataBase("员工年度工资汇总",adCmdTable);
	m_Staff_Grid.ReadOnly(true);
	m_Staff_Grid.SetDataBase("员工工资明细汇总",adCmdTable);

	m_DepYear_Grid1.ReadOnly(true);
	m_DepYear_Grid1.SetDataBase("部门工资明细汇总",adCmdTable);
	m_DepYear_Grid1.DeleteAllItems();

	m_Dep_Grid1.ReadOnly(true);
	m_Dep_Grid1.SetDataBase("员工工资汇总",adCmdTable);
	m_Dep_Grid1.DeleteAllItems();

	m_StaffYear_Grid1.ReadOnly(true);
	m_StaffYear_Grid1.SetDataBase("员工工资明细汇总",adCmdTable);
	m_StaffYear_Grid1.DeleteAllItems();

	m_Staff_Grid1.ReadOnly(true);
	m_Staff_Grid1.SetDataBase("工资视图",adCmdTable);
	m_Staff_Grid1.DeleteAllItems();

	m_Attend_Grid.ReadOnly(true);
	m_Attend_Grid.SetDataBase("员工考勤视图",adCmdTable);

	rst1.Open("部门工资年度汇总");
	this->m_DepYear_Comfield.SetFieldset(rst1);
	this->m_DepYear_Comfield.InsertString(0,"工资所属年份");
	this->m_DepYear_Comfield.InsertString(1,"所属部门");	
	this->m_ComEmblem.SetCurSel(0);
	this->m_DepYear_Comfield.SetCurSel(0);

	


	rst2.Open("部门工资明细汇总");
	this->m_Dep_Comfield.SetFieldset(rst2);	
	this->m_Dep_Comfield.SetCurSel(0);
	this->m_Dep_Comfield.m_CurrentFieldType="字符型";

	
	rst3.Open("员工年度工资汇总");
	this->m_StaffYear_Comfield.SetFieldset(rst3);
	this->m_StaffYear_Comfield.SetCurSel(0);
	this->m_StaffYear_Comfield.m_CurrentFieldType="字符型";
	
	rst4.Open("员工工资明细汇总");
	this->m_Staff_Comfield.SetFieldset(rst4);
	this->m_Staff_Comfield.SetCurSel(0);
	this->m_Staff_Comfield.m_CurrentFieldType="字符型";
	
	rst5.Open("员工考勤视图");
	this->m_Attend_Comfield.SetFieldset(rst5);
	this->m_Attend_Comfield.SetCurSel(0);
	this->m_Attend_Comfield.m_CurrentFieldType="字符型";

	m_Dep_Grid.ShowWindow(SW_HIDE);
	m_Dep_Grid1.ShowWindow(SW_HIDE);
	m_StaffYear_Grid.ShowWindow(SW_HIDE);
	m_StaffYear_Grid1.ShowWindow(SW_HIDE);
	m_Staff_Grid.ShowWindow(SW_HIDE);
	m_Staff_Grid1.ShowWindow(SW_HIDE);
	m_Attend_Grid.ShowWindow(SW_HIDE);

	m_DepYear_Comfield.ShowWindow(SW_SHOW);
	m_Dep_Comfield.ShowWindow(SW_HIDE);
	m_StaffYear_Comfield.ShowWindow(SW_HIDE);
	m_Staff_Comfield.ShowWindow(SW_HIDE);
	m_Attend_Comfield.ShowWindow(SW_HIDE);


}

void CDWagecollect::OnBtnSel() 
{
	// TODO: Add your control notification handler code here
	//RxRecordset srst;
	CString sSQL,sField,sEmblem,sCondition,stime,syear,smonth,etime,eyear,emonth;
	CTime Starttime,Endtime;
	this->m_ComEmblem.GetWindowText(sEmblem);
	this->m_EdtCondition.GetWindowText(sCondition);

	if(m_Text.IsEmpty())
		m_Text="部门工资年度汇总";
	if(m_Text=="部门工资年度汇总")

⌨️ 快捷键说明

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