?? countdialog.cpp
字號:
// CountDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Tally.h"
#include "CountDialog.h"
#include "GraphDia.h"
#include "Graph3d.h"
#include "matlib.h"
#include "TallyView.h"
#include "Histogram.h"
#include "Graph.h"
#include "Distributing.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCountDialog dialog
CCountDialog::CCountDialog(CWnd* pParent /*=NULL*/)
: CDialog(CCountDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CCountDialog)
m_OutInfo = _T("");
m_iMonth = -1;
m_OutInfo = "請選擇月份";
//}}AFX_DATA_INIT
pGraphDia = NULL;
}
BOOL CCountDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Histongram.EnableWindow(FALSE);
m_Graph.EnableWindow(FALSE);
m_Distributing.EnableWindow(FALSE);
m_3d.EnableWindow(FALSE);
//
//
// CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//
//// Get the active MDI child window.
// CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
//
//// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
//
//// Get the active view attached to the active MDI child
//// window.
// CTallyView *pView = (CTallyView *) pChild->GetActiveView();
//
// pGraphDiaOut =pView->pGraphDia;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCountDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCountDialog)
DDX_Control(pDX, HISTIDC_HISTOGRAM_BUTTON, m_Histongram);
DDX_Control(pDX, HISTIDC_GRAPH_BUTTON, m_Graph);
DDX_Control(pDX, HISTIDC_DISTRIBUTING_BUTTON, m_Distributing);
DDX_Control(pDX, HISTIDC_3D_BUTTON, m_3d);
DDX_Control(pDX, IDC_CHOSEMONTH, m_Month_ComboBox);
DDX_Control(pDX, IDC_COUNT_INFO, m_editOutInfo);
DDX_Text(pDX, IDC_COUNT_INFO, m_OutInfo);
DDX_CBIndex(pDX, IDC_CHOSEMONTH, m_iMonth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCountDialog, CDialog)
//{{AFX_MSG_MAP(CCountDialog)
ON_BN_CLICKED(HISTIDC_HISTOGRAM_BUTTON, OnHistogramButton)
ON_CBN_CLOSEUP(IDC_CHOSEMONTH, OnCloseupChosemonth)
ON_CBN_DROPDOWN(IDC_CHOSEMONTH, OnDropdownChosemonth)
ON_BN_CLICKED(HISTIDC_GRAPH_BUTTON, OnGraphButton)
ON_BN_CLICKED(HISTIDC_DISTRIBUTING_BUTTON, OnDistributingButton)
ON_BN_CLICKED(HISTIDC_3D_BUTTON, On3dButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCountDialog message handlers
void CCountDialog::OnCloseupChosemonth()
{
// TODO: Add your control notification handler code here
CString temp,tmp;
this->UpdateData(TRUE);
m_Month_ComboBox.GetLBText(m_iMonth,temp);
if (m_iMonth != 0 ) {
temp+="份";
}
temp +="共收入";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(7));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][7]);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
tmp.Format("%.2f",m_Data.GetYearCount(7));
}
else
{
tmp.Format("%.2f",m_Data.m_Count[m_iMonth-1][7]);
}
temp+=tmp;
temp+="元。\r\n支出";
if (m_iMonth == 0){
int c=0;
for (int i=0; i<9; i++){
c+=m_Data.GetYearTimes(i);
}
c-=m_Data.GetYearTimes(7);
tmp.Format("%d",c);
}
else
{
int c=0;
for (int i=0; i<9; i++){
c+=m_Data.m_Times[m_iMonth-1][i];
}
c-=m_Data.m_Times[m_iMonth-1][7];
tmp.Format("%d",c);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
double c=0;
for (int i=0; i<9; i++){
c+=m_Data.GetYearCount(i);
}
c-=m_Data.GetYearCount(7);
tmp.Format("%.2f",c);
}
else
{
double c=0;
for (int i=0; i<9; i++){
c+=m_Data.m_Count[m_iMonth-1][i];
}
c-=m_Data.m_Count[m_iMonth-1][7];
tmp.Format("%.2f",c);
}
temp+=tmp;
temp+="元。\r\n其中\(zhòng)r\n食品支出";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(0));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][0]);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
tmp.Format("%.2f",m_Data.GetYearCount(0));
}
else
{
tmp.Format("%.2f",m_Data.m_Count[m_iMonth-1][0]);
}
temp+=tmp;
temp+="元。\r\n書籍支出";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(1));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][1]);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
tmp.Format("%.2f",m_Data.GetYearCount(1));
}
else
{
tmp.Format("%.2f",m_Data.m_Count[m_iMonth-1][1]);
}
temp+=tmp;
temp+="元。\r\n服裝支出";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(2));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][2]);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
tmp.Format("%.2f",m_Data.GetYearCount(2));
}
else
{
tmp.Format("%.2f",m_Data.m_Count[m_iMonth-1][2]);
}
temp+=tmp;
temp+="元。\r\n醫(yī)藥支出";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(3));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][3]);
}
temp+=tmp;
temp+="筆,總計";
if (m_iMonth == 0){
tmp.Format("%.2f",m_Data.GetYearCount(3));
}
else
{
tmp.Format("%.2f",m_Data.m_Count[m_iMonth-1][3]);
}
temp+=tmp;
temp+="元。\r\n禮品支出";
if (m_iMonth == 0){
tmp.Format("%d",m_Data.GetYearTimes(4));
}
else
{
tmp.Format("%d",m_Data.m_Times[m_iMonth-1][4]);
}
temp+=tmp;
temp+="筆,總計";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -