📄 dholiday.cpp
字号:
// DHoliday.cpp : implementation file
//
#include "stdafx.h"
#include "Rsglxt.h"
#include "DHoliday.h"
#include "ExternDllHeader.h"
#include "DBaseQuery.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString Hman;
/////////////////////////////////////////////////////////////////////////////
// CDHoliday dialog
CDHoliday::CDHoliday(CWnd* pParent /*=NULL*/)
: CDialog(CDHoliday::IDD, pParent)
{
//{{AFX_DATA_INIT(CDHoliday)
//}}AFX_DATA_INIT
}
void CDHoliday::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDHoliday)
// DDX_Control(pDX, IDC_BTNSEL, m_Btnsel);
DDX_Control(pDX, IDC_LIST_GRID, m_Sql_Grid);
DDX_Control(pDX, IDC_EDTSTAFFNAME, m_Edtstaffname);
DDX_Control(pDX, IDC_EDTSTAFFID, m_EdtstaffID);
DDX_Control(pDX, IDC_COMSTAFFDEP, m_Comstaffdep);
DDX_Control(pDX, IDC_COMDept, m_Comdept);
DDX_Control(pDX, IDC_EDITHID, m_EdtHID);
DDX_Control(pDX, IDC_BUTUNDO, m_ButUndo);
DDX_Control(pDX, IDC_BUTSAVE, m_ButSave);
DDX_Control(pDX, IDC_BUTEXIT, m_ButExit);
DDX_Control(pDX, IDC_BUTDELE, m_ButDele);
DDX_Control(pDX, IDC_BUTCHANGE1, m_ButChange);
DDX_Control(pDX, IDC_BUTADD, m_ButAdd);
DDX_Control(pDX, IDC_COMCOUSE, m_ComCouse);
DDX_Control(pDX, IDC_DATAPP, m_DatApp);
DDX_Control(pDX, IDC_DATDES, m_DatDes);
DDX_Control(pDX, IDC_DATEND, m_DatEnd);
DDX_Control(pDX, IDC_DATSTA, m_DatSta);
DDX_Control(pDX, IDC_EDITREMARK, m_EdtRemark);
DDX_Control(pDX, IDC_EDITNAME, m_EdtName);
DDX_Control(pDX, IDC_EDITMAN, m_EdtMan);
DDX_Control(pDX, IDC_EDITID, m_EdtID);
DDX_Control(pDX, IDC_EDITHOLNUM, m_EdtHolnum);
DDX_Control(pDX, IDC_EDITHANDMAN, m_EdtHandleman);
DDX_Control(pDX, IDC_EDITDUTY, m_EdtDuty);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDHoliday, CDialog)
//{{AFX_MSG_MAP(CDHoliday)
ON_BN_CLICKED(IDC_BUTADD, OnButadd)
ON_BN_CLICKED(IDC_BUTCHANGE1, OnButchange1)
ON_BN_CLICKED(IDC_BUTDELE, OnButdele)
ON_BN_CLICKED(IDC_BUTSAVE, OnButsave)
ON_BN_CLICKED(IDC_BUTUNDO, OnButundo)
ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
ON_WM_PAINT()
ON_WM_CTLCOLOR()
ON_NOTIFY(NM_DBLCLK, IDC_LIST_GRID, OnDblclkListGrid)
ON_BN_CLICKED(IDC_BTNSEL, OnBtnsel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDHoliday message handlers
void CDHoliday::Display(CString sID)
{
if(sID.IsEmpty())
return;
CString sSQL;
RxRecordset drst;
sSQL.Format("SELECT * FROM 员工假期视图 WHERE 假期编号='%s'",sID);
drst.Open(sSQL,adCmdText);
if(drst.GetRecordCount()<1)
return;
CString sName,sSID,sDep,sSta,sDuty,sHolnum,sCouse,sEnd,sDes,sApp,sMan,sHandleman,sRemark;
sName=drst.GetFieldValue("员工姓名");
sSID=drst.GetFieldValue("员工编号");
sDep=drst.GetFieldValue("部门");
sDuty=drst.GetFieldValue("职务");
sHolnum=drst.GetFieldValue("请假天数");
sCouse=drst.GetFieldValue("请假原因");
CTime cSta,cEnd,cDes,cApp;
sSta=drst.GetFieldValue("起始日期");
cSta=CStringTOCTime(sSta);
sEnd=drst.GetFieldValue("结束日期");
cEnd=CStringTOCTime(sEnd);
sDes=drst.GetFieldValue("销假日期");
cDes=CStringTOCTime(sDes);
sApp=drst.GetFieldValue("批假日期");
cApp=CStringTOCTime(sApp);
sMan=drst.GetFieldValue("批准人");
sHandleman=drst.GetFieldValue("经手人");
sRemark=drst.GetFieldValue("备注");
m_EdtHID.SetWindowText(sID);
m_EdtID.SetWindowText(sSID);
m_EdtName.SetWindowText(sName);
m_Comdept.SetWindowText(sDep);
m_EdtDuty.SetWindowText(sDuty);
m_EdtMan.SetWindowText(sMan);
m_EdtHolnum.SetWindowText(sHolnum);
m_EdtHandleman.SetWindowText(sHandleman);
m_EdtRemark.SetWindowText(sRemark);
m_ComCouse.SetWindowText(sCouse);
this->m_DatApp.SetTime(&cApp);
this->m_DatDes.SetTime(&cDes);
this->m_DatSta.SetTime(&cSta);
this->m_DatEnd.SetTime(&cEnd);
m_EdtHID.SetColour(RGB(0,0,0));//设置编辑框边框颜色
m_EdtID.SetColour(RGB(0,0,0));
m_EdtName.SetColour(RGB(0,0,0));
// m_EdtDep.SetColour(RGB(0,0,0));
m_EdtDuty.SetColour(RGB(0,0,0));
m_EdtMan.SetColour(RGB(0,0,0));
m_EdtHolnum.SetColour(RGB(0,0,0));
m_EdtHandleman.SetColour(RGB(0,0,0));
m_EdtRemark.SetColour(RGB(0,0,0));
}
void CDHoliday::Enabled(bool bEnabled)
{
m_EdtRemark.EnableWindow(bEnabled);
m_EdtName.EnableWindow(bEnabled);
m_EdtID.EnableWindow(bEnabled);
m_Comdept.EnableWindow(bEnabled);
m_EdtDuty.EnableWindow(bEnabled);
m_EdtMan.EnableWindow(bEnabled);
m_EdtHolnum.EnableWindow(bEnabled);
m_EdtstaffID.EnableWindow(bEnabled);
m_Edtstaffname.EnableWindow(bEnabled);
m_Comstaffdep.EnableWindow(bEnabled);
m_Sql_Grid.EnableWindow(bEnabled);
m_DatApp.EnableWindow(bEnabled);
m_DatDes.EnableWindow(bEnabled);
m_DatSta.EnableWindow(bEnabled);
m_DatEnd.EnableWindow(bEnabled);
m_ComCouse.EnableWindow(bEnabled);
m_ButUndo.EnableWindow(bEnabled);
m_ButSave.EnableWindow(bEnabled);
m_ButExit.EnableWindow(!bEnabled);
m_ButDele.EnableWindow(!bEnabled);
m_ButChange.EnableWindow(!bEnabled);
m_ButAdd.EnableWindow(!bEnabled);
}
void CDHoliday::Clear()
{
m_EdtID.SetWindowText("");
// m_EdtDep.SetWindowText("");
m_EdtDuty.SetWindowText("");
m_EdtName.SetWindowText("");
m_EdtHolnum.SetWindowText("");
m_EdtMan.SetWindowText("");
m_EdtRemark.SetWindowText("");
}
void CDHoliday::OnButadd()
{
// TODO: Add your control notification handler code here
AddOrChange=1;
this->Enabled(true);
this->Clear();
CString NewID=ado.AutoNumber("HolidayInfo","Holiday_ID","HL",3);//Hl为英文字母首字母
m_EdtHID.SetWindowText(NewID);
m_EdtID.SetFocus();
}
void CDHoliday::OnButchange1()
{
// TODO: Add your control notification handler code here
AddOrChange=2;
this->Enabled(true);
m_EdtID.SetFocus();
}
void CDHoliday::OnButdele()
{
// TODO: Add your control notification handler code here
if(MessageBox("确定要删除此条记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
return;
CString sSQL;
sSQL.Format("DELETE FROM HolidayInfo WHERE Holiday_ID='%s'",m_sID);
RxRecordset Drst;
Drst.Open(sSQL,adCmdText);
this->OnCancel();
}
void CDHoliday::OnButsave()
{
// TODO: Add your control notification handler code here
if(MessageBox("确定要保存记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
return;
CString sSQL,sID,sName,sSID,sDep,sSta,sDuty,sHolnum,sCouse,sEnd,sDes,sApp,sMan,sHandleman,sRemark;
m_EdtHID.GetWindowText(sID);
m_EdtID.GetWindowText(sSID);
m_EdtName.GetWindowText(sName);
m_Comdept.GetWindowText(sDep);
m_EdtDuty.GetWindowText(sDuty);
m_EdtMan.GetWindowText(sMan);
m_EdtHolnum.GetWindowText(sHolnum);
// m_EdtHandleman.GetWindowText(sHandleman);
sHandleman=Hman;
m_EdtRemark.GetWindowText(sRemark);
m_ComCouse.GetWindowText(sCouse);
CTime cSta,cEnd,cDes,cApp;
m_DatApp.GetTime(cApp);
sApp=CTimeToCString(cApp);
m_DatDes.GetTime(cDes);
sDes=CTimeToCString(cDes);
m_DatSta.GetTime(cSta);
sSta=CTimeToCString(cSta);
m_DatEnd.GetTime(cEnd);
sEnd=CTimeToCString(cEnd);
if(sSID.IsEmpty())
{
MessageBox("员工编号不能为空,请输入员工编号。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
m_EdtID.SetFocus();
return;
}
if(sName.IsEmpty())
{
MessageBox("员工姓名不能为空,请输入员工姓名。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
m_EdtName.SetFocus();
return;
}
if(sDep.IsEmpty())
{
MessageBox("员工部门不能为空,请输入员工部门。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
m_Comdept.SetFocus();
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -