?? prodlg.cpp
字號:
// proDlg.cpp : implementation file
//
#include "stdafx.h"
#include "pro.h"
#include "proDlg.h"
#include "ado.h"
#include "indlg.h"
#include "kinddlg.h"
#include "SellDlg.h"
#include "infodlg.h"
#include "reportdlg.h"
#include "userdlg.h"
#include "resysdlg.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 void OnButton11();
//}}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)
ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProDlg dialog
CProDlg::CProDlg(CWnd* pParent /*=NULL*/)
: CDialog(CProDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CProDlg)
m_filt = _T("");
m_timefrom = 0;
m_timeto = 0;
m_afilt = _T("");
m_apre = _T("");
m_asui = _T("");
m_attot = _T("");
m_cinout = _T("");
m_aout = _T("");
strsort = _T("車型");
m_ali = _T("");
m_ainval = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
cursel=0;
}
void CProDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProDlg)
DDX_Control(pDX, IDC_BUTTON2, m_bfilt);
DDX_Control(pDX, IDC_COMBO2, m_inout);
// DDX_Control(pDX, IDC_MBMSG, m_mbmsg);
DDX_Control(pDX, IDC_LIST1, m_ListCtrl);
DDX_Text(pDX, IDC_FILTER, m_filt);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_timefrom);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_timeto);
DDX_Text(pDX, IDC_AFILT, m_afilt);
DDX_Text(pDX, IDC_APRE, m_apre);
DDX_Text(pDX, IDC_ASUI, m_asui);
DDX_Text(pDX, IDC_ATTOT, m_attot);
DDX_CBString(pDX, IDC_COMBO2, m_cinout);
DDX_Text(pDX, IDC_OUT, m_aout);
DDX_Text(pDX, IDC_ALI, m_ali);
DDX_Text(pDX, IDC_AINVAL, m_ainval);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProDlg, CDialog)
//{{AFX_MSG_MAP(CProDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_IN, OnIn)
ON_BN_CLICKED(IDC_EDITKIND, OnEditkind)
ON_BN_CLICKED(IDC_SELL, OnSell)
ON_NOTIFY(NM_KILLFOCUS, IDC_LIST1, OnKillfocusList1)
ON_NOTIFY(NM_SETFOCUS, IDC_LIST1, OnSetfocusList1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST1, OnColumnclickList1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
ON_BN_CLICKED(IDC_REP, OnRep)
ON_BN_CLICKED(IDC_backup, Onbackup)
ON_BN_CLICKED(IDC_USER, OnUser)
ON_EN_SETFOCUS(IDC_FILTER, OnSetfocusFilter)
ON_BN_CLICKED(IDC_BUTTON26, OnButton26)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProDlg message handlers
BOOL CProDlg::OnInitDialog()
{
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
RegisterHotKey(this->m_hWnd,9,0,VK_F5);
m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
LV_COLUMN lvc;
lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH /*| LVCF_FMT*/;
lvc.iSubItem = 0;
lvc.pszText = (char *)"序號";
lvc.cx = 50;
m_ListCtrl.InsertColumn(0,&lvc);
lvc.iSubItem = 1;
lvc.pszText = (char *)"車型";
lvc.cx = 80;
m_ListCtrl.InsertColumn(1,&lvc);
lvc.iSubItem = 2;
lvc.pszText = (char *)"發動機號";
lvc.cx =70;
m_ListCtrl.InsertColumn(2,&lvc);
lvc.iSubItem = 3;
lvc.pszText = (char *)"出售日期";
lvc.cx = 130;
m_ListCtrl.InsertColumn(3,&lvc);
lvc.iSubItem = 4;
lvc.pszText = (char *)"價格";
lvc.cx = 70;
m_ListCtrl.InsertColumn(4,&lvc);
lvc.iSubItem = 5;
lvc.pszText = (char *)"配送";
lvc.cx = 70;
m_ListCtrl.InsertColumn(5,&lvc);
lvc.iSubItem = 6;
lvc.pszText = (char *)"稅費";
lvc.cx = 70;
m_ListCtrl.InsertColumn(6,&lvc);
lvc.iSubItem = 7;
lvc.pszText = (char *)"x";
lvc.cx = 70;
m_ListCtrl.InsertColumn(7,&lvc);
lvc.iSubItem = 8;
lvc.pszText = (char *)"入庫時間";
lvc.cx = 90;
m_ListCtrl.InsertColumn(8,&lvc);
lvc.iSubItem = 9;
lvc.pszText = (char *)"備注";
lvc.cx = 190;
m_ListCtrl.InsertColumn(9,&lvc);
lvc.iSubItem = 10;
lvc.pszText = (char *)"修改時間";
lvc.cx = 130;
m_ListCtrl.InsertColumn(10,&lvc);
///////////////////////////////////////////////////////////////
UpdateData(FALSE);
cursel=show();
m_ListCtrl.SetItemState(cursel, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
m_inout.InsertString (0,"售出");
m_inout.InsertString (1,"入庫");
m_inout.InsertString(2,"所有售出");
m_inout.InsertString(3,"所有庫存");
m_inout.InsertString(4,"[取消]");
SYSTEMTIME systemtime;
systemtime.wHour =0;
systemtime.wMinute=1;
systemtime.wSecond =1;
GetLocalTime(&systemtime);
m_timefrom=systemtime;
systemtime.wHour =23;
systemtime.wMinute=59;
systemtime.wSecond =59;
m_timeto=systemtime;
UpdateData(FALSE);
m_inout.SetCurSel (4);
return TRUE; // return TRUE unless you set the focus to a control
}
void CProDlg::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 CProDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CProDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CProDlg::OnIn()
{
// TODO: Add your control notification handler code here
CInDlg test;
test.DoModal ();
m_db.Requery();
show(strsort);
delete test;
}
void CProDlg::OnEditkind()
{
// TODO: Add your control notification handler code here
CKindDlg test;
test.DoModal();
m_db.Requery();
show(strsort);
delete test;
}
int CProDlg::show(CString strsort)
{
if(m_db.IsOpen ())m_db.Close ();
m_db.Open ();
m_db.m_strSort=strsort;
m_db.Requery();
if(!m_db.IsOpen ())
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -