?? report1dlg.cpp
字號:
// Report1Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "Stock.h"
#include "Report1Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReport1Dlg dialog
CReport1Dlg::CReport1Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CReport1Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReport1Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CReport1Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReport1Dlg)
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_DATACOMBO1, m_datacombo1);
DDX_Control(pDX, IDC_DATACOMBO2, m_datacombo2);
DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReport1Dlg, CDialog)
//{{AFX_MSG_MAP(CReport1Dlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReport1Dlg message handlers
void CReport1Dlg::Refresh_Data()
{
CString cTypeId;
if (m_datacombo2.GetBoundText() == "")
cTypeId = "0";
else
cTypeId = m_datacombo2.GetBoundText();
//生成SELECT語句
CString cSource;
cSource = "SELECT p.Pname AS 產品名稱,";
cSource += " v1.SumNum AS 入庫總量, v1.SumPrice AS 入庫總金額,";
cSource += " v2.SumNum AS 出庫總量, v2.SumPrice AS 出庫總金額,";
cSource += " v3.SumNum AS 庫存總量, p.PLow AS 庫存下限, p.PHigh AS 庫存上限";
cSource += " FROM (((Product p LEFT JOIN v_StoreIn v1 ON p.Pid=v1.Pid)";
cSource += " LEFT JOIN v_TakeOut v2 ON p.Pid=v2.Pid)";
cSource += " LEFT JOIN v_ProInStore v3 ON p.Pid=v3.Pid)";
cSource += " WHERE p.TypeId = " + cTypeId;
//設置數據源
m_adodc3.SetRecordSource(cSource);
m_adodc3.Refresh();
}
BEGIN_EVENTSINK_MAP(CReport1Dlg, CDialog)
//{{AFX_EVENTSINK_MAP(CReport1Dlg)
ON_EVENT(CReport1Dlg, IDC_DATACOMBO1, -600 /* Click */, OnClickDatacombo1, VTS_I2)
ON_EVENT(CReport1Dlg, IDC_DATACOMBO2, -600 /* Click */, OnClickDatacombo2, VTS_I2)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CReport1Dlg::OnClickDatacombo1(short Area)
{
CString cUpper;
cUpper = m_datacombo1.GetBoundText(); //讀取選擇類別的編號
if (cUpper == "")
cUpper = "0";
m_datacombo2.SetText("");
//設置二級類別的記錄源
m_adodc2.SetRecordSource("SELECT * FROM ProType WHERE UpperId=" + cUpper);
m_adodc2.Refresh();
//刷新表格
Refresh_Data();
}
void CReport1Dlg::OnClickDatacombo2(short Area)
{
//刷新表格
Refresh_Data();
}
BOOL CReport1Dlg::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
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -