网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 交易代码 > 课程设计 > 正文

VC++6.0商品库存管理信息系统源代码

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务
VC++6.0商品库存管理信息系统源代码
本论文站仅贴出部分代码,需要全部代码的请联系站长QQ,谢谢
// DUser.cpp : implementation file//
#include "stdafx.h"#include "商品库存管理系统.h"#include "DUser.h"
#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endifextern _ConnectionPtr cnn;extern CMyApp theApp;/////////////////////////////////////////////////////////////////////////////// CDUser dialog
CDUser::CDUser(CWnd* pParent /*=NULL*/) : CDialog(CDUser::IDD, pParent){ //{{AFX_DATA_INIT(CDUser) //}}AFX_DATA_INIT}
void CDUser::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDUser) DDX_Control(pDX, IDC_LIST1, m_List); DDX_Control(pDX, IDC_EDTPassward, m_EdtPassWard); DDX_Control(pDX, IDC_EdtName2, m_EdtName); DDX_Control(pDX, IDC_EdtID, m_EdtID); DDX_Control(pDX, IDC_EDTAffirmPsd, m_EdtAffirmPsd); DDX_Control(pDX, IDC_BUTUndo, m_ButUndo); DDX_Control(pDX, IDC_BUTSave, m_ButSave); DDX_Control(pDX, IDC_BUTExit, m_ButExit); DDX_Control(pDX, IDC_BUTDele, m_BueDele); DDX_Control(pDX, IDC_BUTChange, m_ButChange); DDX_Control(pDX, IDC_BUTAdd, m_ButAdd); //}}AFX_DATA_MAP}
BEGIN_MESSAGE_MAP(CDUser, CDialog) //{{AFX_MSG_MAP(CDUser) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList) ON_BN_CLICKED(IDC_BUTAdd, OnBUTAdd) ON_BN_CLICKED(IDC_BUTChange, OnBUTChange) ON_BN_CLICKED(IDC_BUTDele, OnBUTDele) ON_BN_CLICKED(IDC_BUTUndo, OnBUTUndo) ON_BN_CLICKED(IDC_BUTSave, OnBUTSave) ON_BN_CLICKED(IDC_BUTExit, OnBUTExit) //}}AFX_MSG_MAPEND_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////// CDUser message handlers
void CDUser::OnOK() { // TODO: Add extra validation here  //CDialog::OnOK();}
BOOL CDUser::OnInitDialog() { CDialog::OnInitDialog(); rst.CreateInstance((__uuidof(Recordset))); rst=cnn->Execute(L"用户信息表",NULL,adCmdTable); if(theApp.GetRecordCount(rst)>0) {  m_List.SetRecordset(rst,"用户名");  } return TRUE;  // return TRUE unless you set the focus to a control               // EXCEPTION: OCX Property Pages should return FALSE}
void CDUser::Display(CString sFieldvalue){ if(sFieldvalue.IsEmpty())  return; CString sSQL,sID,sPassWard; _RecordsetPtr DispRst; DispRst.CreateInstance(__uuidof(Recordset)); sSQL.Format("SELECT * FROM 用户信息表 WHERE 用户名='%s'",sFieldvalue); DispRst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText); if(theApp.GetRecordCount(DispRst)>0) {  DispRst->MoveFirst();  sID=((char*)(_bstr_t)DispRst->GetCollect("编号"));  _variant_t psd=DispRst->GetCollect("密码");  if(psd.vt==VT_EMPTY)   sPassWard="";  else   sPassWard=(char*)(_bstr_t)psd;  } m_EdtID.SetWindowText(sID); m_EdtName.SetWindowText(sFieldvalue); m_EdtPassWard.SetWindowText(sPassWard); m_EdtAffirmPsd.SetWindowText(sPassWard);}
void CDUser::OnSelchangeList() { CString sName; m_List.GetText(m_List.GetCurSel(),sName); this->Display(sName); }
void CDUser::Enabled(bool bEnabled){ m_List.EnableWindow(!bEnabled); m_EdtPassWard.EnableWindow(bEnabled); m_EdtName.EnableWindow(bEnabled); m_EdtAffirmPsd.EnableWindow(bEnabled); m_ButUndo.EnableWindow(bEnabled); m_ButSave.EnableWindow(bEnabled); m_ButExit.EnableWindow(!bEnabled); m_BueDele.EnableWindow(!bEnabled); m_ButChange.EnableWindow(!bEnabled); m_ButAdd.EnableWindow(!bEnabled); }
void CDUser::ClearFrom(){ m_EdtID.SetWindowText(""); m_EdtPassWard.SetWindowText(""); m_EdtName.SetWindowText(""); m_EdtAffirmPsd.SetWindowText("");}
void CDUser::OnBUTAdd() { CString sNewID; this->ClearFrom(); int nNewID=theApp.AutoNumber(0,"用户信息表"); sNewID.Format("%d",nNewID); m_EdtID.SetWindowText(sNewID); this->Enabled(true); this->m_EdtName.SetFocus(); this->AddOrChange=true; }
void CDUser::OnBUTChange() { this->Enabled(true); this->m_EdtName.SetFocus(); this->AddOrChange=false;  }
void CDUser::OnBUTDele() { CString ID,sSQL; this->m_EdtID.GetWindowText(ID); if(ID.IsEmpty()==false) {  int a=MessageBox("确定要删除此条记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION);  if (a==1)  {   CString sSQL;   sSQL.Format("DELETE FROM 用户信息表 WHERE 编号=%s",ID);   try{   cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);   }   catch(...)   {    MessageBox("删除记录失败!","系统提示",MB_OK|MB_ICONSTOP);    return;   }   this->Enabled(false);   this->ClearFrom();   this->m_List.UpDating();  } } else {  MessageBox("请选择一条记录!","系统提示",MB_OK|MB_ICONSTOP); } }
void CDUser::OnBUTUndo() { CString sName; this->ClearFrom(); if(sName.IsEmpty())  goto end; m_List.GetText(m_List.GetCurSel(),sName); this->Display(sName);end: this->Enabled(false);}
void CDUser::OnBUTSave() { int a=MessageBox("确定保存记录吗?","系统提示",MB_ICONQUESTION|MB_OKCANCEL); if(a==1) {  CString sSQL,sID,sName,sPassWard,sAffirmPsd;  m_EdtID.GetWindowText(sID);  m_EdtName.GetWindowText(sName);  m_EdtPassWard.GetWindowText(sPassWard);  m_EdtAffirmPsd.GetWindowText(sAffirmPsd);  if(sPassWard!=sAffirmPsd)  {   MessageBox("两次输入的密码不一致!","系统提示",MB_OK|MB_ICONSTOP);   m_EdtAffirmPsd.SetWindowText("");   m_EdtAffirmPsd.SetFocus();   return;  }  if(sName.IsEmpty())  {   MessageBox("用户名不允许为空!","系统提示",MB_OK|MB_ICONSTOP);   m_EdtName.SetFocus();   return;  }  if(this->AddOrChange==true)// 如果执行添加操作    sSQL.Format("Insert Into 用户信息表 values (%s,'%s','%s')",sID,sName,sPassWard);  else   sSQL.Format("UPDATE 用户信息表 SET 用户名='%s',密码='%s'WHERE 编号=%s",sName,sPassWard,sID);  cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);  this->Enabled(false);  this->m_List.UpDating();  this->OnCancel(); } }
void CDUser::OnBUTExit() { this->OnCancel(); }
 

 
#if !defined(AFX_DLOGIN_H__86FD9D41_6216_11D8_8752_5254AB32C8FB__INCLUDED_)#define AFX_DLOGIN_H__86FD9D41_6216_11D8_8752_5254AB32C8FB__INCLUDED_
#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// Dlogin.h : header file//#include "BaseComboBox.h"#include "BaseEdit.h"/////////////////////////////////////////////////////////////////////////////// CDlogin dialog
class CDlogin : public CDialog{// Constructionpublic: CDlogin(CWnd* pParent = NULL);   // standard constructor
// Dialog Data //{{AFX_DATA(CDlogin) enum { IDD = IDD_DIALogin }; CBaseEdit m_EdtPassWard; CBaseComboBox m_ComName; CButton m_ButLogin; CButton m_ButExit; //}}AFX_DATA
// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDlogin) protected: virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support //}}AFX_VIRTUAL
// Implementationprotected: _RecordsetPtr rst; // Generated message map functions //{{AFX_MSG(CDlogin) virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg void OnBUTlogin(); afx_msg void OnBUTExit(); //}}AFX_MSG DECLARE_MESSAGE_MAP()private: int Degree;};
//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLOGIN_H__86FD9D41_6216_11D8_8752_5254AB32C8FB__INCLUDED_)
 

// DOutPut.cpp : implementation file//
#include "stdafx.h"#include "商品库存管理系统.h"#include "DOutPut.h"#include "ExtendEdit.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endifextern _ConnectionPtr cnn;extern CMyApp theApp;/////////////////////////////////////////////////////////////////////////////// CDOutPut dialog
CDOutPut::CDOutPut(CWnd* pParent /*=NULL*/) : CDialog(CDOutPut::IDD, pParent){ m_hBrush=::CreateSolidBrush(RGB(96,96,96));
 //{{AFX_DATA_INIT(CDOutPut) //}}AFX_DATA_INIT}
void CDOutPut::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDOutPut) DDX_Control(pDX, IDC_STAID, m_StaID); DDX_Control(pDX, IDC_STADate, m_StaDate); DDX_Control(pDX, IDC_LIST, m_Grid); DDX_Control(pDX, IDC_EDTSum, m_EdtSum); DDX_Control(pDX, IDC_EDTMoney, m_EdtMoney); DDX_Control(pDX, IDC_EDTClient, m_EdtClient); DDX_Control(pDX, IDC_BUTUndo, m_ButUndo); DDX_Control(pDX, IDC_BUTSave, m_ButSave); DDX_Control(pDX, IDC_BUTExit, m_ButExit); DDX_Control(pDX, IDC_BUTEnrol, m_ButEnrol); //}}AFX_DATA_MAP}
BEGIN_MESSAGE_MAP(CDOutPut, CDialog) //{{AFX_MSG_MAP(CDOutPut) ON_WM_CTLCOLOR() ON_NOTIFY(LVN_ITEMCHANGING, IDC_LIST, OnItemchangingList) ON_BN_CLICKED(IDC_BUTEnrol, OnBUTEnrol) ON_BN_CLICKED(IDC_BUTSave, OnBUTSave) ON_BN_CLICKED(IDC_BUTUndo, OnBUTUndo) ON_BN_CLICKED(IDC_BUTExit, OnBUTExit) //}}AFX_MSG_MAPEND_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////// CDOutPut message handlers
void CDOutPut::OnOK() { // TODO: Add extra validation here  //CDialog::OnOK();}
BOOL CDOutPut::OnInitDialog() { CDialog::OnInitDialog(); CString FieldName[]={"商品名称","规格","产地","计量单位","出厂日期","保质期","出货仓库","出货单价","出货数量"}; int ColWidth[]={150,60,100,60,80,80,100,100,100}; CDialog::OnInitDialog(); m_EdtClient.DataBase="客户信息查询"; m_EdtClient.Field="名称"; m_EdtClient.assn=true; m_EdtClient.GridParent=this; for(int i=0;i<9;i++) {  m_Grid.InsertColumn(i,FieldName[i]);  m_Grid.SetColumnWidth(i,ColWidth[i]); } m_Grid.SetColumnCount(9); CString sSQL; m_Grid.m_Edit.Changed=false; m_Grid.m_Edit.IsPopShow=true;   sSQL.Format("SELECT 商品名称,规格,产地,计量单位,出厂日期,保质期 FROM 库存查询 "); rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText); m_Grid.SetField("商品名称"); m_Grid.m_Edit.SetPopRecordset(rst); this->IsPopShow=false; m_Grid.AutoInsert=true; return TRUE;  // return TRUE unless you set the focus to a control               // EXCEPTION: OCX Property Pages should return FALSE}
void CDOutPut::SetOP(CString cOP){ OP=cOP;}
BOOL CDOutPut::DestroyWindow() { ::DeleteObject(m_hBrush);   return CDialog::DestroyWindow();}
void CDOutPut::ItemChange(){ CString sSQL,sWare,sStore,sInput; if(m_Grid.GetCol()==6) {  try{   sInput=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("销售价格");   m_Grid.SetItemText(m_Grid.GetRow(),7,sInput);  }  catch(...)  {   goto ResameNext;  }  m_Grid.m_Edit.IsPopShow=false;   }/* if(m_Grid.GetCol()==8) {  m_Grid.m_Edit.IsPopShow=false;  sSQL.Format("SELECT 商品名称,规格,产地,计量单位,出厂日期,保质期 FROM 库存查询 ");  rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);  m_Grid.m_Edit.SetPopRecordset(rst);   } */ if(m_Grid.GetCol()==0)    //自动添充  {   CString  sSpec,sArer,sUnit,sOutFactroyDate,sKeepDate;  try{  sSpec=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("规格");  }  catch(...)  {  goto ResameNext;  }  sArer=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("产地");   sUnit=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("计量单位");   sOutFactroyDate=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("出厂日期");   sKeepDate=(char*)(_bstr_t)m_Grid.m_Edit.rst->GetCollect("保质期");  m_Grid.SetItemText(m_Grid.GetRow(),1,sSpec);   m_Grid.SetItemText(m_Grid.GetRow(),2,sArer);  m_Grid.SetItemText(m_Grid.GetRow(),3,sUnit);   m_Grid.SetItemText(m_Grid.GetRow(),4,sOutFactroyDate);  m_Grid.SetItemText(m_Grid.GetRow(),5,sKeepDate);  m_Grid.m_Edit.IsPopShow=true;  m_Grid.m_Edit.GetWindowText(sWare);  m_Grid.SetField("仓库名称");  sSQL.Format("SELECT 仓库名称,销售价格 FROM 库存查询 WHERE 商品名称='%s'",sWare);  rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);  m_Grid.m_Edit.SetPopRecordset(rst);  IsShow=true; }ResameNext:  return;}
HBRUSH CDOutPut::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(pWnd==&m_StaDate || pWnd==&m_StaID) {  pDC->SetBkColor(RGB(96,96,96));  pDC->SetTextColor(RGB(255,255,255)); } if(pWnd==&m_EdtClient) {  pDC->SetBkColor(RGB(96,96,96));  pDC->SetTextColor(RGB(255,255,255));  return m_hBrush; // TODO: Return a different brush if the default is not desired }  // TODO: Return a different brush if the default is not desired return hbr;}
void CDOutPut::OnItemchangingList(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; if(m_Grid.GetCol()==0)  m_Grid.m_Col=5; *pResult = 0;}
BOOL CDOutPut::PreTranslateMessage(MSG* pMsg) { if(FromHandle(pMsg->hwnd)->GetParent()==&m_Grid && pMsg->message==WM_KEYDOWN &&pMsg->wParam==13) {  if(m_Grid.GetCol()==0  && this->IsShow==true)  {   CString sSQL;   m_Grid.m_Edit.IsPopShow=true;   sSQL.Format("SELECT 商品名称,规格,产地,计量单位,出厂日期,保质期 FROM 库存查询 ");   rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);   m_Grid.m_Edit.SetPopRecordset(rst);     IsShow=false;   m_Grid.SetField("商品名称");  }  ItemChange();  int nSum=0,nMoney=0;  CString sSum,sMoney;  for(int i=0;ihwnd==m_EdtClient.GetSafeHwnd() && pMsg->message==WM_KEYDOWN &&pMsg->wParam==13) {  this->m_Grid.InsertItem(0,"");  m_Grid.SetFocus();  m_Grid.m_Col=0;  m_Grid.m_Row=0;  m_Grid.BeginEdit(0,0); }  return CDialog::PreTranslateMessage(pMsg);}
void CDOutPut::OnBUTEnrol() { CTime tDate; CString cID,cDate; cID=theApp.AutoNumber("出库信息表","CK",2); m_StaID.SetWindowText(cID); tDate=tDate.GetCurrentTime(); cDate=theApp.CTimeToCString(tDate); m_StaDate.SetWindowText(cDate); m_ButEnrol.EnableWindow(false); m_ButSave.EnableWindow(true); m_ButUndo.EnableWindow(true); m_ButExit.EnableWindow(false); m_EdtClient.EnableWindow(true); m_EdtClient.SetFocus(); }
void CDOutPut::OnBUTSave() { int a=MessageBox("确定保存此出库单吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION); if(a==1) {  CString cSQL,cStoreNumber,cID,cStore,cWareID,cTime,cProvider,cSum,cMoney,cNum;  int nOP,nStoreNumber,nStoreSum;  m_StaID.GetWindowText(cID);  m_StaDate.GetWindowText(cTime);  m_EdtClient.GetWindowText(cProvider);  m_EdtSum.GetWindowText(cSum);  m_EdtMoney.GetWindowText(cMoney);  nOP=theApp.NumberTOName("用户信息表","用户名",OP);  cSQL.Format("Insert Into 出库信息表 values('%s',#%s#,%s,%s,%d)",cID,cTime,cSum,cMoney,nOP);  cnn->Execute((_bstr_t)cSQL,NULL,adCmdText);  for(int r=0;rExecute((_bstr_t)cSQL,NULL,adCmdText);   //更新仓库信息表   cSQL.Format("SELECT * FROM 库存信息表 WHERE 商品编号='%s' and 仓库编号=%d ",cWareID,nStoreNumber);   rst=cnn->Execute((_bstr_t)cSQL,NULL,adCmdText);   if(theApp.GetRecordCount(rst)>0)   {    rst->MoveFirst();    cStoreNumber=(char*)(_bstr_t)rst->GetCollect("库存数量");    nStoreSum=atoi(cStoreNumber)-atoi(cNum);    cSQL.Format("UPDATE 库存信息表 set 库存数量=%d WHERE 商品编号='%s' and 仓库编号=%d",nStoreSum,cWareID,nStoreNumber);    cnn->Execute((_bstr_t)cSQL,NULL,adCmdText);    rst->Close();   }   } m_ButEnrol.EnableWindow(true); m_ButSave.EnableWindow(false); m_ButUndo.EnableWindow(false); m_ButExit.EnableWindow(true); m_EdtClient.EnableWindow(false); m_EdtClient.IsPopShow=false; m_EdtClient.SetWindowText(""); m_Grid.ClearGrid(); this->m_ButEnrol.SetFocus(); } }
void CDOutPut::OnBUTUndo() { int a=MessageBox("确定要撤消操作吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION); if (a==1) {  m_ButEnrol.EnableWindow(true);  m_ButSave.EnableWindow(false);  m_ButUndo.EnableWindow(false);  m_ButExit.EnableWindow(true);  m_EdtClient.EnableWindow(false);  m_EdtClient.IsPopShow=false;  m_EdtClient.SetWindowText("");  m_Grid.ClearGrid();  } }
void CDOutPut::OnBUTExit() { this->OnCancel(); }
 

#if !defined(AFX_DOUTPUT_H__4310B5C1_66D7_11D8_8753_5254AB32C8FB__INCLUDED_)#define AFX_DOUTPUT_H__4310B5C1_66D7_11D8_8753_5254AB32C8FB__INCLUDED_
#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// DOutPut.h : header file//
/////////////////////////////////////////////////////////////////////////////// CDOutPut dialog#include "RxGrid.h"#include "ExtendEdit.h"class CDOutPut : public CDialog{// Constructionpublic: bool IsPopShow; void ItemChange(); void SetOP(CString cOP); CDOutPut(CWnd* pParent = NULL);   // standard constructor
// Dialog Data //{{AFX_DATA(CDOutPut) enum { IDD = IDD_DIAOutput }; CStatic m_StaID; CStatic m_StaDate; CRxGrid m_Grid; CEdit m_EdtSum; CEdit m_EdtMoney; CExtendEdit m_EdtClient; CButton m_ButUndo; CButton m_ButSave; CButton m_ButExit; CButton m_ButEnrol; CString OP; //}}AFX_DATA
// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDOutPut) public: virtual BOOL DestroyWindow(); virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support //}}AFX_VIRTUAL
// Implementationprotected:
 // Generated message map functions //{{AFX_MSG(CDOutPut) virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnItemchangingList(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnBUTEnrol(); afx_msg void OnBUTSave(); afx_msg void OnBUTUndo(); afx_msg void OnBUTExit(); //}}AFX_MSG DECLARE_MESSAGE_MAP()private: bool IsShow; HBRUSH m_hBrush; _RecordsetPtr rst;};
//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DOUTPUT_H__4310B5C1_66D7_11D8_8753_5254AB32C8FB__INCLUDED_)
设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师