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

📄 earndlg.cpp

📁 这是一个功能相对完善的电脑报价管理系统 的一个例子
💻 CPP
字号:
// EarnDlg.cpp : implementation file
//

#include "stdafx.h"
#include "QuoteManage.h"
#include "EarnDlg.h"
#include "COMDEF.H"
#include "Columns.h"
#include "Column.h"
#include "_Recordset.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEarnDlg dialog


CEarnDlg::CEarnDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CEarnDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CEarnDlg)
	m_time = 0;
	//}}AFX_DATA_INIT
}


void CEarnDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CEarnDlg)
	DDX_Control(pDX, IDC_DATAGRID1, m_Datagrid);
	DDX_Control(pDX, IDC_ADODC1, m_Adodc);
	DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_time);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CEarnDlg, CDialog)
	//{{AFX_MSG_MAP(CEarnDlg)
	ON_BN_CLICKED(IDC_SEARCH_BUTTON, OnSearchButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEarnDlg message handlers

BOOL CEarnDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_time = CTime::GetCurrentTime();
	UpdateData(FALSE);

	RefreshData("");

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CEarnDlg::RefreshData(CString paraTime)
{
	UpdateData(TRUE);
	
	// 设置Select语句
	CString cSource;
	cSource = "SELECT c.Name AS 客户姓名, t.TId AS 装机编号, d.Num AS 配件总数,"
		" d.Total AS 总价 FROM TotalQuote AS t"
		" INNER JOIN CustomerInfo c ON t.CustomerId = c.CustomerId INNER JOIN"
		" (SELECT TId, ISNull(SUM(Num),0) AS Num, ISNULL(SUM(SubTotal),0) AS Total"
		" FROM DetailQuote GROUP BY TId) d"
		" ON t.TId = d.TId WHERE FitTime = '" + paraTime + "'";
	
	//刷新ADO Data控件的记录源
	m_Adodc.SetRecordSource(cSource);
	m_Adodc.Refresh();
	
	//设置列宽度
	_variant_t vIndex;
	vIndex = long(0);
	m_Datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
	vIndex = long(1);
	m_Datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
	vIndex = long(2);
	m_Datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
	vIndex = long(3);
	m_Datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
}

// 检索按钮
void CEarnDlg::OnSearchButton() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	
	CString cTime;
	cTime = m_time.Format("%Y-%m-%d");
	RefreshData(cTime);

	UpdateData(FALSE);
}

⌨️ 快捷键说明

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