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

📄 shopmanagedlg.cpp

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

#include "stdafx.h"
#include "ShopManage.h"
#include "ShopManageDlg.h"
#include "PurchaseRecord.h"
#include "Entry.h"
#include "DataManage.h"
#include "PCheck.h"
#include "PStatistics.h"
#include "SRecord.h"
#include "SCheck.h"
#include "STCheckDialog.h"
#include "SMCheck.h"
#include "DayStorage.h"
#include "MonthStorage.h"
#include "NewSaleMan.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShopManageDlg dialog

CShopManageDlg::CShopManageDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CShopManageDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CShopManageDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CShopManageDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShopManageDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CShopManageDlg, CDialog)
	//{{AFX_MSG_MAP(CShopManageDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_CLOSE()
	ON_WM_TIMER()
	ON_COMMAND(ForHelp, OnForHelp)
	ON_COMMAND(PurchaseRecord, OnPurchaseRecord)
	ON_COMMAND(PurchaseCheck, OnPurchaseCheck)
	ON_COMMAND(PurchaseStatistics, OnPurchaseStatistics)
	ON_COMMAND(SaleRecord, OnSaleRecord)
	ON_COMMAND(SystemQuit, OnSystemQuit)
	ON_COMMAND(SaleCheck, OnSaleCheck)
	ON_COMMAND(StorageCheck, OnStorageCheck)
	ON_COMMAND(SaleManCheck, OnSaleManCheck)
	ON_COMMAND(SaleDay, OnSaleDay)
	ON_COMMAND(SaleMonth, OnSaleMonth)
	ON_COMMAND(NewSaleManRecord, OnNewSaleManRecord)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShopManageDlg message handlers

BOOL CShopManageDlg::OnInitDialog()
{
	//*****************************
	CEntry entry;
	entry.DoModal();
	if(entry.Enable == false)
		EndDialog(0);
	//*****************************
	CDialog::OnInitDialog();
	// Add "About..." menu item to system menu.
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	CDataManage dm;
	dm.ConnectDataBase();
	/*********创建状态栏*******************/
	int panels[6];
	CRect rect1;
	this->GetClientRect(rect1);
	panels[0] = rect1.Width()/9;
	panels[1] = rect1.Width()/9*3;
	panels[2] = panels[1] + rect1.Width()/9;
	panels[3] = panels[2] + rect1.Width()/9*2;
	panels[4] = panels[3] + rect1.Width()/9;
	panels[5] = 2000;
	statusbar.Create(WS_CHILD|WS_VISIBLE|CCS_BOTTOM|SBARS_SIZEGRIP,
		rect1,this,ID_statusbar);
	statusbar.SetParts(6,panels);
	statusbar.SetText("提示",0,0);
	statusbar.SetText("作者",2,0);
	statusbar.SetText("王一夫",3,0);
	statusbar.SetText("系统时间",4,0);
	//***********创建状态栏********************
	this->UpdateWindow();
	//this->ShowWindow(SW_SHOWMAXIMIZED);
	this->SetTimer(12,1000,NULL);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CShopManageDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CShopManageDlg::OnPaint() 
{
	CPaintDC dc(this);
	CDC MemDC;
	CBitmap bit;
	CRect rect;
	bit.LoadBitmap(IDB_BITMAP2);
	MemDC.CreateCompatibleDC(this->GetDC());
	MemDC.SelectObject(&bit);
	this->GetClientRect(&rect);
	dc.StretchBlt(0,0,rect.Width(),rect.Height(),&MemDC,0,0,668,471,SRCCOPY);
	MemDC.DeleteDC();
	::DeleteObject(&bit);
	CDialog::OnPaint();
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CShopManageDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CShopManageDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	if(MessageBox("确实要退出系统吗?","提示",MB_YESNO) != IDNO)
		EndDialog(0);
	//CDialog::OnClose();
}

void CShopManageDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CTime t= CTime::GetCurrentTime();
	CString s =t.Format("%H:%M:%S");
	statusbar.SetText(s,5,0);
	CDialog::OnTimer(nIDEvent);
}

void CShopManageDlg::OnForHelp() 
{
	// TODO: Add your command handler code here
	MessageBox("各项ID是唯一的,请注意不要重复插入数据库.\n用户名:laoshupi\n密码:123","帮助");
}

void CShopManageDlg::OnPurchaseRecord() 
{
	// TODO: Add your command handler code here
	CPurchaseRecord cpr;
	cpr.DoModal();
}

void CShopManageDlg::OnPurchaseCheck() 
{
	// TODO: Add your command handler code here
	PCheck pck;
	pck.DoModal();
}

void CShopManageDlg::OnPurchaseStatistics() 
{
	// TODO: Add your command handler code here
	PStatistics ps;
	ps.DoModal();
}

void CShopManageDlg::OnSaleRecord() 
{
	// TODO: Add your command handler code here
	SRecord sr;
	sr.DoModal();
}

void CShopManageDlg::OnSystemQuit() 
{
	// TODO: Add your command handler code here
	EndDialog(0);
}

void CShopManageDlg::OnSaleCheck() 
{
	// TODO: Add your command handler code here
	SCheck sc;
	sc.DoModal();
}

void CShopManageDlg::OnStorageCheck() 
{
	// TODO: Add your command handler code here
	STCheckDialog stc;
	stc.DoModal();
}

void CShopManageDlg::OnSaleManCheck() 
{
	// TODO: Add your command handler code here
	SMCheck smc;
	smc.DoModal();
}

void CShopManageDlg::OnSaleDay() 
{
	// TODO: Add your command handler code here
	DayStorage ds;
	ds.DoModal();
}

void CShopManageDlg::OnSaleMonth() 
{
	// TODO: Add your command handler code here
	MonthStorage ms;
	ms.DoModal();
}

void CShopManageDlg::OnNewSaleManRecord() 
{
	// TODO: Add your command handler code here
	NewSaleMan nsm;
	nsm.DoModal();
}

⌨️ 快捷键说明

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