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

📄 dlgprworker.cpp

📁 用户管理系统
💻 CPP
字号:
// DlgPrWorker.cpp : implementation file
//

#include "stdafx.h"
#include "Kvip.h"
#include "DlgPrWorker.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgPrWorker
#include "DlgWkInputSel.H"


IMPLEMENT_DYNCREATE(CDlgPrWorker, CFormView)

CDlgPrWorker::CDlgPrWorker()
	: CFormView(CDlgPrWorker::IDD)
{
	//{{AFX_DATA_INIT(CDlgPrWorker)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_pConnection = NULL;
	m_pApp = NULL;

}

CDlgPrWorker::~CDlgPrWorker()
{
	m_Report.DestroyWindow();
}

void CDlgPrWorker::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgPrWorker)
	DDX_Control(pDX, IDC_PRINT, m_btPrint);
	DDX_Control(pDX, IDC_BODY, m_stGroup);
	DDX_Control(pDX, IDC_CODE, m_edCode);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgPrWorker, CFormView)
	//{{AFX_MSG_MAP(CDlgPrWorker)
	ON_BN_CLICKED(IDC_PRINT, OnPrint)
	ON_BN_CLICKED(IDC_RETRIEVE, OnRetrieve)
	ON_BN_CLICKED(IDC_CANCEL, OnCancel)
	ON_BN_CLICKED(IDC_SEARCH, OnSearch)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgPrWorker diagnostics

#ifdef _DEBUG
void CDlgPrWorker::AssertValid() const
{
	CFormView::AssertValid();
}

void CDlgPrWorker::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDlgPrWorker message handlers

void CDlgPrWorker::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
//1登记
	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 ;
	}
	m_Report.Create(IDD_PR_WORKER_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_edCode.SetMask(_T("&#####"));
}

void CDlgPrWorker::OnCancel() 
{
	// TODO: Add your control notification handler code here
  GetParent()->SendMessage(WM_CLOSE);	
}

void CDlgPrWorker::OnPrint() 
{
	// TODO: Add your control notification handler code here
  m_Report.OnPrint("员工报表");
}

void CDlgPrWorker::OnRetrieve() 
{
	// TODO: Add your control notification handler code here
  CString sCode	, sSQL;
//检测
  m_edCode.GetWindowText(sCode);
  if(sCode.GetLength() < 6 )
  {
	if(OnSearchA(true) == false) 
			return;
  }
//搜索
  m_edCode.GetWindowText(sCode);
  sSQL = _T("Select * From kv_staff_mr ");
  sSQL = sSQL + _T("Where sm_code = '") + sCode +_T("'");
  if(m_Report.Retrieve(sSQL) == 0)
	m_btPrint.EnableWindow(true);
}

void CDlgPrWorker::OnSearch() 
{
	OnSearchA();
}
BOOL CDlgPrWorker::OnSearchA(BOOL bAuto) 
{
	// TODO: Add your control notification handler code here
  CString strSQL = _T("");
  CString strCode, strText;
  CDlgWkInputSel Dlg;
  m_edCode.GetWindowText(strCode);
//多选窗口
	if(strCode.IsEmpty())
	{
	  Dlg.SetConnection(m_pConnection, false);
	}
	else
	{
	  strText.Format("=sm_code;TEXT=编号;WIDTH=60;INDEXCOL=10;DEFAULT=%s",strCode);
	  Dlg.SetSelect1(strText);
	  Dlg.SetConnection(m_pConnection, true);
	}
	Dlg.m_bRetrieve = (BOOL)bAuto;
	if (Dlg.DoModal() != IDOK) return false;
	strCode = Dlg.m_strSel1;
	m_edCode.SetWindowText(strCode);
	return true;
}

⌨️ 快捷键说明

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