📄 rptdlgysysmx.cpp
字号:
// RptDlgYsysmx.cpp : implementation file
//
#include "stdafx.h"
#include "falcon_jxc.h"
#include "RptDlgYsysmx.h"
#include "FALCON_JXCView.h"
#include "message.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRptDlgYsysmx dialog
CRptDlgYsysmx::CRptDlgYsysmx(CWnd* pParent /*=NULL*/)
: CDialog(CRptDlgYsysmx::IDD, pParent)
{
//{{AFX_DATA_INIT(CRptDlgYsysmx)
m_strBumen = _T("");
m_strZhibiaoren = _T("");
m_strZhibiaoriqi = _T("");
m_strBaobiaomingcheng = _T("");
//}}AFX_DATA_INIT
//Andrew--------------------------------------------------
m_pView = NULL;
}
CRptDlgYsysmx::CRptDlgYsysmx(CFALCON_JXCView * pView)
{
m_pView = pView;
}
BOOL CRptDlgYsysmx::Create()
{
return CDialog::Create(CRptDlgYsysmx::IDD);
}
//----------------------------------------------------------
void CRptDlgYsysmx::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRptDlgYsysmx)
DDX_Control(pDX, IDC_DATE_QI, m_ctrTimeQi);
DDX_Control(pDX, IDC_DATE_ZHI, m_ctrTimeZhi);
DDX_Control(pDX, IDC_BUMEN, m_ctrBumen);
DDX_CBString(pDX, IDC_BUMEN, m_strBumen);
DDX_Control(pDX, IDC_MSFLEXGRID1, m_CMSFlexGrid);
DDX_Text(pDX, IDC_ZHIBIAOREN, m_strZhibiaoren);
DDX_Text(pDX, IDC_ZHIBIAORIQI, m_strZhibiaoriqi);
DDX_Text(pDX, IDC_BAOBIAOMINGCHENG, m_strBaobiaomingcheng);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRptDlgYsysmx, CDialog)
//{{AFX_MSG_MAP(CRptDlgYsysmx)
ON_BN_CLICKED(IDC_TONGJI, OnTongji)
ON_BN_CLICKED(IDC_PRT_PRINT, OnPrtPrint)
ON_BN_CLICKED(IDC_TUICHU, OnTuichu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRptDlgYsysmx message handlers
BOOL CRptDlgYsysmx::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_CMSFlexGrid.SetCols(14);
m_CMSFlexGrid.SetTextMatrix(0,0,"订单日期");//0
m_CMSFlexGrid.SetTextMatrix(0,1,"缴款单号");
m_CMSFlexGrid.SetTextMatrix(0,2,"预定单号");//1
m_CMSFlexGrid.SetTextMatrix(0,3,"订金");//2
m_CMSFlexGrid.SetTextMatrix(0,4,"金额");//3
m_CMSFlexGrid.SetTextMatrix(0,5,"预付日期");//4
m_CMSFlexGrid.SetTextMatrix(0,6,"缴款单号");
m_CMSFlexGrid.SetTextMatrix(0,7,"收款凭证号");//9
m_CMSFlexGrid.SetTextMatrix(0,8,"已付款");//5
m_CMSFlexGrid.SetTextMatrix(0,9,"欠尾款"); //6
m_CMSFlexGrid.SetTextMatrix(0,10,"补尾款日期");//7
m_CMSFlexGrid.SetTextMatrix(0,11,"缴款单号");
m_CMSFlexGrid.SetTextMatrix(0,12,"补尾款"); //8
m_CMSFlexGrid.SetTextMatrix(0,13,"备注"); //10
m_ctrBumen.AddString("南洋");
m_ctrBumen.AddString("欧典");
m_ctrBumen.AddString("圣地亚");
m_ctrBumen.SetCurSel(0);
CTime time=CTime::GetCurrentTime();
m_ctrTimeQi.SetTime(&time);
m_ctrTimeZhi.SetTime(&time);
int yy,mm,dd;
CString str;
yy=time.GetYear();
mm=time.GetMonth();
dd=time.GetDay();
str.Format("%d-%d-%d",yy,mm,dd);
m_strZhibiaoriqi = str;
GetWindowText(m_strBaobiaomingcheng);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRptDlgYsysmx::OnTongji()
{
// TODO: Add your control notification handler code here
UpdateData();
CString strtemp,str;
if (m_strBumen == "")
{
AfxMessageBox("请选择部门!");
return;
}
GetWindowText(m_strBaobiaomingcheng);
m_strBaobiaomingcheng = m_strBumen + "-" + m_strBaobiaomingcheng;
UpdateData(FALSE);
CTime timeQi,timeZhi;
m_ctrTimeQi.GetTime(timeQi);
m_ctrTimeZhi.GetTime(timeZhi);
int yy,mm,dd;
yy = timeQi.GetYear();
str.Format("%d",yy);
m_sTimeqi = str;
mm = timeQi.GetMonth();
if(mm < 10)
{
str.Format("0%d",mm);
m_sTimeqi += str;
}
else
{
str.Format("%d",mm);
m_sTimeqi += str;
}
dd = timeQi.GetDay();
if(dd < 10)
{
str.Format("0%d",dd);
m_sTimeqi += str;
}
else
{
str.Format("%d",dd);
m_sTimeqi += str;
}
yy = timeZhi.GetYear();
str.Format("%d",yy);
m_sTimezhi = str;
mm = timeZhi.GetMonth();
if(mm < 10)
{
str.Format("0%d",mm);
m_sTimezhi += str;
}
else
{
str.Format("%d",mm);
m_sTimezhi += str;
}
dd = timeZhi.GetDay();
if(dd < 10)
{
str.Format("0%d",dd);
m_sTimezhi += str;
}
else
{
str.Format("%d",dd);
m_sTimezhi += str;
}
CFALCON_JXCDoc* pDoc = m_pView->GetDocument();
ASSERT_VALID(pDoc);
CString strRequest;
strRequest = m_sTimeqi;
strRequest += CHARFLAG;
strRequest += m_sTimezhi;
strRequest += CHARFLAG;
strRequest += m_strBumen;
strRequest += CHARFLAG;
if(pDoc->ConnectToServer())
{
pDoc->SendMsg(strRequest,1519);
}
else
return;
a:
if(pDoc->m_b2519)
{
if(pDoc->m_pMsg->ShortMessage != "")
{
int n = 0;
m_CMSFlexGrid.SetRows(pDoc->m_iRow+1);
for(int i = 1; i < pDoc->m_iRow+1; i++)
{
str = pDoc->m_StrArray[n+0];
m_CMSFlexGrid.SetTextMatrix(i,0,str);
str = pDoc->m_StrArray[n+1];
m_CMSFlexGrid.SetTextMatrix(i,2,str);
str = pDoc->m_StrArray[n+2];
m_CMSFlexGrid.SetTextMatrix(i,3,str);
str = pDoc->m_StrArray[n+3];
m_CMSFlexGrid.SetTextMatrix(i,4,str);
str = pDoc->m_StrArray[n+4];
m_CMSFlexGrid.SetTextMatrix(i,5,str);
str = pDoc->m_StrArray[n+5];
m_CMSFlexGrid.SetTextMatrix(i,8,str);
str = pDoc->m_StrArray[n+6];
m_CMSFlexGrid.SetTextMatrix(i,9,str);
str = pDoc->m_StrArray[n+7];
m_CMSFlexGrid.SetTextMatrix(i,10,str);
str = pDoc->m_StrArray[n+8];
m_CMSFlexGrid.SetTextMatrix(i,12,str);
str = pDoc->m_StrArray[n+9];
m_CMSFlexGrid.SetTextMatrix(i,7,str);
str = pDoc->m_StrArray[n+10];
m_CMSFlexGrid.SetTextMatrix(i,13,str);
n += 11;
}
m_CMSFlexGrid.Refresh();
}
else
{
AfxMessageBox("未查到相符记录!");
m_CMSFlexGrid.SetRows(2);
for (int j=0; j<14;j++)
{
m_CMSFlexGrid.SetTextMatrix(1,j,"");
}
m_CMSFlexGrid.Refresh();
}
pDoc->m_b2519 = FALSE;
}
else
{
pDoc->ProcessReadMessage();
goto a;
}
UpdateData(FALSE);
}
void CRptDlgYsysmx::OnPrtPrint()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_CMSFlexGrid.GetTextMatrix(1,0) == "")
{
AfxMessageBox("无可打印数据!");
return ;
}
OnColSata(); //同进每列的最长字节串
SendMessage(WM_COMMAND,ID_FILE_PRINT_PREVIEW);
}
void CRptDlgYsysmx::OnTuichu()
{
// TODO: Add your control notification handler code here
m_pView->m_iPrtItem = -1;
if (m_pView != NULL)
{
DestroyWindow();
}
else
{
CDialog::OnOK();
}
}
void CRptDlgYsysmx::OnColSata()
{
//Rows
int iRows = m_CMSFlexGrid.GetRows()-1;
if (iRows%20 != 0)
{
m_pView->m_iPageNum = int(iRows/20.0 + 1.0);
}
else
{
m_pView->m_iPageNum = iRows/20;
}
//ColWidths
m_pView->m_iAColWidth.RemoveAll();
m_pView->m_iAColWidth.SetSize(m_CMSFlexGrid.GetCols());
for (int i=0; i<m_CMSFlexGrid.GetCols(); i++)
{
int iMaxLen = 0;
for (int j=0; j<m_CMSFlexGrid.GetRows(); j++)
{
int iLen = strlen(m_CMSFlexGrid.GetTextMatrix(j,i));
iMaxLen = iMaxLen > iLen ? iMaxLen : iLen;
}
m_pView->m_iAColWidth.SetAt(i,iMaxLen);
}
//表格内容及字串
CTime time;
int yy,mm,dd;
CString str;
m_ctrTimeQi.GetTime(time);
yy =time.GetYear();
mm =time.GetMonth();
dd =time.GetDay();
str.Format("%d-%d-%d",yy,mm,dd);
m_pView->m_strTimeQi = str;
m_ctrTimeZhi.GetTime(time);
yy =time.GetYear();
mm =time.GetMonth();
dd =time.GetDay();
str.Format("%d-%d-%d",yy,mm,dd);
m_pView->m_strTimeZhi = str;
m_pView->m_strBaobiaomingcheng = m_strBaobiaomingcheng;
m_pView->m_strZhibiaoriqi = m_strZhibiaoriqi;
m_pView->m_strZhibiaoren = m_strZhibiaoren;
m_pView->m_CMSFlexGrid = &m_CMSFlexGrid;
}
void CRptDlgYsysmx::OnOK()
{
//Dummy OnOk function!
}
void CRptDlgYsysmx::OnCancel()
{
//Dummy OnCancel function!
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -