📄 searchplusinfo.cpp
字号:
// SearchplusInfo.cpp : implementation file
//
#include "stdafx.h"
#include "Material_MIS.h"
#include "SearchplusInfo.h"
#include "Material_MISView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSearchplusInfo dialog
CSearchplusInfo::CSearchplusInfo(CWnd* pParent /*=NULL*/)
: CDialog(CSearchplusInfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CSearchplusInfo)
m_bCheckName = FALSE;
m_bCheckSpec = FALSE;
//}}AFX_DATA_INIT
}
void CSearchplusInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSearchplusInfo)
DDX_Check(pDX, IDC_YECHECK_NAME, m_bCheckName);
DDX_Check(pDX, IDC_YECHECK_SPEC, m_bCheckSpec);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSearchplusInfo, CDialog)
//{{AFX_MSG_MAP(CSearchplusInfo)
ON_CBN_SELCHANGE(IDC_COMB_YE_WZNAME, OnSelchangeCombYeWzname)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSearchplusInfo message handlers
void CSearchplusInfo::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
int index;
if ( !m_bCheckName && !m_bCheckSpec)
{
AfxMessageBox(_T("请选择查询条件!"), MB_ICONEXCLAMATION);
return;
}
if (m_bCheckName)
{
index = ((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->GetCurSel();
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->GetLBText(index,m_sName);
}
else
m_sName="%";
if( m_bCheckSpec)
{
index = ((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->GetCurSel();
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->GetLBText(index,m_sSpec);
}
else
m_sSpec="%";
_variant_t strQuery;
strQuery = "select * from ProductRemain where MapID like '"+m_sName+"' and Version like '"+m_sSpec+"'";
CMaterial_MISView* p = (CMaterial_MISView*)(((CMainFrame*)AfxGetMainWnd())->GetActiveView());
p->RefreshSurplus(strQuery);
CDialog::OnOK();
}
BOOL CSearchplusInfo::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(_T("产品余额查询"));
// TODO: Add extra initialization here
_variant_t strQuery, Holder;
int count,count2,i;
strQuery = "select distinct MapID from ProductRemain";
theApp.ADOExecute(theApp.m_pADOSet,strQuery);
count = theApp.m_pADOSet->GetRecordCount();
if(count>0)
{
theApp.m_pADOSet->MoveFirst();
Holder = theApp.m_pADOSet->GetCollect("MapID");
CString strName = Holder.bstrVal;
theApp.m_pADOSet->MoveFirst();
for(i = 0;i<count;i++)
{
Holder = theApp.m_pADOSet->GetCollect("MapID");
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->InsertString(i, Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
theApp.m_pADOSet->MoveNext();
}
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->SetCurSel(0);
strQuery = "select * from ProductRemain where MapID='"+strName+"'";
theApp.ADOExecute(theApp.m_pADOSet,strQuery);
count2 = theApp.m_pADOSet->GetRecordCount();
theApp.m_pADOSet->MoveFirst();
for(i = 0;i<count2;i++)
{
Holder = theApp.m_pADOSet->GetCollect("Version");
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->InsertString(i, Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
theApp.m_pADOSet->MoveNext();
}
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->SetCurSel(0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSearchplusInfo::OnSelchangeCombYeWzname()
{
// TODO: Add your control notification handler code here
int i,index,count,count2;
CString strText;
_variant_t strQuery, Holder;
index = ((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->GetCurSel();
if(index != CB_ERR)
{
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZNAME))->GetLBText(index,strText);
count2 = ((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->GetCount();
for(i = 0;i<count2;i++)
{
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->DeleteString(0);
}
strQuery = "select * from ProductRemain where MapID = '"+strText+"'";
theApp.ADOExecute(theApp.m_pADOSet,strQuery);
count = theApp.m_pADOSet->GetRecordCount();
theApp.m_pADOSet->MoveFirst();
for(i = 0;i<count;i++)
{
Holder = theApp.m_pADOSet->GetCollect("Version");
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->InsertString(i, Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
theApp.m_pADOSet->MoveNext();
}
((CComboBox*)GetDlgItem(IDC_COMB_YE_WZSPEC))->SetCurSel(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -