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

📄 computation.cpp

📁 解决员工工资的管理
💻 CPP
字号:
// Computation.cpp : implementation file
//

#include "stdafx.h"
#include "salarly.h"
#include "Computation.h"
#include "ComputationSet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CComputation dialog


CComputation::CComputation(CWnd* pParent /*=NULL*/)
	: CDialog(CComputation::IDD, pParent)
{
	//{{AFX_DATA_INIT(CComputation)
	m_Absent1 = 0;
	m_Late1 = 0;
	m_Leave1 = 0;
	m_Overtime1 = 0;
	m_Worktime1 = 0;
	m_Business1 = 0;
	//}}AFX_DATA_INIT
}


void CComputation::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CComputation)
	DDX_Text(pDX, IDC_ABSENT1, m_Absent1);
	DDX_Text(pDX, IDC_LATE1, m_Late1);
	DDX_Text(pDX, IDC_LEAVE1, m_Leave1);
	DDX_Text(pDX, IDC_OVERTIME1, m_Overtime1);
	DDX_Text(pDX, IDC_WORKTIME1, m_Worktime1);
	DDX_Text(pDX, IDC_BUSINESS1, m_Business1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CComputation, CDialog)
	//{{AFX_MSG_MAP(CComputation)
	ON_BN_CLICKED(IDC_BTN_RESET, OnBtnReset)
	ON_BN_CLICKED(IDC_BTN_SAVE, OnBtnSave)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CComputation message handlers



BOOL CComputation::OnInitDialog() 
{
	CDialog::OnInitDialog();	
	// TODO: Add extra initialization here
	OnBtnReset(); // 调用“恢复缺省设置”按钮处理函数 
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CComputation::OnBtnReset() 
{
	// TODO: Add your control notification handler code here
	CString strFileName=".\\computation.ini"; // INI文件名
	// 读取INI文件
	m_Overtime1=GetPrivateProfileInt("Computation", "OverTime", 150, strFileName);
	m_Worktime1=GetPrivateProfileInt("Computation", "Worktime", 50, strFileName);
	m_Leave1=GetPrivateProfileInt("Computation", "Leave", 100, strFileName);
	m_Late1=GetPrivateProfileInt("Computation", "Late", 10, strFileName);
	m_Absent1=GetPrivateProfileInt("Computation", "Absent", 50, strFileName);
	m_Business1=GetPrivateProfileInt("Computation", "Business", 150, strFileName);
	UpdateData(FALSE); // 更新界面数据
}

void CComputation::OnBtnSave() 
{
	// TODO: Add your control notification handler code here
	UpdateData(); // 更新数据
	CString strFileName=".\\computation.ini"; // INI文件名
	CString str;
	// 修改加班费
	str.Format("%d",m_Overtime1);
	WritePrivateProfileString("Computation", "OverTime", str, strFileName);
	// 修改迟到早退罚金
	str.Format("%d",m_Late1);
	WritePrivateProfileString("Computation", "Late", str, strFileName);
	// 修改请假罚金
	str.Format("%d",m_Leave1);
	WritePrivateProfileString("Computation", "Leave", str, strFileName);
	// 修改旷工罚金
	str.Format("%d",m_Absent1);
	WritePrivateProfileString("Computation", "Absent", str, strFileName);
	// 修改出差费
	str.Format("%d",m_Business1);
	WritePrivateProfileString("Computation", "Business", str, strFileName);
	//修改基本工资参数
	str.Format("%d",m_Worktime1);
	WritePrivateProfileString("Computation", "Worktime", str, strFileName);
	//修改参数写入数据库
	UpdateData();		
	CComputationSet pSet;
	pSet.Open();		
	pSet.Edit();	
	pSet.m_worktime       =m_Worktime1;
	pSet.m_overtime               =m_Overtime1;		
	pSet.m_business             =m_Business1;
	pSet.m_late             =m_Late1;
	pSet.m_leave            =m_Leave1;
	pSet.m_absent               =m_Absent1;
	UpdateData(FALSE);
	pSet.Update();
	pSet.Requery();
	pSet.Close();
	MessageBox("修改成功");
	if(pSet.IsOpen())pSet.Close();	//如果记录集打开则关闭	
	CDialog::OnOK();
}




⌨️ 快捷键说明

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