?? report2dlg.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 + -