【VC开源代码栏目提醒】:网学会员--在 VC开源代码编辑为广大网友搜集整理了:DCheck.cpp绩等信息,祝愿广大网友取得需要的信息,参考学习。
// DCheck.cpp : implementation file
//
#include "stdafx.h"
#include "wzglxt.h"
#include "DCheck.h"
#include "externDllHeader.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDCheck dialog
extern CQpglxtApp theApp;
CDCheck::CDCheck(CWnd* pParent /*=NULL*/)
: CDialog(CDCheck::IDD, pParent)
{
//{{AFX_DATA_INIT(CDCheck)
//}}AFX_DATA_INIT
}
void CDCheck::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDCheck)
DDX_Control(pDX, IDC_INPUT_STAOP, m_StaOP);
DDX_Control(pDX, IDC_INPUT_STAID, m_StaID);
DDX_Control(pDX, IDC_INPUT_STADATE, m_StaDate);
DDX_Control(pDX, IDC_INPUT_GRID, m_Grid);
DDX_Control(pDX, IDC_INPUT_EDTSTORE, m_EdtStore);
DDX_Control(pDX, IDC_INPUT_EDTDEAR, m_EdtDear);
DDX_Control(pDX, IDC_INPUT_BUTUNDO, m_ButUndo);
DDX_Control(pDX, IDC_INPUT_BUTSAVE, m_ButSave);
DDX_Control(pDX, IDC_INPUT_BUTPRINT, m_ButPrint);
DDX_Control(pDX, IDC_INPUT_BUTEXIT, m_ButExit);
DDX_Control(pDX, IDC_INPUT_BUTBOOKIN, m_ButBookin);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDCheck, CDialog)
//{{AFX_MSG_MAP(CDCheck)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_INPUT_BUTBOOKIN, OnInputButbookin)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_INPUT_BUTEXIT, OnInputButexit)
ON_BN_CLICKED(IDC_INPUT_BUTSAVE, OnInputButsave)
ON_BN_CLICKED(IDC_INPUT_BUTUNDO, OnInputButundo)
ON_BN_CLICKED(IDC_INPUT_BUTPRINT, OnInputButprint)
//}}AFX_MSG_MAP
ON_MESSAGE(DIY_SETFOCUS,OnCellSetFocus)
ON_MESSAGE(DIY_KILLFOCUS,OnCellKillFocus)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDCheck message handlers
void CDCheck::OnOK()
{
// TODO: Add extra validation here
// CDialog::OnOK();
}
BOOL CDCheck::OnInitDialog()
{
CDialog::OnInitDialog();
m_StaDate.SetTextColor(RGB(0,0,0));
m_StaID.SetTextColor(RGB(0,0,0));
m_StaOP.SetTextColor(RGB(0,0,0));
CString sSQL;
rst.Open("仓库信息查询");
m_EdtStore.Initialize(this->GetParent());
m_EdtStore.StartUpAssciation=false;
m_EdtStore.SetRecordset(rst);
m_EdtStore.SetSelectField("名称");
sSQL.Format("SELECT 编号, FROM 员工信息表");
rst.Open(sSQL,adCmdText);
m_EdtDear.Initialize(this->GetParent());
m_EdtDear.SetRecordset(rst);
m_EdtDear.SetSelectField("");
CString Fields[]={"配件名称","适用范围","规格","产地","计量单位","库存数量","盘点数量"};
int ColWidth[]={165,90,100,100,70,75,75};
for(int m=0;m<7;m++)
{
m_Grid.InsertColumn(m,Fields[m]);
m_Grid.SetColumnWidth(m,ColWidth[m]);
}
m_Grid.m_Edit.Initialize(this->GetParent());
this->m_StaOP.SetWindowText(OP);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDCheck::OnPaint()
{
CPaintDC dc(this); // device context for painting
//根据分辩率画背景
CBitmap bit;
CDC memDC;
CRect rect;
this->GetClientRect(&rect);
bit.LoadBitmap(IDB_KCPD);
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&bit);
dc.BitBlt(22,23,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY);
memDC.DeleteDC();
::DeleteObject(&bit);
// Do not call CDialog::OnPaint() for painting messages
}
void CDCheck::Clear()
{
this->m_EdtStore.SetWindowText("");
this->m_Grid.DeleteAllItems();
}
void CDCheck::Enabled(bool bEnabled)
{
this->m_Grid.ReadOnly(bEnabled);
this->m_ButBookin.EnableWindow(bEnabled);
this->m_ButExit.EnableWindow(bEnabled);
this->m_ButPrint.EnableWindow(bEnabled);
this->m_ButSave.EnableWindow(!bEnabled);
this->m_ButUndo.EnableWindow(!bEnabled);
}
void CDCheck::OnInputButbookin()
{
CTime time;
CString cTime,NewID;
NewID=ado.AutoNumber("盘点信息表","票号","PD",3);
NewID=NewID+" ";
this->m_StaID.SetWindowText(NewID);
time=time.GetCurrentTime();
cTime=CTimeToCString(time);
cTime=cTime+" ";
this->m_StaDate.SetWindowText(cTime);
this->m_EdtStore.SetFocus();
this->Enabled(false);
this->Clear();
}
HBRUSH CDCheck::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(pWnd==&this->m_StaDate|| pWnd==&this->m_StaID)
{
pDC->SetBkColor(RGB(255,255,255));
pDC->SetTextColor(RGB(0,0,0));
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CDCheck::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->hwnd==this->m_EdtDear&&pMsg->message==WM_KEYDOWN&&pMsg->wParam==9)
{
this->m_Grid.InsertItem(0,"");
this->m_Grid.SetRow(0);
this->m_Grid.SetCol(0);
this->m_Grid.BeginEdit(0,0);
this->m_Grid.m_Edit.SetFocus();
pMsg->wParam=VK_CONTROL ;
}
if(pMsg->message==WM_KEYDOWN&&pMsg->wParam==VK_ESCAPE)
{
pMsg->wParam=VK_CONTROL ;
this->OnInputButexit();
}
return CDialog::PreTranslateMessage(pMsg);
}
void CDCheck::OnInputButexit()
{
CString MsgText;
MsgText.Format("确定要退出库存盘点模块吗?");
if(MessageBox(MsgText,"系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
return;
this->OnCancel();
}
void CDCheck::OnCellSetFocus()
{
CString sSQL, sName,sType,sSpec,sAddr;
switch(m_Grid.GetCol())
{
case 0:
m_Grid.m_Edit.SetReadOnly(false);
m_Grid.m_Edit.NumberOnly(false);
m_Grid.m_Edit.PopHide=false;
m_Grid.m_Edit.EnterNumber=0;
m_Grid.m_Edit.ClearAll();
rst.Open("SELECT DISTINCT 名称,简称 from 商品信息表",adCmdText);
m_Grid.m_Edit.StartUpAssciation=true;
m_Grid.m_Edit.SetRecordset(rst);
m_Grid.m_Edit.SetSelectField("名称");
m_Grid.m_Edit.AutoPosition();
break;
case 1:
m_Grid.m_Edit.SetReadOnly(false);
m_Grid.m_Edit.NumberOnly(false);
m_Grid.m_Edit.PopHide=false;
m_Grid.m_Edit.EnterNumber=0;
m_Grid.m_Edit.ClearAll();
sName=m_Grid.GetItemText(m_Grid.GetRow(),0);
sSQL.Format("SELECT DISTINCT 名称,适用范围 from 商品信息查询 WHERE 名称='%s'",sName);
rst.Open(sSQL,adCmdText);
m_Grid.m_Edit.StartUpAssciation=false;
m_Grid.m_Edit.SetRecordset(rst);
m_Grid.m_Edit.SetSelectField("适用范围");
m_Grid.m_Edit.AutoPosition();
break;
case 2:
m_Grid.m_Edit.SetReadOnly(false);
m_Grid.m_Edit.NumberOnly(false);
m_Grid.m_Edit.PopHide=false;
m_Grid.m_Edit.EnterNumber=0;
m_Grid.m_Edit.ClearAll();
sName=m_Grid.GetItemText(m_Grid.GetRow(),0);
sType=m_Grid.GetItemText(m
上一篇:
AbortFrm.pas
下一篇:
让我掉下眼泪的