⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storeinmandlg.cpp

📁 一个库存管理系统
💻 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 + -