📄 dlgtuihuo.cpp
字号:
// DlgTuihuo.cpp : implementation file
//
#include "stdafx.h"
#include "falcon_jxc.h"
#include "DlgTuihuo.h"
#include "Tuihuomingxi.h"
#include "mainfrm.h"
#include "FALCON_JXCView.h"
#include "message.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgTuihuo dialog
CDlgTuihuo::CDlgTuihuo(CWnd* pParent /*=NULL*/)
: CDialog(CDlgTuihuo::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgTuihuo)
m_strBaoguanren = _T("");
m_strBeizhu = _T("");
m_strChepaihao = _T("");
m_strJinli = _T("");
m_strKuhao = _T("");
m_strShenheren = _T("");
m_strTihuoren = _T("");
m_strTuihuoshang = _T("");
m_strZhidanren = _T("");
m_strZhidanriqi = _T("");
m_strTuihuobumen = _T("");
//}}AFX_DATA_INIT
m_nRowNum = 1;
m_iSelectRow = 0;
m_bSave = FALSE;
}
void CDlgTuihuo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgTuihuo)
DDX_Control(pDX, IDC_TUIHUOBUMEN2, m_ctrTuihuobumen);
DDX_Text(pDX, IDC_BAOGUANREN, m_strBaoguanren);
DDX_Text(pDX, IDC_BEIZHU, m_strBeizhu);
DDX_Text(pDX, IDC_CHEPAIHAO, m_strChepaihao);
DDX_Text(pDX, IDC_JINGLI, m_strJinli);
DDX_Text(pDX, IDC_KUHAO, m_strKuhao);
DDX_Control(pDX, IDC_MSFLEXGRID1, m_ctrMSFlexGrid);
DDX_Text(pDX, IDC_SHENHEREN, m_strShenheren);
DDX_Text(pDX, IDC_TIHUOREN, m_strTihuoren);
DDX_Text(pDX, IDC_TUIHUOSHANG, m_strTuihuoshang);
DDX_Text(pDX, IDC_ZHIDANREN2, m_strZhidanren);
DDX_Text(pDX, IDC_ZHIDANRIQI, m_strZhidanriqi);
DDX_CBString(pDX, IDC_TUIHUOBUMEN2, m_strTuihuobumen);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgTuihuo, CDialog)
//{{AFX_MSG_MAP(CDlgTuihuo)
ON_BN_CLICKED(IDC_QUEDING, OnQueding)
ON_BN_CLICKED(IDC_TUICHU1, OnTuichu1)
ON_BN_CLICKED(IDC_TIANJIA, OnTianjia)
ON_BN_CLICKED(IDC_SHANCHU, OnShanchu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgTuihuo message handlers
void CDlgTuihuo::OnQueding()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_ctrMSFlexGrid.GetTextMatrix(1,0) == "")
{
return;
}
CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
CFALCON_JXCDoc* pDoc = pView->GetDocument();
if(pDoc->ConnectToServer())
{
pDoc->SendMsg("",1230);
}
else
return;
a:
if(pDoc->m_b2230)
{
m_sCkdbh=pDoc->m_pMsg->ShortMessage;
pDoc->m_b2230 = FALSE;
}
else
{
pDoc->ProcessReadMessage();
goto a;
}
int i,j;
int iRows = m_nRowNum-1;
int iCols = 20;
CString strInsert,strtemp;
strtemp.Format("%d",iRows);
strInsert = strtemp;
strInsert+=CHARFLAG;
strtemp.Format("%d",iCols);
strInsert += strtemp;
strInsert+=CHARFLAG;
int iTemp = atoi(m_sCkdbh);
iTemp++;
for (i=0; i<iRows; i++)
{
m_sCkdbh.Format("%d",iTemp);
strInsert += m_sCkdbh;
strInsert+=CHARFLAG;
strInsert += "";
strInsert+=CHARFLAG;
strInsert += "";
strInsert+=CHARFLAG;
strInsert+=m_strTuihuobumen;
strInsert+=CHARFLAG;
strInsert+=m_strTuihuoshang;
strInsert+=CHARFLAG;
strInsert+=m_strChepaihao;
strInsert+=CHARFLAG;
strInsert+=m_strKuhao;
strInsert+=CHARFLAG;
for(j=0;j<5;j++)
{
strInsert+=m_ctrMSFlexGrid.GetTextMatrix(i+1,j);
strInsert+=CHARFLAG;
}
strInsert+=m_strJinli;
strInsert+=CHARFLAG;
strInsert+=m_strBaoguanren;
strInsert+=CHARFLAG;
strInsert+=m_strTihuoren;
strInsert+=CHARFLAG;
strInsert+=m_strZhidanren;
strInsert+=CHARFLAG;
strInsert+=m_strZhidanriqi;
strInsert+=CHARFLAG;
strInsert+=m_strShenheren;
strInsert+=CHARFLAG;
strInsert+=m_strBeizhu;
strInsert+=CHARFLAG;
strInsert+="退货";
strInsert+=CHARFLAG;
}
if(pDoc->ConnectToServer())
{
pDoc->SendMsg(strInsert,1232);
m_ctrMSFlexGrid.SetRows(2);
for (int j=0; j<5;j++)
{
m_ctrMSFlexGrid.SetTextMatrix(1,j,"");
}
}
else
return;
/*/////////////////////
添加打印函数
*/////////////////////
a1:
if(pDoc->m_b2232)
{
pDoc->m_b2232 = FALSE;
m_bSave = TRUE;
m_strBaoguanren = _T("");
m_strBeizhu = _T("");
m_strChepaihao = _T("");
m_strJinli = _T("");
m_strKuhao = _T("");
m_strShenheren = _T("");
m_strTihuoren = _T("");
m_strTuihuoshang = _T("");
m_strZhidanren = _T("");
UpdateData(FALSE);
}
else
{
pDoc->ProcessReadMessage();
goto a1;
}
// CDialog::OnOK();
}
void CDlgTuihuo::OnTuichu1()
{
// TODO: Add your control notification handler code here
if (m_bSave == FALSE && AfxMessageBox("尚未出单!是否退出?", MB_YESNO | MB_ICONQUESTION) == IDNO)
{
return;
}
else
{
CDialog::OnOK();
}
}
void CDlgTuihuo::OnOK()
{
//Dummy OnOk function!
}
void CDlgTuihuo::OnCancel()
{
//Dummy OnCancel function!
}
BOOL CDlgTuihuo::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_ctrMSFlexGrid.SetRows(1);
m_ctrMSFlexGrid.SetTextArray(0,"编码");
m_ctrMSFlexGrid.SetTextArray(1,"名称");
m_ctrMSFlexGrid.SetTextArray(2,"规格");
m_ctrMSFlexGrid.SetTextArray(3,"单位");
m_ctrMSFlexGrid.SetTextArray(4,"数量");
m_ctrTuihuobumen.AddString("库房");
m_ctrTuihuobumen.AddString("南洋");
m_ctrTuihuobumen.AddString("欧典");
m_ctrTuihuobumen.AddString("圣地亚");
m_ctrTuihuobumen.SetCurSel(0);
CTime time=CTime::GetCurrentTime();
CString str;
int yy,mm,dd;
yy=time.GetYear();
mm=time.GetMonth();
dd=time.GetDay();
str.Format("%d-%d-%d",yy,mm,dd);
m_strZhidanriqi = str;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgTuihuo::OnTianjia()
{
// TODO: Add your control notification handler code here
UpdateData();
CTuihuomingxi dlg;
if(dlg.DoModal() == IDOK)
{
for(int i = 1; i < m_nRowNum; i++)
{
if(dlg.m_strBianma == m_ctrMSFlexGrid.GetTextMatrix(i,0))
{
AfxMessageBox("该商品已添加!");
return;
}
}
m_nRowNum++;
m_ctrMSFlexGrid.SetRows(m_nRowNum);
CString str;
str = dlg.m_strBianma;
m_ctrMSFlexGrid.SetTextMatrix(m_nRowNum-1,0,str);
str = dlg.m_strMingcheng;
m_ctrMSFlexGrid.SetTextMatrix(m_nRowNum-1,1,str);
str = dlg.m_strGuige;
m_ctrMSFlexGrid.SetTextMatrix(m_nRowNum-1,2,str);
str = dlg.m_strDanwei;
m_ctrMSFlexGrid.SetTextMatrix(m_nRowNum-1,3,str);
str.Format("%d",dlg.m_iShuliang);
m_ctrMSFlexGrid.SetTextMatrix(m_nRowNum-1,4,str);
UpdateData(FALSE);
}
}
void CDlgTuihuo::OnShanchu()
{
// TODO: Add your control notification handler code here
CString str;
if (m_iSelectRow >0)
{
if ( m_ctrMSFlexGrid.GetTextMatrix(m_iSelectRow,0) == "")
{
return;
}
else
{
str.Format("是否删除第%d条记录?",m_iSelectRow);
if(AfxMessageBox(str,MB_YESNO) == IDYES)
{
if(m_iSelectRow == 1 && m_nRowNum ==2)
{
m_nRowNum--;
m_ctrMSFlexGrid.SetRows(m_nRowNum);
}
else
{
m_ctrMSFlexGrid.RemoveItem(m_iSelectRow);
m_ctrMSFlexGrid.Refresh();
m_nRowNum--;
m_ctrMSFlexGrid.SetRows(m_nRowNum);
}
}
}
m_iSelectRow=0;
}
else
{
AfxMessageBox("请选择要删除的记录!");
return;
}
}
BEGIN_EVENTSINK_MAP(CDlgTuihuo, CDialog)
//{{AFX_EVENTSINK_MAP(CDlgTuihuo)
ON_EVENT(CDlgTuihuo, IDC_MSFLEXGRID1, -600 /* Click */, OnClickMsflexgrid1, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CDlgTuihuo::OnClickMsflexgrid1()
{
// TODO: Add your control notification handler code here
m_iSelectRow = m_ctrMSFlexGrid.GetRow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -