📄 funcpayprotectdlg.cpp
字号:
// FuncPayProtectDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ministryperson.h"
#include "FuncPayProtectDlg.h"
#include "excel9.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// FuncPayProtectDlg dialog
FuncPayProtectDlg::FuncPayProtectDlg(CWnd* pParent /*=NULL*/)
: CDialog(FuncPayProtectDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(FuncPayProtectDlg)
//}}AFX_DATA_INIT
}
void FuncPayProtectDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FuncPayProtectDlg)
DDX_Control(pDX, IDC_CHECK_SI_CONDITION, m_CBtn_Check);
DDX_Control(pDX, IDC_COMBO_SI_DEPART, m_ComboDepart);
DDX_Control(pDX, IDC_COMBO_SI_COMPANY, m_ComboCompany);
DDX_Control(pDX, IDC_FUNC_SI_INPOSLIST, m_ListCtrl_FuncPPL);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FuncPayProtectDlg, CDialog)
//{{AFX_MSG_MAP(FuncPayProtectDlg)
ON_MESSAGE(UM_LISTEDIT_DBCLICK, OnListEditDBClick)
ON_BN_CLICKED(IDC_BUTTON_SI_LOOK, OnButtonSiLook)
ON_CBN_SELCHANGE(IDC_COMBO_SI_COMPANY, OnSelchangeComboSiCompany)
ON_NOTIFY(NM_CLICK, IDC_FUNC_SI_INPOSLIST, OnClickFuncSiInposlist)
ON_BN_CLICKED(IDC_CHECK_SI_CONDITION, OnCheckSiCondition)
ON_BN_CLICKED(IDC_BTN_SI_PATH, OnBtnSiPath)
ON_BN_CLICKED(IDC_BTN_SI_EXCEL, OnBtnSiExcel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FuncPayProtectDlg message handlers
BOOL FuncPayProtectDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
InitCompComboBox(&m_ComboCompany);
MakeSelectInfo();
InitInExcelPath();
IDStateControl(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/*********************************************************************
函数说明: 清空数据表的显示
函数参数: void
*********************************************************************/
BOOL FuncPayProtectDlg::DeleteAllRows()
{
m_ListCtrl_FuncPPL.DeleteAllItems(); // 清空列表控件
return TRUE;
}
/*********************************************************************
函数说明: 设置列表控件一行的内容
函数参数:
*********************************************************************/
BOOL FuncPayProtectDlg::SetRow(int row, CString *strArray, int nCount)
{
m_ListCtrl_FuncPPL.InsertItem(row, strArray[0]); // 在列表控件中插入一行
for (int i = 1; i < nCount; i++)
{
m_ListCtrl_FuncPPL.SetItemText(row, i, strArray[i]); // 设置除第一行外的其他行
}
return TRUE;
}
/*********************************************************************
函数说明: 设置显示模式
函数参数:
*********************************************************************/
void FuncPayProtectDlg::MakeSelectInfo()
{
m_ListCtrl_FuncPPL.SetExtendedStyle(LVS_EX_FLATSB |
LVS_EX_GRIDLINES |
LVS_EX_FULLROWSELECT |
LVS_EX_ONECLICKACTIVATE);
m_ListCtrl_FuncPPL.InsertColumn(0, "单位", LVCFMT_LEFT, 150);
m_ListCtrl_FuncPPL.InsertColumn(1, "部门", LVCFMT_LEFT, 150);
m_ListCtrl_FuncPPL.InsertColumn(2, "职务", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(3, "职级", LVCFMT_LEFT, 60);
m_ListCtrl_FuncPPL.InsertColumn(4, "员工编号", LVCFMT_LEFT, 70);
m_ListCtrl_FuncPPL.InsertColumn(5, "姓名", LVCFMT_LEFT, 60);
m_ListCtrl_FuncPPL.InsertColumn(6, "性别", LVCFMT_LEFT, 50);
m_ListCtrl_FuncPPL.InsertColumn(7, "年龄", LVCFMT_LEFT, 50);
m_ListCtrl_FuncPPL.InsertColumn(8, "身份证号码", LVCFMT_LEFT, 150);
m_ListCtrl_FuncPPL.InsertColumn(9, "学历", LVCFMT_LEFT, 50);
m_ListCtrl_FuncPPL.InsertColumn(10, "学位", LVCFMT_LEFT, 50);
m_ListCtrl_FuncPPL.InsertColumn(11, "毕业院校", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(12, "专业", LVCFMT_LEFT, 110);
m_ListCtrl_FuncPPL.InsertColumn(13, "毕业时间", LVCFMT_LEFT, 90);
m_ListCtrl_FuncPPL.InsertColumn(14, "工作时间", LVCFMT_LEFT, 90);
m_ListCtrl_FuncPPL.InsertColumn(15, "工龄", LVCFMT_LEFT, 150);
m_ListCtrl_FuncPPL.InsertColumn(16, "入司时间", LVCFMT_LEFT, 90);
m_ListCtrl_FuncPPL.InsertColumn(17, "员工性质", LVCFMT_LEFT, 90);
m_ListCtrl_FuncPPL.InsertColumn(18, "现任职务类别", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(19, "员工类别", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(20, "资格认证", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(21, "家庭住址", LVCFMT_LEFT, 150);
m_ListCtrl_FuncPPL.InsertColumn(22, "联系电话", LVCFMT_LEFT, 100);
m_ListCtrl_FuncPPL.InsertColumn(23, "备注", LVCFMT_LEFT, 200);
}
/*********************************************************************
函数说明: “查看”按钮
函数参数:
*********************************************************************/
void FuncPayProtectDlg::OnButtonSiLook()
{
CString strQueryType;
CFuncOper FunOper;
if (!FunOper.CheckType_CComBox(this, IDC_COMBO_SI_QUERYTYPE, "一个【查询类别】\t", strQueryType))
{
return;
}
if (PrePareQueryType(m_CBtn_Check.GetCheck()))
{
QueryInPosInfo();
}
}
/*********************************************************************
函数说明: 检查条件并整理
函数参数: bMoreCondition 如果有[公司][部门]条件则为 TRUE
*********************************************************************/
BOOL FuncPayProtectDlg::PrePareQueryType(BOOL bMoreCondition)
{
CString strType;
GetDlgItemText(IDC_COMBO_SI_QUERYTYPE, strType);
m_strNameType = strType;
m_strNameCom = "";
m_strNameDepart = "";
if (bMoreCondition)
{
CString strCompany;
CString strDepart;
GetDlgItemText(IDC_COMBO_SI_COMPANY, strCompany);
GetDlgItemText(IDC_COMBO_SI_DEPART, strDepart);
m_strNameCom = strCompany;
m_strNameDepart = strDepart;
if (strCompany == "请选择已有的单位")
{
MessageBox("请选择一个单位做为查询条件\t", "提示", MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
else
{
if (strType == "所有")
{
if (strDepart == "请选择部门") // 公司做为条件
{
m_strSQL.Format("(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '在职' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '大龄返聘' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '退休留用' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s')", strCompany, strCompany, strCompany);
}
else // 公司和部门一起做条件
{
m_strSQL.Format("(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '在职' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Department = '%s') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '大龄返聘' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Department = '%s') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '退休留用' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Department = '%s')",
strCompany, strDepart, strCompany, strDepart, strCompany, strDepart);
}
}
else
{
if (strDepart == "请选择部门") // 公司做为条件
{
m_strSQL.Format("Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s'", strType, strCompany);
}
else // 公司和部门一起做条件
{
m_strSQL.Format("Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Company = '%s' and \
Employee_InActiveSer_Table.InActiveSer_Department = '%s'", strType, strCompany, strDepart);
}
}
}
}
else // 没有公司和部门做为条件
{
if (strType == "所有")
{
m_strSQL.Format("(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '在职') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '大龄返聘') or \
(Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '退休留用')");
}
else
{
m_strSQL.Format("Employee_InActiveSer_Table.employee_IDCard = Employee_BasicInfor_Table.employee_IDCard and \
Employee_InActiveSer_Table.employee_IDCard = Employee_TrainExpe_Table.employee_IDCard and \
Employee_InActiveSer_Table.InActiveSer_NewProperty = '%s'", strType);
}
}
return TRUE;
}
/*********************************************************************
函数说明: 有公司、部门条件
函数参数:
*********************************************************************/
void FuncPayProtectDlg::QueryInPosInfo()
{
CString SQL;
SQL.Format("select Employee_InActiveSer_Table.InActiveSer_Company as iaaa, \
Employee_InActiveSer_Table.InActiveSer_Department as ibbb, \
Employee_InActiveSer_Table.InActiveSer_Duty as iccc, \
Employee_InActiveSer_Table.InActiveSer_DutyLevel as iddd, \
Employee_BasicInfor_Table.employee_ID as bID, \
Employee_BasicInfor_Table.employee_Name as baaa, \
Employee_BasicInfor_Table.employee_Sex as bbbb, \
Employee_BasicInfor_Table.employee_Age as bccc, \
Employee_BasicInfor_Table.employee_IDCard as bddd, \
Employee_BasicInfor_Table.employee_HighestDiploma as beee, \
Employee_TrainExpe_Table.TrainExpe_Diploma1 as taaa, \
Employee_BasicInfor_Table.employee_GraduateSchool as bfff, \
Employee_TrainExpe_Table.TrainExpe_Speciality1 as tbbb, \
Employee_TrainExpe_Table.TrainExpe_StuEndTime1 as tccc, \
Employee_BasicInfor_Table.employee_FirstJobTime as bggg, \
Employee_InActiveSer_Table.InActiveSer_WorkAge as ieee, \
Employee_BasicInfor_Table.employee_JoinTime as bhhh, \
Employee_InActiveSer_Table.InActiveSer_EmployPro as ifff, \
Employee_BasicInfor_Table.employee_JobPosition as biii, \
Employee_InActiveSer_Table.InActiveSer_EmployType as iggg, \
Employee_BasicInfor_Table.employee_Accreditation as bjjj, \
Employee_BasicInfor_Table.employee_Address as bkkk, \
Employee_BasicInfor_Table.employee_MobilePhone as blll, \
Employee_BasicInfor_Table.employee_Remark as bmmm \
from Employee_InActiveSer_Table, Employee_BasicInfor_Table, Employee_TrainExpe_Table \
where %s order by Employee_InActiveSer_Table.InActiveSer_Company, \
Employee_InActiveSer_Table.InActiveSer_Department", m_strSQL);
CADOOperation ADOdbo;
CString strFields[] = {"iaaa", "ibbb", "iccc", "iddd",
"bID", "baaa", "bbbb", "bccc", "bddd", "beee",
"taaa", "bfff", "tbbb", "tccc", "bggg", "ieee", "bhhh", "ifff", "biii", "iggg",
"bjjj", "bkkk", "blll", "bmmm"};
ADOdbo.OpenRecordset(SQL);
ADOdbo.ShowADOView(strFields, 24, this);
ADOdbo.CloseRecorset();
}
/*********************************************************************
函数说明: 显示“单位”组合框内容
函数参数:
*********************************************************************/
void FuncPayProtectDlg::InitCompComboBox(CComboBox *pComp)
{
CADOOperation ADOdbo;
CString strComp;
ADOdbo.OpenTable("Search_Table"); // 打开“搜索”表
if (ADOdbo.IsLastRow())
{
ADOdbo.CloseTable();
return;
}
// 得到单位名
pComp->ResetContent();
pComp->AddString("请选择已有的单位");
ADOdbo.MoveFirst();
ADOdbo.GetItemContentStr("Search_Company", CADOOperation::ADO_TYPE_STRING, &strComp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -