📄 dlgpr0002salary.cpp
字号:
// DlgPr0002Salary.cpp : implementation file
//
#include "stdafx.h"
#include "Kvip.h"
#include "DlgPr0002Salary.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgPr0002Salary
IMPLEMENT_DYNCREATE(CDlgPr0002Salary, CFormView)
CDlgPr0002Salary::CDlgPr0002Salary()
: CFormView(CDlgPr0002Salary::IDD)
{
//{{AFX_DATA_INIT(CDlgPr0002Salary)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pConnection = NULL;
m_pApp = NULL;
}
CDlgPr0002Salary::~CDlgPr0002Salary()
{
m_Report.DestroyWindow();
}
void CDlgPr0002Salary::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgPr0002Salary)
DDX_Control(pDX, IDC_CODE, m_edCode);
DDX_Control(pDX, IDC_UP, m_btUp);
DDX_Control(pDX, IDC_PRINT, m_btPrint);
DDX_Control(pDX, IDC_DOWN, m_btDown);
DDX_Control(pDX, IDC_DEP, m_Dep);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgPr0002Salary, CFormView)
//{{AFX_MSG_MAP(CDlgPr0002Salary)
ON_BN_CLICKED(IDC_RETRIEVE, OnRetrieve)
ON_BN_CLICKED(IDC_PRINT, OnPrint)
ON_BN_CLICKED(IDC_UP, OnUp)
ON_BN_CLICKED(IDC_CANCEL, OnCancel)
ON_BN_CLICKED(IDC_DOWN, OnDown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgPr0002Salary diagnostics
#ifdef _DEBUG
void CDlgPr0002Salary::AssertValid() const
{
CFormView::AssertValid();
}
void CDlgPr0002Salary::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDlgPr0002Salary message handlers
void CDlgPr0002Salary::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
// CMyMdi Mdi;
// Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
m_pApp = (CKvipApp *)AfxGetApp();
m_pConnection = m_pApp->m_pConWrite;
if(m_pConnection == NULL)
{
GetParent()->PostMessage(WM_CLOSE);
return ;
}
// TODO: Add your specialized code here and/or call the base class
//1装入部门
CString sSQL, sText;
sSQL = _T("Select sm_Dept From kv_staff_mr group by sm_dept");
m_RecordSet.SetAdoConnection(m_pConnection);
if(m_RecordSet.Open(sSQL))
{
while(m_RecordSet.IsEOF() == false)
{
m_RecordSet.GetCollect("sm_dept", sText);
m_Dep.AddString(sText);
m_RecordSet.MoveNext();
}
}
m_Dep.InsertString(0,"所有部门");
m_Dep.SetCurSel(0);
//2初始化搜索窗口
m_Report.Create(IDD_PR0002_SALARY_TX, this);
m_Report.m_Font.CreateFont(-12,0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,0,0,0,2,"宋体");
m_Report.SetConnect(m_pConnection);
m_Report.Init();
CRect rect;
rect = CRect(30, 80, 680, 420);
m_Report.MoveWindow(rect);
m_Report.SetDoubleRam(TRUE);
m_Report.ShowWindow(SW_SHOW);
m_Report.SetPageButton(&m_btUp, &m_btDown);
m_edCode.SetMask(_T("&#####"));
}
void CDlgPr0002Salary::OnRetrieve()
{
// TODO: Add your control notification handler code here
CString sCode , sDep = _T("");
CStringSQL sSQL;
//搜索
int i = m_Dep.GetCurSel();
if (i > 0)
m_Dep.GetLBText(i, sDep);
m_edCode.GetWindowText(sCode);
sSQL.SetSelect(_T("Select * From kv_staff_mr, kv_salary_log"));
sSQL.SetWhere("SM_CODE", sCode);
sSQL.SetWhere("SM_DEPT", sDep, false);
sSQL.SetWhere("SM_CODE", "SA_CODE", false, false);
if(m_Report.Retrieve(sSQL.GetSQL()+_T(" Order by sm_code, sm_dept")) == 0)
m_btPrint.EnableWindow(true);
}
void CDlgPr0002Salary::OnPrint()
{
// TODO: Add your control notification handler code here
m_Report.OnPrint("工资变动记录");
}
void CDlgPr0002Salary::OnCancel()
{
// TODO: Add your control notification handler code here
GetParent()->SendMessage(WM_CLOSE);
}
void CDlgPr0002Salary::OnUp()
{
// TODO: Add your control notification handler code here
m_Report.PageUp();
}
void CDlgPr0002Salary::OnDown()
{
// TODO: Add your control notification handler code here
m_Report.PageDown();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -