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

📄 joinnotindutyformdlg.cpp

📁 VC++和ACCESS使用ADO连接
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// JoinNotInDutyFormDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ministryperson.h"
#include "JoinNotInDutyFormDlg.h"

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

#include "msword9.h"

/////////////////////////////////////////////////////////////////////////////
// JoinNotInDutyFormDlg dialog

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


void JoinNotInDutyFormDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(JoinNotInDutyFormDlg)
	DDX_Control(pDX, IDC_JOINNIDF_LIST5, m_JoinNIDF_CList5);
	DDX_Control(pDX, IDC_JOINNIDF_LIST10, m_JoinNIDF_CList10);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(JoinNotInDutyFormDlg, CDialog)
	//{{AFX_MSG_MAP(JoinNotInDutyFormDlg)
	ON_BN_CLICKED(IDC_JOINNIDF_BTN_CHECK, OnJoinnidfBtnCheck)
	ON_BN_CLICKED(IDC_JOINNIDF_BTN_SETPATH, OnJoinnidfBtnSetpath)
	ON_BN_CLICKED(IDC_JOINNIDF_BTN_TYPE, OnJoinnidfBtnType)
	ON_NOTIFY(NM_CLICK, IDC_JOINNIDF_LIST10, OnClickJoinnidfList10)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// JoinNotInDutyFormDlg message handlers

BOOL JoinNotInDutyFormDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	ShowRemainFiveDays();
	ShowRemainTenDays();
	InitSavePath();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

