MainFrm.cpp
上传用户:tyjx315
上传日期:2015-01-18
资源大小:1685k
文件大小:9k
- // MainFrm.cpp : implementation of the CMainFrame class
- //
- #include "stdafx.h"
- #include "SuperMarket.h"
- #include "MainFrm.h"
- #include "EnterDlg.h"
- #include "AddPersonDlg.h"
- #include "DeleteDlg.h"
- #include "SaleDlg.h"
- #include "ServerDlg.h"
- #include "OosSearchDlg.h"
- #include "AddNewMerchandiseDlg.h"
- #include "BackMerchandiseDlg.h"
- #include "SearchPersonDlg.h"
- #include "SalaryDlg.h"
- #include "FinaceDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_UPDATE_COMMAND_UI(IDM_ENTER, OnUpdateEnter)
- ON_UPDATE_COMMAND_UI(IDM_EXIT, OnUpdateExit)
- ON_COMMAND(IDM_ENTER, OnEnter)
- ON_COMMAND(IDM_EXIT, OnExit)
- ON_UPDATE_COMMAND_UI(IDM_ADD_PERSON, OnUpdateAddPerson)
- ON_COMMAND(IDM_ADD_PERSON, OnAddPerson)
- ON_UPDATE_COMMAND_UI(IDM_DELETE_PERSOM, OnUpdateDeletePersom)
- ON_COMMAND(IDM_DELETE_PERSOM, OnDeletePersom)
- ON_UPDATE_COMMAND_UI(IDM_SALE, OnUpdateSale)
- ON_COMMAND(IDM_SALE, OnSale)
- ON_COMMAND(IDM_CUSTOMER_SEARCH, OnCustomerSearch)
- ON_UPDATE_COMMAND_UI(IDM_CUSTOMER_SEARCH, OnUpdateCustomerSearch)
- ON_UPDATE_COMMAND_UI(IDM_OOS_SEARCH, OnUpdateOosSearch)
- ON_COMMAND(IDM_OOS_SEARCH, OnOosSearch)
- ON_UPDATE_COMMAND_UI(IDM_NEW_MERCHANDISE, OnUpdateNewMerchandise)
- ON_COMMAND(IDM_NEW_MERCHANDISE, OnNewMerchandise)
- ON_UPDATE_COMMAND_UI(IDM_BACK_MERCHANDISE, OnUpdateBackMerchandise)
- ON_COMMAND(IDM_BACK_MERCHANDISE, OnBackMerchandise)
- ON_UPDATE_COMMAND_UI(IDM_SEARCH_PERSON, OnUpdateSearchPerson)
- ON_COMMAND(IDM_SEARCH_PERSON, OnSearchPerson)
- ON_UPDATE_COMMAND_UI(IDM_SALARY_SET, OnUpdateSalarySet)
- ON_COMMAND(IDM_SALARY_SET, OnSalarySet)
- ON_UPDATE_COMMAND_UI(IDM_FINACE, OnUpdateFinace)
- ON_COMMAND(IDM_FINACE, OnFinace)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
- };
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
- CMainFrame::CMainFrame()
- {
- // TODO: add member initialization code here
- m_exit_flag = false;
- m_enter_flag = true;
- m_person_flag = false;
- m_sale_flag = false;
- m_server_flag = false;
- m_circulate_flag = false;
- m_finace_flag = false;
- }
- CMainFrame::~CMainFrame()
- {
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
- | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
- !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create toolbarn");
- return -1; // fail to create
- }
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- // TODO: Delete these three lines if you don't want the toolbar to
- // be dockable
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_wndToolBar);
- return 0;
- }
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( !CMDIFrameWnd::PreCreateWindow(cs) )
- return FALSE;
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- cs.style |= WS_MAXIMIZE;
- // cs.style |= WS_DLGFRAME;
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame diagnostics
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CMDIFrameWnd::AssertValid();
- }
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CMDIFrameWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame message handlers
- void CMainFrame::OnUpdateEnter(CCmdUI* pCmdUI) //进入系统状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_enter_flag);
-
- }
- void CMainFrame::OnUpdateExit(CCmdUI* pCmdUI) //退出系统状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_exit_flag);
- }
- void CMainFrame::OnEnter() //进入系统
- {
- // TODO: Add your command handler code here
- CEnterDlg E_Dlg;
- E_Dlg.DoModal();
- if(E_Dlg.enter_success == true)
- {
- m_enter_flag = false;
- m_exit_flag = true;
- }
-
- if(E_Dlg.manager==true)
- {
- m_enter_flag = false;
- m_exit_flag = true;
- m_person_flag = true;
- m_sale_flag = true;
- m_server_flag = true;
- m_circulate_flag = true;
- m_finace_flag = true;
- }
- if(E_Dlg.employee == true)
- {
- m_enter_flag = false;
- if(E_Dlg.department == "人事部门")
- {
- m_person_flag = true;
- }
- if(E_Dlg.department == "销售部门")
- {
- m_sale_flag = true;
- }
- if(E_Dlg.department == "客服部门")
- {
- m_server_flag = true;
- }
- if(E_Dlg.department == "物流部门")
- {
- m_circulate_flag = true;
- }
- if(E_Dlg.department == "财务部门")
- {
- m_finace_flag = true;
- }
-
- }
- }
- void CMainFrame::OnUpdateAddPerson(CCmdUI* pCmdUI) //增添人员状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_person_flag);
- }
- void CMainFrame::OnAddPerson() //增添员工操作
- {
- // TODO: Add your command handler code here
- CAddPersonDlg A_Dlg;
- A_Dlg.DoModal();
- }
- void CMainFrame::OnUpdateDeletePersom(CCmdUI* pCmdUI) //删减人员状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_person_flag);
-
- }
- void CMainFrame::OnDeletePersom() //删减人员操作
- {
- // TODO: Add your command handler code here
- CDeleteDlg D_Dlg;
- D_Dlg.DoModal();
- }
- void CMainFrame::OnUpdateSale(CCmdUI* pCmdUI) //出售商品状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_sale_flag);
-
- }
- void CMainFrame::OnSale() //出售商品操作
- {
- // TODO: Add your command handler code here
- CSaleDlg S_Dlg;
- S_Dlg.DoModal();
- }
- void CMainFrame::OnUpdateCustomerSearch(CCmdUI* pCmdUI) //顾客查询状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_server_flag);
-
- }
- void CMainFrame::OnCustomerSearch() //顾客查询操作
- {
- // TODO: Add your command handler code here
- CServerDlg S_Dlg;
- S_Dlg.DoModal();
-
- }
- void CMainFrame::OnUpdateOosSearch(CCmdUI* pCmdUI) //缺货查询状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_circulate_flag);
-
- }
- void CMainFrame::OnOosSearch() //缺货查询操作
- {
- // TODO: Add your command handler code here
- COosSearchDlg O_Dlg;
- O_Dlg.DoModal();
- }
- void CMainFrame::OnUpdateNewMerchandise(CCmdUI* pCmdUI) //商品入库状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_circulate_flag);
-
- }
- void CMainFrame::OnNewMerchandise() //商品入库操作
- {
- // TODO: Add your command handler code here
- CAddNewMerchandiseDlg A_Dlg;
- A_Dlg.DoModal();
-
- }
- void CMainFrame::OnExit() //退出系统改变状态
- {
- // TODO: Add your command handler code here
- m_enter_flag = true;
- m_exit_flag = false;
- m_person_flag = false;
- m_sale_flag = false;
- m_server_flag = false;
- m_circulate_flag = false;
- m_finace_flag = false;
- }
- void CMainFrame::OnUpdateBackMerchandise(CCmdUI* pCmdUI) //退货处理状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_server_flag);
-
- }
- void CMainFrame::OnBackMerchandise() //退货处理操作
- {
- // TODO: Add your command handler code here
- CBackMerchandiseDlg B_Dlg;
- B_Dlg.DoModal();
-
- }
- void CMainFrame::OnUpdateSearchPerson(CCmdUI* pCmdUI) //人员查询状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_person_flag);
-
- }
- void CMainFrame::OnSearchPerson() //人员查询操作
- {
- // TODO: Add your command handler code here
- CSearchPersonDlg S_Dlg;
- S_Dlg.DoModal();
-
- }
- void CMainFrame::OnUpdateSalarySet(CCmdUI* pCmdUI) //工资状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_person_flag);
- }
-
- void CMainFrame::OnSalarySet() //工资调动
- {
- // TODO: Add your command handler code here
- CSalaryDlg S_Dlg;
- S_Dlg.DoModal();
- }
- void CMainFrame::OnUpdateFinace(CCmdUI* pCmdUI) //财务统计状态
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_finace_flag);
-
- }
- void CMainFrame::OnFinace() //财务统计操作
- {
- // TODO: Add your command handler code here
- CFinaceDlg F_Dlg;
- F_Dlg.DoModal();
-
- }