【VC开源代码栏目提醒】:网学会员,鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“DlgInputBackQuery4.cpp”一文,供大家参考学习!
// DlgInputBackQuery4.cpp : implementation file
//
#include "stdafx.h"
#include "aaa.h"
#include "DlgInputBackQuery4.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgInputBackQuery4 dialog
CDlgInputBackQuery4::CDlgInputBackQuery4(CWnd* pParent /*=NULL*/)
: CDialog(CDlgInputBackQuery4::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgInputBackQuery4)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgInputBackQuery4::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgInputBackQuery4)
DDX_Control(pDX, IDC_LIST1, list);
DDX_Control(pDX, IDC_EDIT1, value);
DDX_Control(pDX, IDC_DATETIMEPICKER2, endtime);
DDX_Control(pDX, IDC_DATETIMEPICKER1, starttime);
DDX_Control(pDX, IDC_COMBO1, fields);
DDX_Control(pDX, IDC_CHECK2, check2);
DDX_Control(pDX, IDC_CHECK1, check1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgInputBackQuery4, CDialog)
//{{AFX_MSG_MAP(CDlgInputBackQuery4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgInputBackQuery4 message handlers
void CDlgInputBackQuery4::CancelQuery()
{
check1.SetCheck(0);
check2.SetCheck(0);
fields.SetCurSel(-1);
value.SetWindowText("");
CTime temp = CTime::GetCurrentTime();
starttime.SetTime(&temp);
endtime.SetTime(&temp);
list.DeleteAllItems();
}
BOOL CDlgInputBackQuery4::OnInitDialog()
{
CDialog::OnInitDialog();
list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_INFOTIP|LVS_EX_SUBITEMIMAGES|LVS_EX_GRIDLINES );
//向表格中添加列
list.InsertColumn(0,"仓库名称");
list.InsertColumn(1,"商品编号");
list.InsertColumn(2,"商品名称");
list.InsertColumn(3,"单价");
list.InsertColumn(4,"数量");
list.InsertColumn(5,"折扣");
list.InsertColumn(6,"金额");
list.InsertColumn(7,"操作员");
list.InsertColumn(8,"退货票号");
list.SetColumnWidth(0,60);
list.SetColumnWidth(1,100);
list.SetColumnWidth(2,100);
list.SetColumnWidth(3,50);
list.SetColumnWidth(4,50);
list.SetColumnWidth(5,50);
list.SetColumnWidth(6,60);
list.SetColumnWidth(7,50);
list.SetColumnWidth(8,110);
return TRUE;
}
BOOL CDlgInputBackQuery4::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message ==WM_KEYDOWN)
{
if (pMsg->wParam==13)
pMsg->wParam = 9;
}
return CDialog::PreTranslateMessage(pMsg);
}
void CDlgInputBackQuery4::Query()
{
if ((check1.GetCheck() ==false)&&(check2.GetCheck()==false))
{
MessageBox("请设置查询条件","提示",64);
return;
}
if ( (check1.GetCheck()==true)&&(check2.GetCheck()==false))
{
CString c_field,c_value;
fields.GetWindowText(c_field);
value.GetWindowText(c_value);
if (c_field.IsEmpty()||(c_value.IsEmpty()))
{
MessageBox("请设置查询条件","提示",64);
return;
}
CString sql;
list.DeleteAllItems();
switch (fields.GetCurSel())
{
case 0:
{
c_field = "Cancelid";
//sql.Format("select a.stockname,a.merchandiseID,b.name,a.unitPrice and a.%s = '%s'",c_field,c_value);
sql.Format("select a.stockname,a.merchandiseID,b.name,a.unitPrice,a.numbers,a.rebate,a.paymoney,c.operator,a.CancelID from tb_cancelinstock_sub a inner join tb_merchandiseinfo b on a.merchandiseID = b.id inner join tb_cancelinstock_main c on a.CancelID = c.CancelID and a.%s =