/*********************************************************************
函数说明:	  显示10天的
函数参数:	  
*********************************************************************/
void JoinNotInDutyFormDlg::ShowRemainTenDays()
{
	SetDlgItemText(IDC_JOINNIDF_BTN_CHECK, "检查遗漏");
	m_JoinNIDF_CList10.DeleteAllItems();
	for (int i = 9; i >= 0; i--)
	{
		m_JoinNIDF_CList10.DeleteColumn(i);
	}

	m_JoinNIDF_CList10.SetExtendedStyle(LVS_EX_FLATSB | 
									   LVS_EX_GRIDLINES | 
									   LVS_EX_FULLROWSELECT | 
									   LVS_EX_ONECLICKACTIVATE);
	m_JoinNIDF_CList10.InsertColumn(0, "编号", LVCFMT_LEFT, 40);
	m_JoinNIDF_CList10.InsertColumn(1, "身份证", LVCFMT_LEFT, 150);
	m_JoinNIDF_CList10.InsertColumn(2, "姓名", LVCFMT_LEFT, 60);
	m_JoinNIDF_CList10.InsertColumn(3, "单位", LVCFMT_LEFT, 122);
	m_JoinNIDF_CList10.InsertColumn(4, "部门", LVCFMT_LEFT, 120);
	m_JoinNIDF_CList10.InsertColumn(5, "职务", LVCFMT_LEFT, 80);
	m_JoinNIDF_CList10.InsertColumn(6, "学历", LVCFMT_LEFT, 80);
	m_JoinNIDF_CList10.InsertColumn(7, "专业", LVCFMT_LEFT, 120);
	m_JoinNIDF_CList10.InsertColumn(8, "职称", LVCFMT_LEFT, 90);
	m_JoinNIDF_CList10.InsertColumn(9, "入司时间", LVCFMT_LEFT, 110);

	SYSTEMTIME SysTime = {0};
	GetSystemTime(&SysTime);
	WORD wYear  = SysTime.wYear;
	WORD wMonth = SysTime.wMonth;
	WORD wDay   = SysTime.wDay;
	
	CString SQL;
	CString strFields[] = {"ID", "IDCard", "Name", "Company", "Depart", "Duty", "Diploma", "Special", "TechPost", "JoinTime"};	
	SQL.Format("select Employee_BasicInfor_Table.employee_ID as ID, \
					   Employee_BasicInfor_Table.employee_IDCard as IDCard, \
					   Employee_BasicInfor_Table.employee_Name as Name, \
					   Employee_BasicInfor_Table.employee_HighestDiploma as Diploma, \
					   Employee_BasicInfor_Table.employee_JoinTime as JoinTime, \
					   Employee_BasicInfor_Table.employee_TechPost as TechPost, \
					   Employee_InActiveSer_Table.InActiveSer_Company as Company, \
					   Employee_InActiveSer_Table.InActiveSer_Department as Depart, \
					   Employee_InActiveSer_Table.InActiveSer_Duty as Duty, \
					   Employee_TrainExpe_Table.TrainExpe_Speciality1 as Special \
				from Employee_BasicInfor_Table, Employee_InActiveSer_Table, Employee_TrainExpe_Table \
				where Employee_BasicInfor_Table.employee_ID = Employee_InActiveSer_Table.employee_ID and \
					  Employee_BasicInfor_Table.employee_ID = Employee_TrainExpe_Table.employee_ID and \
				      Employee_BasicInfor_Table.employee_IDCard = Employee_InActiveSer_Table.employee_IDCard and \
					  Employee_BasicInfor_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
					  Employee_InActiveSer_Table.InActiveSer_InDueFormTime >  #%d-%d-%d# and \
					  Employee_InActiveSer_Table.InActiveSer_InDueFormTime <  dateadd('d', 10, #%d-%d-%d#)", 
					  wYear, wMonth, wDay, wYear, wMonth, wDay);
	CADOOperation ADOdbo;
	ADOdbo.OpenRecordset(SQL);
	ADOdbo.GetFieldsToShow(strFields, 10, &m_JoinNIDF_CList10);
	ADOdbo.CloseRecorset();

	int nItemCount = m_JoinNIDF_CList10.GetItemCount();
	for (int n = 0; n < nItemCount; n++)
	{
		CString strFields[] = {"employee_ID", "employee_IDCard"};
		CString strRetValue[2];
		strRetValue[0] = "NOID";
		strRetValue[1] = "NOIDCard";

		SQL.Format("select employee_ID, employee_IDCard from CheckType_Table \
					where employee_ID = %d and employee_IDCard = '%s'", 
					atoi(m_JoinNIDF_CList10.GetItemText(n, 0)), 
					m_JoinNIDF_CList10.GetItemText(n, 1));
		ADOdbo.OpenRecordset(SQL);
		ADOdbo.GetFieldsValue(strFields, 2, strRetValue, FALSE);
		ADOdbo.CloseRecorset();

		if (strRetValue[0] == "NOID" && strRetValue[1] == "NOIDCard")
		{
			SQL.Format("insert into CheckType_Table values (%d, '%s', '%s', '%s', '%s')", 
				atoi(m_JoinNIDF_CList10.GetItemText(n, 0)), 
				m_JoinNIDF_CList10.GetItemText(n, 2),
				m_JoinNIDF_CList10.GetItemText(n, 1), "未打印3", "未打印1");
			ADOdbo.OpenRecordset(SQL);
			ADOdbo.CloseRecorset();
		}
	}	
}

/*********************************************************************
函数说明:	  显示5天的
函数参数:	  
*********************************************************************/
void JoinNotInDutyFormDlg::ShowRemainFiveDays()
{
	m_JoinNIDF_CList5.DeleteAllItems();
	for (int i = 9; i >= 0; i--)
	{
		m_JoinNIDF_CList5.DeleteColumn(i);
	}
	m_JoinNIDF_CList5.SetExtendedStyle(LVS_EX_FLATSB | 
									  LVS_EX_GRIDLINES | 
									  LVS_EX_FULLROWSELECT | 
									  LVS_EX_ONECLICKACTIVATE);
	m_JoinNIDF_CList5.InsertColumn(0, "编号", LVCFMT_LEFT, 40);
	m_JoinNIDF_CList5.InsertColumn(1, "身份证", LVCFMT_LEFT, 150);
	m_JoinNIDF_CList5.InsertColumn(2, "姓名", LVCFMT_LEFT, 60);
	m_JoinNIDF_CList5.InsertColumn(3, "单位", LVCFMT_LEFT, 122);
	m_JoinNIDF_CList5.InsertColumn(4, "部门", LVCFMT_LEFT, 120);
	m_JoinNIDF_CList5.InsertColumn(5, "职务", LVCFMT_LEFT, 80);
	m_JoinNIDF_CList5.InsertColumn(6, "学历", LVCFMT_LEFT, 80);
	m_JoinNIDF_CList5.InsertColumn(7, "专业", LVCFMT_LEFT, 120);
	m_JoinNIDF_CList5.InsertColumn(8, "职称", LVCFMT_LEFT, 90);
	m_JoinNIDF_CList5.InsertColumn(9, "入司时间", LVCFMT_LEFT, 110);

	SYSTEMTIME SysTime = {0};
	GetSystemTime(&SysTime);
	WORD wYear  = SysTime.wYear;
	WORD wMonth = SysTime.wMonth;
	WORD wDay   = SysTime.wDay;
	
	CString SQL;
	CString strFields[] = {"ID", "IDCard", "Name", "Company", "Depart", "Duty", "Diploma", "Special", "TechPost", "JoinTime"};	
	SQL.Format("select Employee_BasicInfor_Table.employee_ID as ID, \
					   Employee_BasicInfor_Table.employee_IDCard as IDCard, \
					   Employee_BasicInfor_Table.employee_Name as Name, \
					   Employee_BasicInfor_Table.employee_HighestDiploma as Diploma, \
					   Employee_BasicInfor_Table.employee_JoinTime as JoinTime, \
					   Employee_BasicInfor_Table.employee_TechPost as TechPost, \
					   Employee_InActiveSer_Table.InActiveSer_Company as Company, \
					   Employee_InActiveSer_Table.InActiveSer_Department as Depart, \
					   Employee_InActiveSer_Table.InActiveSer_Duty as Duty, \
					   Employee_TrainExpe_Table.TrainExpe_Speciality1 as Special \
				from Employee_BasicInfor_Table, Employee_InActiveSer_Table, Employee_TrainExpe_Table \
				where Employee_BasicInfor_Table.employee_ID = Employee_InActiveSer_Table.employee_ID and \
					  Employee_BasicInfor_Table.employee_ID = Employee_TrainExpe_Table.employee_ID and \
				      Employee_BasicInfor_Table.employee_IDCard = Employee_InActiveSer_Table.employee_IDCard and \
					  Employee_BasicInfor_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
					  Employee_InActiveSer_Table.InActiveSer_InDueFormTime >  #%d-%d-%d# and \
					  Employee_InActiveSer_Table.InActiveSer_InDueFormTime <  dateadd('d', 5, #%d-%d-%d#)",
					  wYear, wMonth, wDay, wYear, wMonth, wDay);
	CADOOperation ADOdbo;
	ADOdbo.OpenRecordset(SQL);
	ADOdbo.GetFieldsToShow(strFields, 10, &m_JoinNIDF_CList5);		
	ADOdbo.CloseRecorset();
}

/*********************************************************************
函数说明:	  检查遗漏的
函数参数:	  
*********************************************************************/
void JoinNotInDutyFormDlg::OnJoinnidfBtnCheck()
{
	CString strCap;
	GetDlgItemText(IDC_JOINNIDF_BTN_CHECK, strCap);
	if (strCap == "检查遗漏")
	{
		CheckIsThereNone();
		int nCount = m_JoinNIDF_CList10.GetItemCount();
		if (!nCount)
		{
			MessageBox("暂无打印遗漏的人员!\t", "提示", MB_OK | MB_ICONEXCLAMATION);		
		}
		else
		{
			SetDlgItemText(IDC_STATIC_YILOU, "以下为转正时间还剩三天或已过转正时间,但未打印转正审批表的人员");
		}
	}
	else
	{
		SetDlgItemText(IDC_STATIC_YILOU, "【十天内到转正时间的人员】");
		ShowRemainTenDays();
	}	
}

/*********************************************************************
函数说明:	  检查是否人遗漏的
函数参数:	  
*********************************************************************/
void JoinNotInDutyFormDlg::CheckIsThereNone()
{
	SetDlgItemText(IDC_JOINNIDF_BTN_CHECK, "十天内的");
	m_JoinNIDF_CList10.DeleteAllItems();
	for (int i = 9; i >= 0; i--)
	{
		m_JoinNIDF_CList10.DeleteColumn(i);
	}

	m_JoinNIDF_CList10.SetExtendedStyle(LVS_EX_FLATSB | 
									   LVS_EX_GRIDLINES | 
									   LVS_EX_FULLROWSELECT | 
									   LVS_EX_ONECLICKACTIVATE);
	m_JoinNIDF_CList10.InsertColumn(0, "编号", LVCFMT_LEFT, 40);
	m_JoinNIDF_CList10.InsertColumn(1, "身份证", LVCFMT_LEFT, 150);
	m_JoinNIDF_CList10.InsertColumn(2, "姓名", LVCFMT_LEFT, 60);
	m_JoinNIDF_CList10.InsertColumn(3, "单位", LVCFMT_LEFT, 122);

⌨️ 快捷键说明

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