📄 storeinmandlg.cpp
字号:
// StoreInManDlg.cpp : implementation file
#include "stdafx.h"
#include "Stock.h"
#include "StoreInManDlg.h"
#include "StoreInEditDlg.h"
#include "DialogResize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CStoreInManDlg::CStoreInManDlg(CWnd* pParent /*=NULL*/)
: CDialogResize(CStoreInManDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStoreInManDlg)
//}}AFX_DATA_INIT
}
void CStoreInManDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogResize::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, CDialogResize)
//{{AFX_MSG_MAP(CStoreInManDlg)
ON_COMMAND(IDC_STOREINMAN_ADD, OnAdd)
ON_COMMAND(IDC_STOREINMAN_CANCEL, OnCancel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DLGRESIZE_MAP(CStoreInManDlg)
DLGRESIZE_CONTROL(IDC_YEAR_COMBO, DLSZ_REPAINT)
DLGRESIZE_CONTROL(IDC_MONTH_COMBO, DLSZ_REPAINT)
DLGRESIZE_CONTROL(IDC_DATAGRID1, DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_REPAINT)
DLGRESIZE_CONTROL(IDC_STOREINMAN_ADD, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_STOREINMAN_CANCEL, DLSZ_MOVE_X | DLSZ_MOVE_Y)
END_DLGRESIZE_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()
{
CDialogResize::OnInitDialog();
InitResizing();
// 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::OnAdd()
{
CStoreInEditDlg dlg;
if (dlg.DoModal() == IDOK)
Refresh_Data();
}
void CStoreInManDlg::OnCancel()
{
CDialogResize::OnCancel();
}
void CStoreInManDlg::OnSize(UINT nType, int cx, int cy)
{
CDialogResize::OnSize(nType, cx, cy);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -