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

📄 dlgintostorage.cpp

📁 分考虑商品销售折让与折扣 商品销售后自动登记应收款 ◎ 商品库存管理:盘盈盘亏登记、商品库存查询、...系统备份、系统恢复、系统维护、用户权限分工等,可以说是一套小型超市管理系统
💻 CPP
字号:
// DlgIntostorage.cpp : implementation file
//

#include "stdafx.h"
#include "MerchandiseStore.h"
#include "DlgIntostorage.h"

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

#include "database.h"
//-------------global 
extern CDatabase m_hDatabase ;
//------------end

/////////////////////////////////////////////////////////////////////////////
// CDlgIntostorage dialog


CDlgIntostorage::CDlgIntostorage(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgIntostorage::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgIntostorage)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgIntostorage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgIntostorage)
	DDX_Control(pDX, IDOK, m_hBtnOk);
	DDX_Control(pDX, IDD_BTN_SAVE, m_hBtnSave);
	DDX_Control(pDX, IDD_BTN_MOD, m_hBtnMod);
	DDX_Control(pDX, IDD_BTN_DEL, m_hBtnDel);
	DDX_Control(pDX, IDD_BTN_ADD, m_hBtnAdd);
	DDX_Control(pDX, IDC_DTP_intime, m_hDtpIntime);
	DDX_Control(pDX, IDC_TAB_Intostorage, m_hTabIntostorage);
	DDX_Control(pDX, IDC_LIST_Intostorage, m_hListIntostorage);
	DDX_Control(pDX, IDC_EDIT_orderform, m_hEditOrderform);
	DDX_Control(pDX, IDC_EDIT_OperatorID, m_hEditOperatorID);
	DDX_Control(pDX, IDC_EDIT_ID, m_hEditID);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgIntostorage, CDialog)
	//{{AFX_MSG_MAP(CDlgIntostorage)
	ON_NOTIFY(NM_CLICK, IDC_LIST_Intostorage, OnClickLISTIntostorage)
	ON_NOTIFY(NM_DBLCLK, IDC_LIST_Intostorage, OnDblclkLISTIntostorage)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_Intostorage, OnSelchangeTABIntostorage)
	ON_BN_CLICKED(IDD_BTN_ADD, OnBtnAdd)
	ON_BN_CLICKED(IDD_BTN_DEL, OnBtnDel)
	ON_BN_CLICKED(IDD_BTN_MOD, OnBtnMod)
	ON_BN_CLICKED(IDD_BTN_SAVE, OnBtnSave)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgIntostorage message handlers

BOOL CDlgIntostorage::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	InitCtrlData() ;
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIntostorage::OnClickLISTIntostorage(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	char ID[30+1] ;
	m_hListIntostorage.GetItemText(m_hListIntostorage.GetSelectionMark(), 0, ID, sizeof(ID)) ;
	
	m_hDatabase.EditIntostorageToCtrl(ID, &m_hEditID, &m_hEditOperatorID, &m_hEditOrderform) ;

	*pResult = 0;
}

void CDlgIntostorage::OnDblclkLISTIntostorage(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	TabCtrlOfSelect(0) ;
	
	*pResult = 0;
}

void CDlgIntostorage::OnSelchangeTABIntostorage(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	switch(m_hTabIntostorage.GetCurSel())
	{
	case 0:
		TabCtrlOfSelect(0) ;
		break ;
	case 1:
		TabCtrlOfSelect(1) ;
		break ;
	}	

	*pResult = 0;
}

void CDlgIntostorage::InitCtrlData()
{
///INIT BUTTON CTRL
	m_hBtnOk.SetIcon(IDI_ICON_CLOSE);
	m_hBtnOk.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnOk.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	m_hBtnSave.SetIcon(IDI_ICON_OK);
	m_hBtnSave.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnSave.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));
	m_hBtnSave.EnableWindow(FALSE) ;

	m_hBtnDel.SetIcon(IDI_ICON_DEL);
	m_hBtnDel.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnDel.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	m_hBtnAdd.SetIcon(IDI_ICON_ADD);
	m_hBtnAdd.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnAdd.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	m_hBtnMod.SetIcon(IDI_ICON_MOD);
	m_hBtnMod.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnMod.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

//Init tab ctrl 
	m_hTabIntostorage.InsertItem(0, "入库基本信息") ;
	m_hTabIntostorage.InsertItem(1, "入库信息列表") ;
	m_hTabIntostorage.ShowWindow(TRUE) ;

	m_hListIntostorage.InsertColumn(0, "入库单号", LVCFMT_CENTER, 100) ;
	m_hListIntostorage.InsertColumn(1, "订单号", LVCFMT_CENTER, 100) ;
	m_hListIntostorage.InsertColumn(2, "操作员", LVCFMT_CENTER, 100) ;
	m_hListIntostorage.InsertColumn(3, "入库时间", LVCFMT_CENTER, 100) ;
	m_hListIntostorage.SetExtendedStyle(m_hListIntostorage.GetStyle() | LVS_EX_FULLROWSELECT);
//
	TabCtrlOfSelect(1) ;
}

void CDlgIntostorage::TabCtrlOfSelect(int m_nSelected)
{
	switch(m_nSelected)
	{
	case 0:
		{
			m_hTabIntostorage.SetCurSel(0) ;
			//---
			m_hEditID.ShowWindow(TRUE) ;
			m_hEditOperatorID.ShowWindow(TRUE) ;
			m_hEditOrderform.ShowWindow(TRUE) ;
			m_hDtpIntime.ShowWindow(TRUE) ;
			
			m_hListIntostorage.ShowWindow(FALSE) ;
			m_hEditID.SetFocus() ;
			break ;
		}
	case 1:
		{
			m_hTabIntostorage.SetCurSel(1) ;
			//-----
			m_hEditID.ShowWindow(FALSE) ;
			m_hEditOperatorID.ShowWindow(FALSE) ;
			m_hEditOrderform.ShowWindow(FALSE) ;
			m_hDtpIntime.ShowWindow(FALSE) ;
			
			m_hListIntostorage.ShowWindow(TRUE) ;
			break ;
		}
	}
	m_hDatabase.ListIntostorageToCtrl(&m_hListIntostorage) ;
}

void CDlgIntostorage::OnBtnAdd() 
{
	// TODO: Add your control notification handler code here
	switch(m_hTabIntostorage.GetCurSel())
	{
	case 0:
		{
			break ;
		}
	case 1:
		{
			TabCtrlOfSelect(0) ;
			break ;
		}
	}
	m_hEditID.SetWindowText("") ;
	m_hEditOperatorID.SetWindowText("") ;
	m_hEditOrderform.SetWindowText("") ;

	m_hEditID.SetFocus() ;
	m_hBtnSave.EnableWindow() ;
	
}

void CDlgIntostorage::OnBtnDel() 
{
	// TODO: Add your control notification handler code here
	if(m_hListIntostorage.GetSelectionMark() == -1)
	{//未被选中
		MessageBox("请选择欲删除条目!") ;
		return ;
	}
	char ID[30+1] ;
	m_hListIntostorage.GetItemText(m_hListIntostorage.GetSelectionMark(), 0, ID, sizeof(ID)) ;
	m_hDatabase.DeleteDataWhere(CGRK, ID) ;
	TabCtrlOfSelect(1) ;	
	
}

void CDlgIntostorage::OnBtnMod() 
{
	// TODO: Add your control notification handler code here
	switch(m_hTabIntostorage.GetCurSel())
	{
	case 0:
		{
			break ;
		}
	case 1:
		{
			if(m_hListIntostorage.GetSelectionMark() == -1)
			{//未被选中
				MessageBox("请选择欲修改条目!") ;
				return ;
			}
			break ;
		}
	}
	TabCtrlOfSelect(0) ;
	m_hBtnSave.EnableWindow() ;
	m_hEditID.SetFocus() ;	
}

void CDlgIntostorage::OnBtnSave() 
{
	// TODO: Add your control notification handler code here
	char ID[30+1], OperatorID[30+1], Orderform[10+1] ;
	
	m_hEditID.GetWindowText(ID, sizeof(ID)) ;
	m_hEditOperatorID.GetWindowText(OperatorID, sizeof(OperatorID)) ;
	m_hEditOrderform.GetWindowText(Orderform, sizeof(Orderform)) ;
	
	//保存修改,更新数据库
	m_hDatabase.UpdateIntostorageData(ID,OperatorID,Orderform) ;
	
	m_hBtnSave.EnableWindow(FALSE) ;
}

⌨️ 快捷键说明

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