📄 zongtcxdlg.cpp
字号:
// Zongtcxdlg.cpp : implementation file
//
#include "stdafx.h"
#include "GZGLXT.h"
#include "Zongtcxdlg.h"
#include "Column.h"
#include "Columns.h"
#include "COMDEF.H"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CZongtcxdlg dialog
CZongtcxdlg::CZongtcxdlg(CWnd* pParent /*=NULL*/)
: CDialog(CZongtcxdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CZongtcxdlg)
m_check1 = FALSE;
m_check2 = FALSE;
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDI_ZTCXICON);
}
void CZongtcxdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CZongtcxdlg)
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_time);
DDX_Control(pDX, IDC_ADODC1, m_ad);
DDX_Control(pDX, IDC_DATACOMBO1, m_dc);
DDX_Control(pDX, IDC_DATAGRID1, m_da);
DDX_Check(pDX, IDC_CHECK1, m_check1);
DDX_Check(pDX, IDC_CHECK2, m_check2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CZongtcxdlg, CDialog)
//{{AFX_MSG_MAP(CZongtcxdlg)
ON_BN_CLICKED(IDC_CHAXUN, OnChaxun)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CZongtcxdlg message handlers
BOOL CZongtcxdlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(m_hIcon, TRUE);
//设置复选框初始化显示
m_check1=TRUE;
m_check2=TRUE;
UpdateData(false);
//设置DataGrid控件各列显示的长度
_variant_t vIndex;
vIndex=long(0);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(1);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(2);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(3);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(4);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(5);
m_da.GetColumns().GetItem(vIndex).SetWidth(75);
vIndex=long(6);
m_da.GetColumns().GetItem(vIndex).SetWidth(75);
vIndex=long(7);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(8);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(9);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(10);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(11);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(12);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(13);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(14);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(15);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(16);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(17);
m_da.GetColumns().GetItem(vIndex).SetWidth(120);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CZongtcxdlg::OnChaxun()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CString str;
//读取DataCombo控件中文本
str=m_dc.GetText();
CString date;
CTime temp;
m_time.GetTime(temp);
//读取当前Date Time控件的月份
int m;
m = temp.GetMonth();
//读取当前Date Time控件的年份
int y;
y=temp.GetYear();
CString stry;
stry.Format("%d",y);
CString strm;
strm.Format("%d",m);
if(check2==0)
m_ad.SetRecordSource("SELECT YGid AS 员工编号,YGxm AS 员工姓名,JBgz AS 基本工资,GLgz AS 工龄工资,ZWgz AS 职务工资,YLbxj AS 养老保险金,GRsds AS 个人所得税,SHbz AS 生活补助,ZFbz AS 住房补助,BXf AS 保险费,JiaBts AS 加班天数,JiaBgz AS 加班工资,SJts AS 事假天数,SJkk AS 事假扣款,YFje AS 应发金额,SFje AS 实发金额,Yu_E AS 余额,SJian AS 时间 FROM Gzffmxb where YGid='"+str+"' ");
else if(check==0)
//不选择员工编号时查询
m_ad.SetRecordSource("SELECT YGid AS 员工编号,YGxm AS 员工姓名,JBgz AS 基本工资,GLgz AS 工龄工资,ZWgz AS 职务工资,YLbxj AS 养老保险金,GRsds AS 个人所得税,SHbz AS 生活补助,ZFbz AS 住房补助,BXf AS 保险费,JiaBts AS 加班天数,JiaBgz AS 加班工资,SJts AS 事假天数,SJkk AS 事假扣款,YFje AS 应发金额,SFje AS 实发金额,Yu_E AS 余额,SJian AS 时间 FROM Gzffmxb where year(sjian)="+stry+" and month(sjian)="+strm+" ");
else
//选择员工编号时查询
m_ad.SetRecordSource("SELECT YGid AS 员工编号,YGxm AS 员工姓名,JBgz AS 基本工资,GLgz AS 工龄工资,ZWgz AS 职务工资,YLbxj AS 养老保险金,GRsds AS 个人所得税,SHbz AS 生活补助,ZFbz AS 住房补助,BXf AS 保险费,JiaBts AS 加班天数,JiaBgz AS 加班工资,SJts AS 事假天数,SJkk AS 事假扣款,YFje AS 应发金额,SFje AS 实发金额,Yu_E AS 余额,SJian AS 时间 FROM Gzffmxb where YGid='"+str+"' and year(sjian)="+stry+" and month(sjian)="+strm+" ");
m_ad.Refresh();
_variant_t vIndex;
vIndex=long(0);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(1);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(2);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(3);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(4);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(5);
m_da.GetColumns().GetItem(vIndex).SetWidth(75);
vIndex=long(6);
m_da.GetColumns().GetItem(vIndex).SetWidth(75);
vIndex=long(7);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(8);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(9);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(10);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(11);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(12);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(13);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(14);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(15);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(16);
m_da.GetColumns().GetItem(vIndex).SetWidth(60);
vIndex=long(17);
m_da.GetColumns().GetItem(vIndex).SetWidth(120);
}
void CZongtcxdlg::OnOK()
{
// TODO: Add extra validation here
CTime temp;
m_time.GetTime(temp);
int m;
m = temp.GetMonth();
int y;
y=temp.GetYear();
CString stry;
stry.Format("%d",y);
CString strm;
strm.Format("%d",m);
m_ad.SetRecordSource("SELECT sum(sfje) AS 公司本月发放工资总额 from Gzffmxb where year(sjian)="+stry+" and month(sjian)="+strm+"");
m_ad.Refresh();
//CDialog::OnOK();
}
void CZongtcxdlg::OnCheck1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_check1==TRUE)
check=1;
else
check=0;
UpdateData(false);
}
void CZongtcxdlg::OnCheck2()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_check2==TRUE)
check2=1;
else
check2=0;
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -