?? storeinmandlg.cpp
字號:
// StoreInManDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Stock.h"
#include "StoreInManDlg.h"
#include "StoreInEditDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStoreInManDlg dialog
CStoreInManDlg::CStoreInManDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStoreInManDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStoreInManDlg)
//}}AFX_DATA_INIT
}
void CStoreInManDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStoreInManDlg)
DDX_Control(pDX, IDC_YEAR_COMBO, m_year);
DDX_Control(pDX, IDC_MONTH_COMBO, m_month);
DDX_Control(pDX, IDC_ADODC1, m_adodc);
DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStoreInManDlg, CDialog)
//{{AFX_MSG_MAP(CStoreInManDlg)
ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStoreInManDlg message handlers
void CStoreInManDlg::Refresh_Data()
{
//讀取月份信息
CString cYear, cMonth;
int index;
index = m_year.GetCurSel();
m_year.GetLBText(index, cYear);
index = m_month.GetCurSel();
m_month.GetLBText(index, cMonth);
//設置SELECT語句
CString cSource;
cSource = "SELECT s.SiType AS 入庫類型, p.Pname AS 產品名稱, s.MakeDate AS 生產日期,";
cSource += " s.Pprice AS 單價, s.Pnum AS 數量, s.Pprice * s.Pnum AS 總價格,";
cSource += " c.Cname AS 客戶單位, sh.Sname AS 入庫倉庫, s.EmpName AS 經辦用戶,";
cSource += " s.OptDate AS 入庫日期 FROM StoreIn s, Product p, Client c, Storehouse sh";
cSource += " WHERE s.Pid*=p.Pid AND s.Cid*=c.Cid AND s.Sid*=sh.Sid";
cSource += " AND s.OptDate LIKE '%" + cYear + "-" + cMonth + "%'";
//設置記錄源
m_adodc.SetRecordSource(cSource);
m_adodc.Refresh();
}
BOOL CStoreInManDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CTime t = CTime::GetCurrentTime(); //讀取當前系統日期
int iYear, iMonth;
iYear = t.GetYear();
iMonth = t.GetMonth();
m_year.SetCurSel(iYear - 2000);
m_month.SetCurSel(iMonth - 1);
Refresh_Data();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStoreInManDlg::OnAddButton()
{
// TODO: Add your control notification handler code here
CStoreInEditDlg dlg;
if (dlg.DoModal() == IDOK)
Refresh_Data();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -