⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ffmanagedlg.cpp

📁 Family Financial Management System是一个特别方便的理财系统。功能方便实用。
💻 CPP
字号:
// FFManageDlg.cpp : implementation file
//

#include "stdafx.h"
#include "FFManage.h"
#include "FFManageDlg.h"

#include "AddDlg.h"
#include "ListDlg.h"
#include "QueryDlg.h"
#include "PwdDlg.h"
#include "BankBookDlg.h"

extern int        g_iType;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFFManageDlg dialog

CFFManageDlg::CFFManageDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFFManageDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFFManageDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFFManageDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFFManageDlg)
	DDX_Control(pDX, IDC_BTN_Login, m_btnLogin);
	DDX_Control(pDX, IDC_BTN_SAVE, m_btnSave);
	DDX_Control(pDX, IDC_BTN_DAC, m_btnDac);
	DDX_Control(pDX, IDC_BTN_EVENT, m_btnEvent);
	DDX_Control(pDX, IDC_BTN_IN, m_btnIn);
	DDX_Control(pDX, IDC_BTN_OUT, m_btnOut);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFFManageDlg, CDialog)
	//{{AFX_MSG_MAP(CFFManageDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BTN_OUT, OnBtnOut)
	ON_BN_CLICKED(IDC_BTN_IN, OnBtnIn)
	ON_BN_CLICKED(IDC_BTN_SAVE, OnBtnSave)
	ON_BN_CLICKED(IDC_BTN_DAC, OnBtnDAC)
	ON_BN_CLICKED(IDC_BTN_EVENT, OnBtnEvent)
	ON_COMMAND(ID_Out_NowMonth, OnOutNowMonth)
	ON_COMMAND(ID_Out_PreMonth, OnOutPreMonth)
	ON_COMMAND(ID_In_NowMonth, OnInNowMonth)
	ON_COMMAND(ID_In_PreMonth, OnInPreMonth)
	ON_COMMAND(ID_Out_Query, OnOutQuery)
	ON_COMMAND(ID_Out_NowYear, OnOutNowYear)
	ON_COMMAND(ID_In_NowYear, OnInNowYear)
	ON_COMMAND(ID_In_Query, OnInQuery)
	ON_COMMAND(ID_Event_NowMonth, OnEventNowMonth)
	ON_COMMAND(ID_Event_NowYear, OnEventNowYear)
	ON_COMMAND(ID_Event_PreMonth, OnEventPreMonth)
	ON_COMMAND(ID_Event_Query, OnEventQuery)
	ON_COMMAND(ID_Dac_AllCredit, OnDacAllCredit)
	ON_COMMAND(ID_Dac_AllDebit, OnDacAllDebit)
	ON_COMMAND(ID_Dac_NowCredit, OnDacNowCredit)
	ON_COMMAND(ID_Dac_NowDebit, OnDacNowDebit)
	ON_COMMAND(ID_Dac_Query, OnDacQuery)
	ON_BN_CLICKED(IDC_BTN_Login, OnBTNLogin)
	ON_COMMAND(ID_Save_AddBankBook, OnSaveAddBankBook)
	ON_COMMAND(ID_Save_Manage, OnSaveManage)
	ON_COMMAND(ID_Dac_All, OnDacAll)
	//}}AFX_MSG_MAP
//	ON_WM_DESTROY()
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFFManageDlg message handlers

BOOL CFFManageDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here

	VERIFY(m_page.CreateFromStatic(IDC_HTMLCAL, this));

	m_page.LoadFromResource(_T("cal.htm"));

	m_btnOut.SetSSLButtonMenu (IDR_MENU_OUT);
	m_btnEvent.SetSSLButtonMenu (IDR_MENU_EVENT);
	m_btnIn.SetSSLButtonMenu (IDR_MENU_In);
	m_btnDac.SetSSLButtonMenu (IDR_MENU_DAC);
//	m_btnSave.SetSSLButtonMenu (IDR_MENU_SAVE);
	m_btnSave.SetDefault();
	m_btnLogin.SetDefault();
	

	COleDateTime  date = COleDateTime::GetCurrentTime();		
	m_strDateNow = date.Format("%Y年%m月00日");
	int iYear = date.GetYear();
	int iMonth= date.GetMonth();
	if(iMonth == 1)
	{
		iYear--;
		iMonth = 12;
	}
	else
	{
		iMonth--;
	}
	date.SetDate(iYear, iMonth, 1);
	m_strDatePre = date.Format("%Y年%m月00日");


	if(g_iType == No_login)
	{
		CString strTemp;
		GetWindowText(strTemp);
		SetWindowText(strTemp + "    **** 未登录 ****");
		GetDlgItem(IDC_BTN_OUT)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_EVENT)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_IN)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_SAVE)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_DAC)->EnableWindow(FALSE);
		
	}
	else
	{
		GetDlgItem(IDC_BTN_Login)->SetWindowText("注销(&L)");
	}

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CFFManageDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CFFManageDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CFFManageDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CFFManageDlg::OnOK() 
{
	// TODO: Add extra validation here
	return;
	CDialog::OnOK();
}

void CFFManageDlg::OnBtnOut() 
{
	// TODO: Add your control notification handler code here
	CAddDlg dlg;
	g_iType = TYPE_Out;
	dlg.DoModal();	
}

void CFFManageDlg::OnBtnIn() 
{
	// TODO: Add your control notification handler code here
	CAddDlg dlg;
	g_iType = TYPE_In;
	dlg.DoModal();
}

void CFFManageDlg::OnBtnSave() 
{
	// TODO: Add your control notification handler code here
	g_iType = TYPE_BankBook;
	CListDlg dlg;
	dlg.DoModal();
}

