📄 financedlg.cpp
字号:
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 3:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 4:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 5:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 6:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 7:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
break;
case 8:
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
break;
}
*pResult = 0;
}
void CFinanceDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
//先添加现金
double dCashAmount=0;
CString StrCashAmount=L"";
int Length;
if(m_pCashSet.IsOpen ())
m_pCashSet.Close ();
m_pCashSet.Open (AFX_DB_USE_DEFAULT_TYPE,L"Select * From Cash Order by cDate");//按结算日期排序
if(m_pCashSet.GetRecordCount ()!=0)//还没有现金的信息,则不用理,否则进入
{
m_pCashSet.MoveLast ();//现金是用最后的状态的,故最后一个
dCashAmount=m_pCashSet.m_cAmount ;
StrCashAmount.Format (L"%f",dCashAmount);
Length=StrCashAmount.GetLength ();
StrCashAmount.Delete (Length-4,4);
}
m_pCashSet.Close ();
SetDlgItemText(IDC_CASHNOW_STATIC,StrCashAmount);
//再添加借贷信息
CString StrBorrowInfo=L"";
CString StartDate;
CString EndDate;
CString StrAmount;
CString StrMoneyLeft;
CTime tTime=CTime::GetCurrentTime();
CString Date=DateToString(tTime);
if(m_pBorrowSet.IsOpen ())
m_pBorrowSet.Close ();
m_pBorrowSet.Open (AFX_DB_USE_DEFAULT_TYPE,L"Select * From Borrow Order by bDate");
if(m_pBorrowSet.GetRecordCount ()==0)//还没有借贷的信息,则显示一些名言
{
m_pBorrowSet.Close ();
StrBorrowInfo=L"节俭持家,脑筋理财。";
SetDlgItemText(IDC_BORROW_REMIND_STATIC,StrBorrowInfo);
}
else//否则,监测借贷信息
{
m_pBorrowSet.MoveFirst ();
m_pBorrowSet.m_strFilter .Empty ();
while(!m_pBorrowSet.IsEOF ())
{
StartDate=DateToString(m_pBorrowSet.m_bStartDate );
EndDate=DateToString(m_pBorrowSet.m_bEndDate );
if(StartDate<=Date&&EndDate>=Date)//如果借贷期间跨越了当天,则显示
{
StrAmount.Format(L"%f",m_pBorrowSet.m_bAmount);
Length=StrAmount.GetLength ();
StrAmount.Delete (Length-4,4);
StrMoneyLeft.Format (L"%f",m_pBorrowSet.m_bMoneyLeft );
Length=StrMoneyLeft.GetLength ();
StrMoneyLeft.Delete (Length-4,4);
//还要判断是借入,借出,还欠,还回等操作
if((CString)m_pBorrowSet.m_bAction==L"借入")
{
//借入,则必须提醒
StrBorrowInfo+=L"你于"+FormatDate(m_pBorrowSet.m_bDate) +L"从"
+m_pBorrowSet.m_bOtherName +L"处借入"+StrAmount+L"元,有效期从"
+FormatDate(m_pBorrowSet.m_bStartDate) +L"到"+FormatDate(m_pBorrowSet.m_bEndDate) +L"\n";
}else
if((CString)m_pBorrowSet.m_bAction==L"借出")
{
//借出,则必须提醒
StrBorrowInfo+=m_pBorrowSet.m_bOtherName +L"于"
+FormatDate(m_pBorrowSet.m_bDate) +L"从你手中借出"+StrAmount+L"元,有效期从"
+FormatDate(m_pBorrowSet.m_bStartDate) +L"到"+FormatDate(m_pBorrowSet.m_bEndDate) +L"\n";
}else
if((CString)m_pBorrowSet.m_bAction==L"还出")
{ //还出,只有在有余额的时候要提醒
if(m_pBorrowSet.m_bMoneyLeft !=0)
StrBorrowInfo+=L"你于"+FormatDate(m_pBorrowSet.m_bDate) +L"还出"
+StrAmount +L"元给"+m_pBorrowSet.m_bOtherName
+L"仍欠"+StrMoneyLeft +L"元\n";
}else
{ //还入,只有在还有余额的时候提醒
if(m_pBorrowSet.m_bMoneyLeft !=0)
StrBorrowInfo+=m_pBorrowSet.m_bOtherName +L"于"+FormatDate(m_pBorrowSet.m_bDate)
+L"还入"+StrAmount +L"元,仍欠"+StrMoneyLeft +L"元\n";
}
}//if
m_pBorrowSet.MoveNext ();
}//while
}//else
m_pBorrowSet.Close ();
SetDlgItemText(IDC_BORROW_REMIND_STATIC,StrBorrowInfo);
//借贷信息添加完毕
CDialog::OnTimer(nIDEvent);
}
void CFinanceDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
KillTimer(FINANCE_TIMER);
CDialog::OnClose();
}
void CFinanceDlg::PostNcDestroy()
{
// TODO: 在此添加专用代码和/或调用基类
CDialog::PostNcDestroy();
// AfxGetMainWnd()->SendMessage(WM_USER_FINANCEDLG_DESTROYED,0,0);
// delete this;
}
void CFinanceDlg::OnCancel()
{
// TODO: 在此添加专用代码和/或调用基类
// DestroyWindow ();
CDialog::OnCancel ();
}
HBRUSH CFinanceDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: 在此更改 DC 的任何属性
if(m_bColor)//如果用系统的,则直接返回
return hbr;
pDC->SetTextColor (m_RGB_CtrlColor);
pDC->SetBkMode(BKMODE_LAST);pDC->SetBkColor (m_RGB_BkColor);
return (HBRUSH)m_brush.GetSafeHandle ();
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
// return hbr;
}
void CFinanceDlg::OnFinanceCash()
{
// TODO: 在此添加命令处理程序代码
CRect r;
m_Finance_TabCtrl.GetClientRect (&r);
m_Finance_TabCtrl.SetCurSel (0);
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
}
void CFinanceDlg::OnFinanceIncome()
{
// TODO: 在此添加命令处理程序代码
CRect r;
m_Finance_TabCtrl.GetClientRect (&r);
m_Finance_TabCtrl.SetCurSel (1);
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTangibleDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceBorrowDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceInvestDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceTransferDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinancePlanDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
}
void CFinanceDlg::OnFinanceOutcome()
{
// TODO: 在此添加命令处理程序代码
CRect r;
m_Finance_TabCtrl.GetClientRect (&r);
m_Finance_TabCtrl.SetCurSel (2);
m_FinanceCashDlg.SetWindowPos (NULL,2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceIncomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
m_FinanceOutcomeDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_SHOWWINDOW);
m_FinanceBankDlg.SetWindowPos (NULL, 2,22,r.right -5, r.bottom -25,SWP_HIDEWINDOW);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -