【VC开源代码栏目提醒】:网学会员VC开源代码为您提供DlgWLZ.cpp参考,解决您在DlgWLZ.cpp学习中工作中的难题,参考学习。
// DlgWLZ.cpp : implementation file
//
#include "stdafx.h"
#include "a1.h"
#include "DlgWLZ.h"
#include "ScrollPrintView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgWLZ dialog
CDlgWLZ::CDlgWLZ(bool iskh,CWnd* pParent /*=NULL*/)
: CDialog(CDlgWLZ::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgWLZ)
//}}AFX_DATA_INIT
this->m_bKh=iskh;
m_draw=new CDrawWLZ(this);
}
void CDlgWLZ::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgWLZ)
DDX_Control(pDX, IDC_BUTTON_QUERY, m_btnQuery);
DDX_Control(pDX, IDC_EDIT2, m_editQk);
DDX_Control(pDX, IDC_EDIT1, m_editYsfk);
DDX_Control(pDX, IDC_DATETIMEPICKER2, m_tcRqUp);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_tcRqDown);
DDX_Control(pDX, IDC_EDIT_KHNAME, m_editName);
DDX_Control(pDX, IDC_EDIT_KHID, m_editId);
DDX_Control(pDX, IDC_LIST1, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgWLZ, CDialog)
//{{AFX_MSG_MAP(CDlgWLZ)
ON_BN_CLICKED(IDC_BUTTON_PRINT, OnButtonPrint)
ON_BN_CLICKED(IDC_BUTTON_QUERY, OnButtonQuery)
ON_WM_MOVE()
//}}AFX_MSG_MAP
ON_MESSAGE(MYMESSAGE_XSDJ_SETTHEFOCUS,SetTheFocus)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgWLZ message handlers
void CDlgWLZ::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
bool CDlgWLZ::InitBaseInfo()
{
m_font.CreateFont(-16, 0, 0, 0, 400, FALSE, FALSE,
0,GB2312_CHARSET , OUT_DEFAULT_PRECIS,//ANSI_CHARSET
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
VARIABLE_PITCH | FF_SCRIPT, "楷体_GB2312");//DEFAULT_PITCH FF_MODERN
m_headfont.CreateFont(-24, 0, 0, 0, 400, FALSE, FALSE,
0,GB2312_CHARSET , OUT_DEFAULT_PRECIS,//ANSI_CHARSET
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
VARIABLE_PITCH | FF_SCRIPT, "楷体_GB2312");//DEFAULT_PITCH FF_MODERN
CRect rect;
this->GetClientRect(&rect);
rect.top+=10;
rect.bottom-=50;
rect.left+=5;
rect.right-=5;
CString title,id,name;
if(this->m_bKh)
{
title="客户往来帐:";
id="客户编号:";
name="客户名称:";
}
else
{
title="供应商往来帐:";
id="供应商编号:";
name="供应商名称:";
}
m_whiteframe.Create(title,WS_CHILD|WS_VISIBLE,rect,this);
m_whiteframe.SetFont(&m_headfont,true);
rect=CRect(20,40,100,65);
m_wfId.Create(id,WS_CHILD|WS_VISIBLE,rect,&m_whiteframe);
m_wfId.SetFont(&m_font,true);
rect.OffsetRect(0,30);
m_wfName.Create(name,WS_CHILD|WS_VISIBLE,rect,&m_whiteframe);
m_wfName.SetFont(&m_font,true);
rect=CRect(450,10,465,35);
m_wfRqDown.Create("从:",WS_CHILD|WS_VISIBLE,rect,&m_whiteframe);
m_wfRqDown.SetFont(&m_font,true);
rect.OffsetRect(0,20);
m_wfRqUp.Create("到:",WS_CHILD|WS_VISIBLE,rect,&m_whiteframe);
m_wfRqUp.SetFont(&m_font,true);
this->m_tcRqDown.SetParent(&m_whiteframe);
this->m_tcRqUp.SetParent(&m_whiteframe);
this->m_btnQuery.SetParent(&m_whiteframe);
this->m_editId.SetParent(&m_whiteframe);
this->m_editName.SetParent(&m_whiteframe);
this->m_editYsfk.SetParent(&m_whiteframe);
this->m_editQk.SetParent(&m_whiteframe);
this->m_editQk.SetWindowText("欠款:");
if(m_bKh)
this->m_editYsfk.SetWindowText("应收款:");
else
this->m_editYsfk.SetWindowText("应付款:");
m_dxs_ws=0.0;
m_dxsth_wf=0.0;
m_dxs_ys=0.0;
m_drk_wf=0.0;
m_drk_yf=0.0;
m_drkth_ws=0.0;
this->InitStringList();
return true;
}
bool CDlgWLZ::InitListView()
{
if(m_whiteframe.m_hWnd==NULL)return false;
CRect rect;
m_whiteframe.GetClientRect(&rect);
rect.top+=115;
rect.left+=2;
rect.right-=2;
rect.bottom-=30;
m_list.MoveWindow(&rect);
// m_list.setw
m_list.SetParent(&m_whiteframe);
this->m_list.ModifyStyle(LVS_EDITLABELS, 0L); //禁止标题编辑
m_list.ModifyStyle(0L, LVS_REPORT); //设为Report类型
m_list.ModifyStyle(0L, LVS_SHOWSELALWAYS); //始终高亮度被选中的表项
m_list.ModifyStyle(0L, LVS_NOSORTHEADER);
m_list.ModifyStyle( LVS_OWNERDRAWFIXED,0L);
m_list.SetExtendedStyle( LVS_EX_FULLROWSELECT | //允许整行选中
LVS_EX_GRIDLINES | //画出网格线
LVS_EX_FLATSB //扁平风格的滚动条
); // this->m_list.set
m_list.GetClientRect(&rect);
for(int k=0;k<6;k++)
{
m_list.InsertColumn(k,"");
m_list.SetColumnWidth(k,rect.Width()/6);
}
for(int i=0;i<25;i++)
{
m_list.InsertItem(i,"");
for(int j=1;j<6;j++)
{
m_list.SetItemText(i,j,"");
}
}
// this->RefreshListView();
return true;
}
bool CDlgWLZ::RefreshListView()
{
int i=0;
this->m_list.DeleteAllItems();
if(this->m_bKh)
{
this->m_strYsfk.Format("应收款:");
this->m_strQk.Format("欠款:");
}
else
{
this->m_strYsfk.Format("应付款:");
this->m_strQk.Format("欠款:");
}
this->m_list.SetRedraw(true);
this->m_list.SetRedraw(false);
if(this->m_bKh)
{
i=this->RefreshXSList(i)+1; m_list.InsertItem(i,"");
i=this->RefreshXSTHList(i)+1;m_list.InsertItem(i,"");
i=this->RefreshXSJZList(i)+1;m_list.InsertItem(i,"");
i=this->RefreshXSTHJZList(i)+1;m_list.InsertItem(i,"");
}
else
{
i=this->RefreshRKList(i)+1;m_list.InsertItem(i,"");
i=this->RefreshRKTHList(i)+1;m_list.InsertItem(i,"");
i=this->RefreshRKJZList(i)+1;m_list.InsertItem(i,"");
i=this->RefreshRKTHJZList(i)+1;m_list.InsertItem(i,"");
}
for(int j=0;j<6;j++)
this->m_list.SetColumnWidth(j,-2);
this->m_list.SetRedraw(true);
this->Invalidate();
return CalculateAndShowResult();
}
int CDlgWLZ::RefreshXSList(int i)
{
CString sql;
sql.Format("select xs_ph,ys,ss,ws,rq from tabxsph where rq>=#%s# and rq<=#%s# and kh_id ='%s' order by rq asc",
this->m_strRqDown,this->m_strRqUp,this->m_strId);
if(!this->m_runsql.CheckSQLResult(sql)) return i--;
this->m_list.InsertItem(i,"销售票号");
this->m_list.SetItemText(i,1,"应收");
this->m_list.SetItemText(i,2,"已收");
this->m_list.SetItemText(i,3,"未收");
this->m_list.SetItemText(i,4,"日期");
this->m_list.SetItemText(i,5,"销售登记");
_variant_t value;
double ys=0,ss=0;m_dxs_ws=0;this->m_dxs_ys=0.0;i++;
while(!m_runsql.m_recordset->adoEOF)
{
value=m_runsql.m_recordset->GetCollect("xs_ph");
if(value.vt!=VT_NULL)
m_list.InsertItem(i,(char*)(_bstr_t)value);
value=m_runsql.m_recordset->GetCollect("ys");
if(value.vt!=VT_NULL)
ys=ys+value.dblVal;
上一篇:
ClassSet_Unit.pas
下一篇:
jquery+css3实现的图片墙效果