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

📄 stcheckdialog.cpp

📁 小型自选商场商品管理系统 要求:能对小型自选商场的商品进货、销售、库存等环节进行管理。主要有: 1)能记录每一笔进货
💻 CPP
字号:
// STCheckDialog.cpp : implementation file
//

#include "stdafx.h"
#include "ShopManage.h"
#include "STCheckDialog.h"
#include "DataManage.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern _RecordsetPtr Record1;
extern	_ConnectionPtr DataConn;
extern	_RecordsetPtr DataRecord;
extern	_CommandPtr Com;
/////////////////////////////////////////////////////////////////////////////
// STCheckDialog dialog


STCheckDialog::STCheckDialog(CWnd* pParent /*=NULL*/)
	: CDialog(STCheckDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(STCheckDialog)
	//}}AFX_DATA_INIT
}


void STCheckDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(STCheckDialog)
	DDX_Control(pDX, IDC_CheckInfo, m_Checkinfo);
	DDX_Control(pDX, IDC_GoodsUnit, m_Unit);
	DDX_Control(pDX, IDC_GoodsType, m_Type);
	DDX_Control(pDX, IDC_GoodsPrice, m_Price);
	DDX_Control(pDX, IDC_GoodsName, m_Name);
	DDX_Control(pDX, IDC_GoodsLeastCount, m_LeastCount);
	DDX_Control(pDX, IDC_GoodsID, m_GoodsID);
	DDX_Control(pDX, IDC_GoodsHome, m_Home);
	DDX_Control(pDX, IDC_GoodsCount, m_Count);
	DDX_Control(pDX, IDC_GoodsAigoRate, m_AigoRate);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(STCheckDialog, CDialog)
	//{{AFX_MSG_MAP(STCheckDialog)
	ON_BN_CLICKED(IDC_STclose, OnSTclose)
	ON_BN_CLICKED(IDC_STSearch, OnSTSearch)
	ON_WM_CLOSE()
	ON_COMMAND(SaleManCheck, OnSaleManCheck)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// STCheckDialog message handlers

void STCheckDialog::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

void STCheckDialog::OnSTclose() 
{
	// TODO: Add your control notification handler code here
	EndDialog(0);
}

void STCheckDialog::OnSTSearch() 
{
	// TODO: Add your control notification handler code here
	CString checkinfo = "";
	CString info[10];
	m_Checkinfo.GetWindowText(checkinfo);
	CString sql;
	CDataManage dm;
	/**********************************************************/
	if(checkinfo.GetLength() == 0)
	{
		MessageBox("请输入商品ID","提示");
		return;
	}
	/**********************************************************/
	sql.Format("select * from Storage where GoodsID=%s",checkinfo);
	try
	{
		dm.ConnectDataBase();
		Record1->Open(_variant_t("Storage"),
		_variant_t((IDispatch *)DataConn,true), adOpenKeyset,
		adLockOptimistic, adCmdTable);
	}
	catch (_com_error& e)
	{
		MessageBox(e.ErrorMessage(),"提示");
	}
	/*****************************************/
	try
	{
		dm.ExecSQL(sql);
		//this->MessageBox("操作成功","提示");
	}
	catch(_com_error &e)
	{
		this->MessageBox(e.ErrorMessage(),"出错提示");
	}
	Record1->raw_Close();
	//sql.Format("select StorageCount from Storage where GoodsID=%s",GoodsID);
	Record1->Open((_variant_t)sql,DataConn.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
	if(Record1->RecordCount > 0)
	{
		for(int i=0;i<9;i++)
		{
			info[i] = (TCHAR*)(_bstr_t)Record1->GetFields()->GetItem((long)i)->Value;
		}
	}
	else
	{
		MessageBox("对不起,库存中没有此种商品","提示");
		return;
	}
	m_GoodsID.SetWindowText(info[0]);
	m_Name.SetWindowText(info[1]);
	m_Type.SetWindowText(info[2]);
	m_Home.SetWindowText(info[3]);
	m_Unit.SetWindowText(info[4]);
	m_Price.SetWindowText(info[5]);
	m_AigoRate.SetWindowText(info[6]);
	m_Count.SetWindowText(info[7]);
	m_LeastCount.SetWindowText(info[8]);
	/*****************************************/
	m_Checkinfo.SetWindowText("");
}

void STCheckDialog::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	
	//CDialog::OnClose();
}

void STCheckDialog::OnSaleManCheck() 
{
	// TODO: Add your command handler code here
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -