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

📄 dlgcount.cpp

📁 1.解压后在sql2000中建立数据库flight,然后用本文件中的flight文件进行还原 2.数据库连接是用ADO实现的,如果更改连接,打开后对两个程序的ADOConn.cpp进行修改就行(t
💻 CPP
字号:
// DlgCount.cpp : implementation file
//

#include "stdafx.h"
#include "AirLine.h"
#include "DlgCount.h"
#include "ADOConn.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgCount dialog


CDlgCount::CDlgCount(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgCount::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgCount)
	m_back = _T("");
	m_order = _T("");
	m_take = _T("");
	m_total = _T("");
	//}}AFX_DATA_INIT
}


void CDlgCount::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgCount)
	DDX_Text(pDX, IDC_SBack, m_back);
	DDX_Text(pDX, IDC_SOrder, m_order);
	DDX_Text(pDX, IDC_STake, m_take);
	DDX_Text(pDX, IDC_STotal, m_total);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgCount, CDialog)
	//{{AFX_MSG_MAP(CDlgCount)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgCount message handlers

void CDlgCount::OnPaint() 
{

	CPaintDC dc(this); // device context for painting

}

BOOL CDlgCount::OnInitDialog() 
{
	CString strMessage;
	CTime m_date;
	m_date=CTime::GetCurrentTime();
	CString strDate;
	strDate=m_date.Format("%Y-%m-%d");
	CDialog::OnInitDialog();
	ADOConn adoConn;
	adoConn.OnInitADOConn();
	_RecordsetPtr m_pRs;
	_bstr_t vsql,wsql,ssql;
	vsql="select sum(金额) from accounts where 明细='订票' and 日期='"+strDate+"'";
	wsql="select sum(金额) from accounts where 明细='取票' and 日期='"+strDate+"'";
	ssql="select sum(金额) from accounts where 明细='退票' and 日期='"+strDate+"'";
	try{
		m_pRs=adoConn.GetRecordSet(vsql);
		if(!m_pRs->adoEOF)
			m_order=(LPCTSTR)(_bstr_t)m_pRs->GetCollect((long)0);
		else
			strMessage+="无订票  ";
		m_pRs=adoConn.GetRecordSet(wsql);
		if(!m_pRs->adoEOF)
			m_take=(LPCTSTR)(_bstr_t)m_pRs->GetCollect((long)0);
		else
			strMessage+="无取票  ";
		m_pRs=adoConn.GetRecordSet(ssql);
		if(!m_pRs->adoEOF)
			m_back=(LPCTSTR)(_bstr_t)m_pRs->GetCollect((long)0);
		else
			strMessage+="无退票  ";
	}catch(_com_error e){
		AfxMessageBox(e.Description());
	}
	adoConn.ExitConnect();
	if(strMessage!="")
		MessageBox(strMessage);
	SetDlgItemText(IDC_SOrder,m_order);
	SetDlgItemText(IDC_STake,m_take);
	SetDlgItemText(IDC_SBack,m_back);
	float f=atof(m_order)+atof(m_take)+atof(m_back);
	m_total.Format("%.2f",f);
	SetDlgItemText(IDC_STotal,m_total);
	// TODO: Add extra initialization here
	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 + -