DlgXiaoShouTuiDan.cpp
上传用户:jzscgs158
上传日期:2022-05-25
资源大小:8709k
文件大小:4k
源码类别:
百货/超市行业
开发平台:
Visual C++
- // DlgXiaoShouTuiDan.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ncshop.h"
- #include "DlgXiaoShouTuiDan.h"
- #include "ADOConn.h"
- #include "MyTime.h"
- #include "DlgAll.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgXiaoShouTuiDan dialog
- CDlgXiaoShouTuiDan::CDlgXiaoShouTuiDan(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgXiaoShouTuiDan::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgXiaoShouTuiDan)
- m_str1 = _T("");
- m_str2 = _T("");
- m_str3 = _T("");
- m_str4 = _T("");
- m_str5 = _T("");
- //}}AFX_DATA_INIT
- }
- void CDlgXiaoShouTuiDan::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgXiaoShouTuiDan)
- DDX_Control(pDX, IDC_BUTTON7, m_Btn7);
- DDX_Control(pDX, IDC_LIST1, m_listMain);
- DDX_Control(pDX, IDC_BUTTON6, m_Btn2);
- DDX_Control(pDX, IDCANCEL, m_Btn4);
- DDX_Control(pDX, IDC_BUTTON1, m_Btn3);
- DDX_Control(pDX, IDC_BUTTON2, m_Btn1);
- DDX_Text(pDX, IDC_EDIT1, m_str1);
- DDX_Text(pDX, IDC_EDIT2, m_str2);
- DDX_Text(pDX, IDC_EDIT3, m_str3);
- DDX_Text(pDX, IDC_EDIT5, m_str4);
- DDX_Text(pDX, IDC_EDIT4, m_str5);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgXiaoShouTuiDan, CDialog)
- //{{AFX_MSG_MAP(CDlgXiaoShouTuiDan)
- ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgXiaoShouTuiDan message handlers
- BOOL CDlgXiaoShouTuiDan::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- CMyTime time1;
- CADOConn adoMain;
- CString strSql;
- GetDlgItem(IDC_STATIC1)->SetFont(&ftHeader,TRUE);
- m_Btn1.SetXIcon(IDI_ICONFIND);
- m_Btn2.SetXIcon(IDI_ICONFIND);
- m_Btn3.SetXIcon(IDI_ICONBUTTON);
- m_Btn4.SetXIcon(IDI_ICONBUTTON);
- m_Btn7.SetXIcon(IDI_ICONFIND);
- m_str2=time1.GetDateString(FALSE);
- UpdateData(FALSE);
- strSql="select * from 销售商品管理表";
- adoMain.Open(strSql);
- adoMain.InitList(&m_listMain,4);
- adoMain.ExitConnect();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CDlgXiaoShouTuiDan::OnButton6()
- {
- // TODO: Add your control notification handler code here
- CDlgAll dlg;
- UpdateData(TRUE);
- dlg.strTitle="管理员基本信息表";
- dlg.strSql="select 编号,姓名 from 管理员基本信息表";
- dlg.intOpen=2;
- if(dlg.DoModal()==IDOK)
- {
- m_str3=dlg.strKey;
- UpdateData(FALSE);
- }
- }
- void CDlgXiaoShouTuiDan::OnButton2()
- {
- // TODO: Add your control notification handler code here
- CDlgAll dlg;
- CADOConn adoMain;
- CString strSql;
- UpdateData(TRUE);
- dlg.strTitle="销售单统计表";
- dlg.strSql="select * from 销售单统计表";
- dlg.intOpen=2;
- if(dlg.DoModal()==IDOK)
- {
- m_str1=dlg.strKey;
- UpdateData(FALSE);
- }
- strSql="select * from 销售商品管理表 where 单编号='";
- strSql=strSql+m_str1+"'";
- adoMain.Open(strSql);
- adoMain.InitList(&m_listMain,4);
- adoMain.FillList(&m_listMain,4);
- adoMain.ExitConnect();
- }
- void CDlgXiaoShouTuiDan::OnButton1()
- {
- // TODO: Add your control notification handler code here
- CDlgAll dlg;
- CADOConn adoMain;
- CString strSql,str;
- int i;
- UpdateData(TRUE);
- strSql="insert into 销售退货单统计表 values('";
- strSql=strSql+m_str1+"','";
- strSql=strSql+m_str2+"','";
- strSql=strSql+m_str3+"','";
- strSql=strSql+m_str4+"','";
- strSql=strSql+m_str5+"')";
- adoMain.ExecuteSQL(strSql);
- if(m_str1!="")
- {
- for(i=0;i<m_listMain.GetItemCount();i++)
- {
- strSql="update 商品库存数量统计表 set 库存=";
- str.Format("%0.2f",atof(m_listMain.GetItemText(i,5))+atof(m_listMain.GetItemText(i,6)));
- strSql=strSql+str+" where 条形码='";
- strSql=strSql+m_listMain.GetItemText(i,1)+"'";
- adoMain.ExecuteSQL(strSql);
- }
- }
- adoMain.ExitConnect();
- m_str1="";
- m_str3="";
- m_str4="";
- m_listMain.DeleteAllItems();
- UpdateData(FALSE);
- }
- void CDlgXiaoShouTuiDan::OnButton7()
- {
- // TODO: Add your control notification handler code here
- CDlgAll dlg;
- UpdateData(TRUE);
- dlg.strTitle="分机基本信息表";
- dlg.strSql="select * from 分机基本信息表";;
- dlg.intOpen=3;
- if(dlg.DoModal()==IDOK)
- {
- m_str5=dlg.strKey;
- UpdateData(FALSE);
- }
- }