statisticdialog.cpp

来自「VC+SQL SERVER 2000环境下开发的商品销售管理系统」· C++ 代码 · 共 128 行

CPP
128
字号
// StatisticDialog.cpp : 实现文件
//

#include "stdafx.h"
#include "SaleManager.h"
#include "StatisticDialog.h"
#include ".\statisticdialog.h"
#include "SaleListDialog.h"
#include "TotalSaleDialog.h"
#include "GoodsStockDialog.h"


IMPLEMENT_DYNAMIC(CStatisticDialog, CDialog)
CStatisticDialog::CStatisticDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CStatisticDialog::IDD, pParent)
{
}

CStatisticDialog::~CStatisticDialog()
{
}

void CStatisticDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_DATETIMEPICKER_STATISTICDATEFROM, m_StatisticDateFrom);
	DDX_Control(pDX, IDC_DATETIMEPICKERSTATISTICDATEFROM, m_StatisticDateTo);
}


BEGIN_MESSAGE_MAP(CStatisticDialog, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_SALELIST, OnBnClickedButtonSalelist)
	ON_BN_CLICKED(IDC_BUTTON_EXITSTATISTIC, OnBnClickedButtonExitstatistic)
	ON_BN_CLICKED(IDC_BUTTON_TOTALSELLLIST, OnBnClickedButtonTotalselllist)
	ON_BN_CLICKED(IDC_BUTTON_GOODSLIST, OnBnClickedButtonGoodslist)
END_MESSAGE_MAP()


// CStatisticDialog 消息处理程序

void CStatisticDialog::OnBnClickedButtonSalelist()
{
   	CTime timeFrom , timeTo;
	m_StatisticDateFrom.GetTime (timeFrom);
	m_StatisticDateTo.GetTime (timeTo);

	if(timeFrom.GetMonth () > timeTo.GetMonth ())
		return;

	if(timeFrom.GetMonth () == timeTo.GetMonth ())
		if(timeFrom.GetDay () > timeTo.GetDay ())
			return;

	CSaleListDialog dlg;
	CString  strValue;
	
	m_StatisticDateFrom.GetWindowText (strValue);
	dlg.m_StatisticDateFrom = strValue;
	m_StatisticDateTo.GetWindowText (strValue);
	dlg.m_StatisticDateTo = strValue;

	dlg.DoModal ();
}

void CStatisticDialog::OnBnClickedButtonExitstatistic()
{
	CDialog::OnCancel ();
}

BOOL CStatisticDialog::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_StatisticDateFrom.SetFormat ("yyyyMMdd");
	m_StatisticDateTo.SetFormat ("yyyyMMdd");
   
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void CStatisticDialog::OnBnClickedButtonTotalselllist()
{
	CTime timeFrom , timeTo;
	m_StatisticDateFrom.GetTime (timeFrom);
	m_StatisticDateTo.GetTime (timeTo);

	if(timeFrom.GetMonth () > timeTo.GetMonth ())
		return;

	if(timeFrom.GetMonth () == timeTo.GetMonth ())
		if(timeFrom.GetDay () > timeTo.GetDay ())
			return;
	
	CTotalSaleDialog dlg;
    CString  strValue;
	
	m_StatisticDateFrom.GetWindowText (strValue);
	dlg.m_StatisticDateFrom = strValue;
	m_StatisticDateTo.GetWindowText (strValue);
	dlg.m_StatisticDateTo = strValue;

	dlg.DoModal ();
}

void CStatisticDialog::OnBnClickedButtonGoodslist()
{
	CTime timeFrom , timeTo;
	m_StatisticDateFrom.GetTime (timeFrom);
	m_StatisticDateTo.GetTime (timeTo);

	if(timeFrom.GetMonth () > timeTo.GetMonth ())
		return;

	if(timeFrom.GetMonth () == timeTo.GetMonth ())
		if(timeFrom.GetDay () > timeTo.GetDay ())
			return;
	CGoodsStockDialog dlg;
    CString  strValue;
	
	m_StatisticDateFrom.GetWindowText (strValue);
	dlg.m_StatisticDateFrom = strValue;
	m_StatisticDateTo.GetWindowText (strValue);
	dlg.m_StatisticDateTo = strValue;

	dlg.DoModal ();

}

⌨️ 快捷键说明

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