void CFFManageDlg::OnBtnDAC() 
{
	// TODO: Add your control notification handler code here
	CAddDlg dlg;
	g_iType = TYPE_Dac;
	dlg.DoModal();
}

void CFFManageDlg::OnBtnEvent() 
{
	// TODO: Add your control notification handler code here
	g_iType = TYPE_Event;
	CAddDlg dlg;
	dlg.DoModal();
}

void CFFManageDlg::OnOutNowMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Out;
	dlg.m_strDate1 = m_strDateNow;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnOutPreMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Out;
	dlg.m_strDate1 = m_strDatePre;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnOutNowYear() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Out;
	dlg.m_strDate1 = m_strDateNow.Left(6) + "00月00日";	
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnOutQuery() 
{
	// TODO: Add your command handler code here
	CQueryDlg dlg;
	g_iType  = TYPE_Out;
	dlg.DoModal();
}

void CFFManageDlg::OnInNowMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_In;
	dlg.m_strDate1 = m_strDateNow;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnInPreMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_In;
	dlg.m_strDate1 = m_strDatePre;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}


void CFFManageDlg::OnInNowYear() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_In;
	dlg.m_strDate1 = m_strDateNow.Left(6) + "00月00日";	
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnInQuery() 
{
	// TODO: Add your command handler code here
	CQueryDlg dlg;
	g_iType  = TYPE_In;
	dlg.DoModal();
}



void CFFManageDlg::OnEventNowMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Event;
	dlg.m_strDate1 = m_strDateNow;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnEventPreMonth() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Event;
	dlg.m_strDate1 = m_strDatePre;
	dlg.m_strDate2 = "";
	dlg.DoModal();
}


void CFFManageDlg::OnEventNowYear() 
{
	// TODO: Add your command handler code here
	CListDlg dlg;
	g_iType = TYPE_Event;
	dlg.m_strDate1 = m_strDateNow.Left(6) + "00月00日";	
	dlg.m_strDate2 = "";
	dlg.DoModal();
}

void CFFManageDlg::OnEventQuery() 
{
	// TODO: Add your command handler code here
	CQueryDlg dlg;
	g_iType  = TYPE_Event;
	dlg.DoModal();
}




void CFFManageDlg::OnDacAllCredit() 
{
	// TODO: Add your command handler code here
	g_iType  = TYPE_Dac;
	CListDlg dlg;
	dlg.m_strDate1 = "";	
	dlg.m_strDate2 = "";
	dlg.m_strDAC   = "贷";
	dlg.DoModal();
}

void CFFManageDlg::OnDacAllDebit() 
{
	// TODO: Add your command handler code here
	g_iType  = TYPE_Dac;
	CListDlg dlg;
	dlg.m_strDate1 = "";	
	dlg.m_strDate2 = "";
	dlg.m_strDAC   = "借";
	dlg.DoModal();
	
}

void CFFManageDlg::OnDacNowCredit() 
{
	// TODO: Add your command handler code here
	g_iType  = TYPE_Dac;
	CListDlg dlg;
	dlg.m_strDate1 = m_strDateNow.Left(6) + "00月00日";	
	dlg.m_strDate2 = "";
	dlg.m_strDAC   = "贷";
	dlg.DoModal();
	
}

void CFFManageDlg::OnDacNowDebit() 
{
	// TODO: Add your command handler code here
	g_iType  = TYPE_Dac;
	CListDlg dlg;
	dlg.m_strDate1 = m_strDateNow.Left(6) + "00月00日";	
	dlg.m_strDate2 = "";
	dlg.m_strDAC   = "借";
	dlg.DoModal();
	
}

void CFFManageDlg::OnDacQuery() 
{
	// TODO: Add your command handler code here
	CQueryDlg dlg;
	g_iType  = TYPE_Dac;
	dlg.DoModal();
}



void CFFManageDlg::OnDacAll() 
{
	// TODO: Add your command handler code here
	g_iType  = TYPE_Dac;
	CListDlg dlg;
	dlg.m_strSQL = "Select * from TDac Order By FDate";
	dlg.DoModal();
}
void CFFManageDlg::OnBTNLogin() 
{
	if(g_iType == No_login)
	{
		CPwdDlg	  dlg;
		if(dlg.DoModal() == IDOK)
		{		
			SetWindowText("家庭财务管理系统");
			GetDlgItem(IDC_BTN_OUT)->EnableWindow(TRUE);
			GetDlgItem(IDC_BTN_EVENT)->EnableWindow(TRUE);
			GetDlgItem(IDC_BTN_IN)->EnableWindow(TRUE);
			GetDlgItem(IDC_BTN_SAVE)->EnableWindow(TRUE);
			GetDlgItem(IDC_BTN_DAC)->EnableWindow(TRUE);
			GetDlgItem(IDC_BTN_Login)->SetWindowText("注销(&L)");
		}		
	}
	else        //注销
	{
		CString strTemp;
		GetWindowText(strTemp);
		SetWindowText(strTemp + "    **** 未登录 ****");
		GetDlgItem(IDC_BTN_OUT)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_EVENT)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_IN)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_SAVE)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_DAC)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_Login)->SetWindowText("登录(&L)");
		g_iType = No_login;
	}

}

void CFFManageDlg::OnSaveAddBankBook() 
{
	// TODO: Add your command handler code here
	CBankBookDlg dlg;
	dlg.DoModal();
}

void CFFManageDlg::OnSaveManage() 
{
	// TODO: Add your command handler code here
	g_iType = TYPE_BankBook;
	CListDlg dlg;
	dlg.DoModal();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -