?? record.cpp
字號(hào):
// Record.cpp : implementation file
//
#include "stdafx.h"
#include "Laborage.h"
#include "Record.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRecord dialog
CRecord::CRecord(CWnd* pParent /*=NULL*/)
: CDialog(CRecord::IDD, pParent)
{
//{{AFX_DATA_INIT(CRecord)
m_age = 0;
m_alldays = 0.0;
m_allmoney = 0.0;
m_effectdays = 0.0;
m_expanddays = 0.0;
m_extramoney = 0.0;
m_fakedays = 0.0;
m_firstdate = COleDateTime::GetCurrentTime();
m_leftdays = 0.0;
m_name = _T("");
m_phone = _T("");
m_treat = 0;
m_sex = 0;
m_work = _T("");
m_number = 0;
//}}AFX_DATA_INIT
m_flags=0;
}
void CRecord::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRecord)
DDX_Control(pDX, IDC_NAME, m_wname);
DDX_Control(pDX, IDC_ACTION, m_action);
DDX_Text(pDX, IDC_AGE, m_age);
DDV_MinMaxInt(pDX, m_age, 0, 999);
DDX_Text(pDX, IDC_ALLDAYS, m_alldays);
DDX_Text(pDX, IDC_ALLMONEY, m_allmoney);
DDX_Text(pDX, IDC_EFFECTDAYS, m_effectdays);
DDX_Text(pDX, IDC_EXPANDDAYS, m_expanddays);
DDV_MinMaxDouble(pDX, m_expanddays, 0., 10000.);
DDX_Text(pDX, IDC_EXTRAMONEY, m_extramoney);
DDX_Text(pDX, IDC_FAKEDAYS, m_fakedays);
DDV_MinMaxDouble(pDX, m_fakedays, 0., 10000.);
DDX_Text(pDX, IDC_FIRSTDATE, m_firstdate);
DDX_Text(pDX, IDC_LEFTDAYS, m_leftdays);
DDX_Text(pDX, IDC_NAME, m_name);
DDV_MaxChars(pDX, m_name, 64);
DDX_Text(pDX, IDC_PHONE, m_phone);
DDV_MaxChars(pDX, m_phone, 32);
DDX_Text(pDX, IDC_TREAT, m_treat);
DDV_MinMaxLong(pDX, m_treat, 0, 10000);
DDX_CBIndex(pDX, IDC_SEX, m_sex);
DDX_Text(pDX, IDC_WORK, m_work);
DDV_MaxChars(pDX, m_work, 64);
DDX_Text(pDX, IDC_NUMBER, m_number);
DDV_MinMaxLong(pDX, m_number, 0, 1000000);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRecord, CDialog)
//{{AFX_MSG_MAP(CRecord)
ON_BN_CLICKED(IDC_ACTION, OnAction)
ON_EN_CHANGE(IDC_TREAT, OnChangeTreat)
ON_EN_CHANGE(IDC_FIRSTDATE, OnChangeFirstdate)
ON_EN_CHANGE(IDC_FAKEDAYS, OnChangeFakedays)
ON_EN_CHANGE(IDC_EXTRAMONEY, OnChangeExtramoney)
ON_EN_CHANGE(IDC_EXPANDDAYS, OnChangeExpanddays)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRecord message handlers
BOOL CRecord::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(m_flags)
{
this->m_action.SetWindowText("修改");
this->SetWindowText("修改記錄");
m_wname.SetReadOnly();
}
else
{
this->m_action.SetWindowText("新增");
this->SetWindowText("新增記錄");
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRecord::UpdateChange()
{
UpdateData();
CTime time=CTime::GetCurrentTime();
int total=(time.GetYear()-m_firstdate.GetYear())*366+(time.GetMonth()-m_firstdate.GetMonth())*31+time.GetDay()-m_firstdate.GetDay();
m_alldays=total;
m_effectdays=total-m_fakedays;
m_leftdays=m_effectdays-m_expanddays;
m_allmoney=m_leftdays*m_treat+m_extramoney;
UpdateData(FALSE);
}
void CRecord::OnChangeTreat()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateChange();
// TODO: Add your control notification handler code here
}
void CRecord::OnChangeFirstdate()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateChange();
// TODO: Add your control notification handler code here
}
void CRecord::OnChangeFakedays()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateChange();
// TODO: Add your control notification handler code here
}
void CRecord::OnChangeExtramoney()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateChange();
// TODO: Add your control notification handler code here
}
void CRecord::OnChangeExpanddays()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateChange();
// TODO: Add your control notification handler code here
}
void CRecord::OnAction()
{
// TODO: Add your control notification handler code here
UpdateData();
if(this->m_name=="")
{
MessageBox("您還沒(méi)有填寫(xiě)姓名!");
return;
}
if(this->m_treat==0)
{
MessageBox("待遇不能為零!");
return;
}
if(this->m_age<=0)
{
MessageBox("年齡必需大于零!");
return;
}
this->OnOK();
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -