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

📄 comparesalenum.cpp

📁 关于客户关系管理系统的源码
💻 CPP
字号:
// CompareSaleNum.cpp : implementation file
//

#include "stdafx.h"
#include "ClientRelationship.h"
#include "CompareSaleNum.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCompareSaleNum dialog


CCompareSaleNum::CCompareSaleNum(CWnd* pParent /*=NULL*/)
	: CDialog(CCompareSaleNum::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCompareSaleNum)
	m_dateBegin = COleDateTime::GetCurrentTime();
	m_dateEnd = COleDateTime::GetCurrentTime();
	m_clientName = _T("");
	m_opponentName = _T("");
	m_summary = _T("");
	//}}AFX_DATA_INIT
}


void CCompareSaleNum::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCompareSaleNum)
	DDX_Control(pDX, IDC_opponentName, m_opponentNameCombo);
	DDX_Control(pDX, IDC_clientName, m_clientNameCombo);
	DDX_DateTimeCtrl(pDX, IDC_dateBegin, m_dateBegin);
	DDX_DateTimeCtrl(pDX, IDC_dateEnd, m_dateEnd);
	DDX_CBString(pDX, IDC_clientName, m_clientName);
	DDX_CBString(pDX, IDC_opponentName, m_opponentName);
	DDX_Text(pDX, IDC_EDIT1, m_summary);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCompareSaleNum, CDialog)
	//{{AFX_MSG_MAP(CCompareSaleNum)
	ON_BN_CLICKED(IDC_BUTTON1, OnAnalysis)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCompareSaleNum message handlers

void CCompareSaleNum::OnAnalysis() 
{
	UpdateData(true);
	CString strSQL;
	CString str;
	strSQL="exec clientSaleNum '";
	str.Format("%d-%d-%d",m_dateBegin.GetYear(),m_dateBegin.GetMonth(),m_dateBegin.GetDay());
	strSQL+=str+"','";
	str.Format("%d-%d-%d",m_dateEnd.GetYear(),m_dateEnd.GetMonth(),m_dateEnd.GetDay());
	strSQL+=str+"','"+m_clientName+"'";


	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));

	m_pRecordset=(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
	str=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num"));
	m_pRecordset->Close();

	m_summary="本公司交易次数为:"+str;

	strSQL="exec opponentSaleNum '";
	str.Format("%d-%d-%d",m_dateBegin.GetYear(),m_dateBegin.GetMonth(),m_dateBegin.GetDay());
	strSQL+=str+"','";
	str.Format("%d-%d-%d",m_dateEnd.GetYear(),m_dateEnd.GetMonth(),m_dateEnd.GetDay());
	strSQL+=str+"','"+m_opponentName+"'";
	m_pRecordset=(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
	str=((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num"));
	m_pRecordset->Close();
	m_summary+="    对手交易次数为:"+str;
	UpdateData(false);
	
}

BOOL CCompareSaleNum::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CString strSQL;
	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));	

	strSQL="select distinct clientName from client";	
				
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);
	int i=0;
	while(!(m_pRecordset->adoEOF))
	{
		m_clientNameCombo.InsertString(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientName")));
		m_pRecordset->MoveNext();
		i++;
	}
	m_pRecordset->Close();
	
	strSQL="select distinct opponentName from opponent";	
				
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);
	i=0;
	while(!(m_pRecordset->adoEOF))
	{
		m_opponentNameCombo.InsertString(i,((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("opponentName")));
		m_pRecordset->MoveNext();
		i++;
	}
	m_pRecordset->Close();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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