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

📄 report2dlg.cpp

📁 采用C++实现库存管理信息系统。包括基本信息管理
💻 CPP
字号:
// Report2Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "Stock.h"
#include "Report2Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CReport2Dlg dialog


CReport2Dlg::CReport2Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReport2Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReport2Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CReport2Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReport2Dlg)
	DDX_Control(pDX, IDC_ADODC1, m_adodc1);
	DDX_Control(pDX, IDC_ADODC2, m_adodc2);
	DDX_Control(pDX, IDC_ADODC3, m_adodc3);
	DDX_Control(pDX, IDC_ADODC5, m_adodc5);
	DDX_Control(pDX, IDC_DATACOMBO1, m_datacombo1);
	DDX_Control(pDX, IDC_DATACOMBO3, m_datacombo3);
	DDX_Control(pDX, IDC_DATACOMBO2, m_datacombo2);
	DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReport2Dlg, CDialog)
	//{{AFX_MSG_MAP(CReport2Dlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReport2Dlg message handlers
void CReport2Dlg::Refresh_Data()
{
	CString cPid;
	cPid = m_datacombo3.GetBoundText();
	if (cPid == "")
		cPid = "0";
	//生成SELECT语句
	CString cSource;
	cSource = "SELECT r.SiType As 入出库类型, p.Pname As 产品名称, r.Pprice As 产品单价,";
    cSource += " r.Pnum As 产品数量, r.Amount As 总金额, c.Cname As 客户单位, s.Sname As 存放仓库,";
    cSource += " r.EmpName As 经办人, r.OptDate As 入出库日期"; 
    cSource += " FROM Report2 r, Product p, Client c, Storehouse s";
    cSource += " WHERE r.Pid=p.Pid AND r.Cid=c.Cid AND";
    cSource += " r.Sid=s.Sid AND p.Pid=" + cPid;
    //设置记录源
	m_adodc3.SetRecordSource(cSource);
	m_adodc3.Refresh();
}



BOOL CReport2Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	Refresh_Data();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BEGIN_EVENTSINK_MAP(CReport2Dlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CReport2Dlg)
	ON_EVENT(CReport2Dlg, IDC_DATACOMBO1, -600 /* Click */, OnClickDatacombo1, VTS_I2)
	ON_EVENT(CReport2Dlg, IDC_DATACOMBO2, -600 /* Click */, OnClickDatacombo2, VTS_I2)
	ON_EVENT(CReport2Dlg, IDC_DATACOMBO3, -600 /* Click */, OnClickDatacombo3, VTS_I2)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CReport2Dlg::OnClickDatacombo1(short Area) 
{
	//读取一级产品类别编号
	CString cUpperId;
	cUpperId = m_datacombo1.GetBoundText();
	if (cUpperId == "")
		cUpperId = "0";
	//设置查询二级产品类型的SELECT语句
	CString cSource;
	cSource = "SELECT * FROM ProType WHERE UpperId=" + cUpperId;

	m_datacombo2.SetText("");
	//设置m_adodc3,从而刷新二级产品类别的列表
	m_adodc2.SetRecordSource(cSource);
	m_adodc2.Refresh();		
	//设置产品列表框,因为没有选中二级产品类别,所以要清空产品列表框
	cSource = "SELECT * FROM Product WHERE TypeId=0";

	m_datacombo3.SetText("");
	//设置m_adodc5,从而刷新产品的列表
	m_adodc5.SetRecordSource(cSource);
	m_adodc5.Refresh();
	//刷新库存产品表格
	Refresh_Data();	
}

void CReport2Dlg::OnClickDatacombo2(short Area) 
{
	//读取二级产品类别编号
	CString cTypeId;
	cTypeId = m_datacombo2.GetBoundText();
	if (cTypeId == "")
		cTypeId = "0";
	//设置查询二级产品类型的SELECT语句
	CString cSource;
	cSource = "SELECT * FROM Product WHERE TypeId=" + cTypeId;

	m_datacombo3.SetText("");
	//设置m_adodc5,从而刷新产品的列表
	m_adodc5.SetRecordSource(cSource);
	m_adodc5.Refresh();		
	//刷新库存产品表格
	Refresh_Data();		
}

void CReport2Dlg::OnClickDatacombo3(short Area) 
{
	Refresh_Data();	
}

⌨️ 快捷键说明

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