📄 numalarmdlg.cpp
字号:
// NumAlarmDlg.cpp : implementation file
#include "stdafx.h"
#include "Stock.h"
#include "NumAlarmDlg.h"
#include "COMDEF.H"
#include "Columns.h"
#include "Column.h"
#include "DialogResize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CNumAlarmDlg::CNumAlarmDlg(CWnd* pParent /*=NULL*/)
: CDialogResize(CNumAlarmDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNumAlarmDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNumAlarmDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogResize::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNumAlarmDlg)
DDX_Control(pDX, IDC_TYPE_COMBO, m_Type);
DDX_Control(pDX, IDC_ADODC1, m_adodc);
DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNumAlarmDlg, CDialogResize)
//{{AFX_MSG_MAP(CNumAlarmDlg)
ON_CBN_SELCHANGE(IDC_TYPE_COMBO, OnSelchangeTypeCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DLGRESIZE_MAP(CNumAlarmDlg)
DLGRESIZE_CONTROL(IDC_TYPE_COMBO, DLSZ_REPAINT)
DLGRESIZE_CONTROL(IDC_DATAGRID1, DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_REPAINT)
END_DLGRESIZE_MAP()
// CNumAlarmDlg message handlers
void CNumAlarmDlg::Refresh_Data()
{
CString cSource;
// 数量少于下线
if (m_Type.GetCurSel() == 0)
{
cSource = "SELECT p.Pname AS 产品名称, t.Total As 库存产品总数,";
cSource += " p.Plow As 数量下限, p.Plow - t.Total As 短线产品数量";
cSource += " FROM Product p, Total_Num t WHERE p.Pid=t.Pid And p.Plow > t.Total";
}
else
{
cSource = "SELECT p.Pname As 产品名称, t.Total As 库存产品总数,";
cSource += "p.Phigh As 数量上限, t.Total - p.Phigh As 超储产品数量";
cSource += " FROM Product p, Total_Num t WHERE p.Pid=t.Pid And p.Phigh < t.Total";
}
m_adodc.SetRecordSource(cSource);
m_adodc.Refresh();
// 设置表格列宽度
_variant_t vIndex;
vIndex = long(0);
m_datagrid.GetColumns().GetItem(vIndex).SetWidth(180);
vIndex = long(1);
m_datagrid.GetColumns().GetItem(vIndex).SetWidth(120);
vIndex = long(2);
m_datagrid.GetColumns().GetItem(vIndex).SetWidth(120);
vIndex = long(3);
m_datagrid.GetColumns().GetItem(vIndex).SetWidth(120);
}
BOOL CNumAlarmDlg::OnInitDialog()
{
CDialogResize::OnInitDialog();
InitResizing();
// 初始化类别组合框
m_Type.SetCurSel(0);
Refresh_Data();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CNumAlarmDlg::OnSelchangeTypeCombo()
{
Refresh_Data();
}
void CNumAlarmDlg::OnSize(UINT nType, int cx, int cy)
{
CDialogResize::OnSize(nType, cx, cy);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -