place_order_dlg.h 2.49 KB
#pragma once
#include "GridCtrl.h"
#include "resource.h"
#include "afxcmn.h"
#include "afxwin.h"
#include "afxbutton.h"
#include "../utility/win_http.h"
#include "etrade_edit_control.h"
#include <string>


// PlaceOrderDlg 对话框

class PlaceOrderDlg : public CDialogEx
{
	DECLARE_DYNAMIC(PlaceOrderDlg)

public:
	PlaceOrderDlg(CWnd* pParent = NULL);   // 标准构造函数
	virtual ~PlaceOrderDlg();

	virtual BOOL OnInitDialog();
	virtual BOOL Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	afx_msg void OnPaint();
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);

// 对话框数据
	enum { IDD = IDD_DIALOG_PLACE_ORDER };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()


private:
	void SetCtrlPos();
	void SetCtrlInitData();
	void InitList();
public:
	CStatic owner_static_;
	CEditBox card_edit_;
	CEdit name_edit_;
	CStatic comm_static_;
	CEditBox comm_num_edit_;
	CEdit comm_name_edit_;
	CStatic unit_static_;
	CEditBox unit_edit_;
	CStatic real_unit_static;
	CStatic heavy_static_;
	CEditBox heavy_edit_;
	CStatic price_static_;
	CEditBox price_edit_;
	CStatic count_static_;
	CEditBox count_edit_;
	CButton pay_button_;
	CGridCtrl product_list_;

	CPen line_pen_;
	CPoint line_point_[3];
	
	CBrush edit_brush_;
public:
	afx_msg void OnBnClickedButtonPay();
private:
	CStatic total_money_static_;
	CStatic total_real_money_static_;

	HACCEL acce_;

	bool GetUserName(CString &name);
	bool GetCommName(CString &name);
public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	afx_msg void OnAcceleratorTab();
	afx_msg void OnAcceleratorEnter();

	void SetErrorMsg(CString &error);
	CStatic error_static_;

	afx_msg LRESULT OnEditKillFocus(WPARAM wParam, LPARAM lParam);

	bool GetCardName(CString &num, CString &name);
	bool GetCommName(CString &num, CString &name);

	struct CardInfo
	{
		CString card_num;
		CString card_name;
		CString card_type;
	};

	CardInfo card_info_;
	bool GetCardInfo(CString num, CString &err_msg);

	afx_msg void OnAcceleratorDown();
	afx_msg void OnAcceleratorUp();
	afx_msg void OnSetFocus(CWnd* pOldWnd);

	void SortList();

	void EmptyCtrl();
	CStatic buyer_static_;
	CEditBox buyer_card_edit_;
	CEditBox buyer_name_edit_;
	CButton swip_card_button_;
	afx_msg void OnBnClickedButtonSwipCard();

	//std::string card_num_;
	//std::string card_type_;

	void EnableCtrl(bool is_enable);
};