NumAlarmDlg.cpp
资源名称:SQLVC.rar [点击查看]
上传用户:biney012
上传日期:2022-05-09
资源大小:4592k
文件大小:3k
源码类别:
数据库系统
开发平台:
Visual C++
- // NumAlarmDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "Stock.h"
- #include "NumAlarmDlg.h"
- #include "COMDEF.H"
- #include "Columns.h"
- #include "Column.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CNumAlarmDlg dialog
- CNumAlarmDlg::CNumAlarmDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CNumAlarmDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CNumAlarmDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CNumAlarmDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::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, CDialog)
- //{{AFX_MSG_MAP(CNumAlarmDlg)
- ON_CBN_SELCHANGE(IDC_TYPE_COMBO, OnSelchangeTypeCombo)
- //}}AFX_MSG_MAP
- END_MESSAGE_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()
- {
- CDialog::OnInitDialog();
- //初始化类别组合框
- 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()
- {
- // TODO: Add your control notification handler code here
- Refresh_Data();
- }