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

📄 chargeedidlg.cpp

📁 VC++做的学校收费管理系统,很有参考价值,附上源码与说明文档.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// ChargeEdiDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ChargeManage.h"
#include "ChargeEdiDlg.h"
#include "StuSelDlg.h"
#include "Student.h"
#include "DepInfo.h"
#include "Speciality.h"
#include "ChargeItem.h"
#include "StuCharge.h"

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

/////////////////////////////////////////////////////////////////////////////
// CChargeEdiDlg dialog


CChargeEdiDlg::CChargeEdiDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CChargeEdiDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChargeEdiDlg)
	m_BicycleFee = 0.0;
	m_BookFee = 0.0;
	m_cur = 0.0;
	m_dep = _T("");
	m_DormFee = 0.0;
	m_FileFee = 0.0;
	m_incidental = 0.0;
	m_insurance = 0.0;
	m_lack = 0.0;
	m_MacTimeFee = 0.0;
	m_memo = _T("");
	m_name = _T("");
	m_pre = 0.0;
	m_speciality = _T("");
	m_tuition = 0.0;
	m_total = 0.0;
	m_Year = 0;
	//}}AFX_DATA_INIT
}


void CChargeEdiDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChargeEdiDlg)
	DDX_Text(pDX, IDC_BICYCLE_FEE_EDIT, m_BicycleFee);
	DDX_Text(pDX, IDC_BOOK_FEE_EDIT, m_BookFee);
	DDX_Text(pDX, IDC_CUR_EDIT, m_cur);
	DDX_Text(pDX, IDC_DEP_STATIC, m_dep);
	DDX_Text(pDX, IDC_DORM_FEE_EDIT, m_DormFee);
	DDX_Text(pDX, IDC_FILE_FEE_EDIT, m_FileFee);
	DDX_Text(pDX, IDC_INCIDENTAL_EDIT, m_incidental);
	DDX_Text(pDX, IDC_INSURANCE_EDIT, m_insurance);
	DDX_Text(pDX, IDC_LACK_EDIT, m_lack);
	DDX_Text(pDX, IDC_MAC_TIME_FEE_EDIT, m_MacTimeFee);
	DDX_Text(pDX, IDC_MEMO_EDIT, m_memo);
	DDX_Text(pDX, IDC_NAME_STATIC, m_name);
	DDX_Text(pDX, IDC_PRE_EDIT, m_pre);
	DDX_Text(pDX, IDC_SPECIALITY_STATIC, m_speciality);
	DDX_Text(pDX, IDC_TUITION_EDIT, m_tuition);
	DDX_Text(pDX, IDC_TOTAL_EDIT, m_total);
	DDX_Text(pDX, IDC_YEAR_EDIT, m_Year);
	DDV_MinMaxInt(pDX, m_Year, 1980, 2100);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChargeEdiDlg, CDialog)
	//{{AFX_MSG_MAP(CChargeEdiDlg)
	ON_BN_CLICKED(IDC_SEL_BUTTON, OnSelButton)
	ON_EN_CHANGE(IDC_TUITION_EDIT, OnChangeTuitionEdit)
	ON_EN_CHANGE(IDC_INCIDENTAL_EDIT, OnChangeIncidentalEdit)
	ON_EN_CHANGE(IDC_MAC_TIME_FEE_EDIT, OnChangeMacTimeFeeEdit)
	ON_EN_CHANGE(IDC_INSURANCE_EDIT, OnChangeInsuranceEdit)
	ON_EN_CHANGE(IDC_DORM_FEE_EDIT, OnChangeDormFeeEdit)
	ON_EN_CHANGE(IDC_BICYCLE_FEE_EDIT, OnChangeBicycleFeeEdit)
	ON_EN_CHANGE(IDC_BOOK_FEE_EDIT, OnChangeBookFeeEdit)
	ON_EN_CHANGE(IDC_FILE_FEE_EDIT, OnChangeFileFeeEdit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChargeEdiDlg message handlers

BOOL CChargeEdiDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if(cId == "")		// 交费
		GetDlgItem(IDOK)->EnableWindow(FALSE);
	else				// 补交
	{
		// 特困生或其他学生已经交全学费
		if(m_tuition == 0.0)
			GetDlgItem(IDC_TUITION_EDIT)->EnableWindow(FALSE);
		// 若已交足杂费
		if(m_incidental == 0.0)
			GetDlgItem(IDC_INCIDENTAL_EDIT)->EnableWindow(FALSE);
		// 若已交足机时费
		if(m_MacTimeFee == 0.0)
			GetDlgItem(IDC_MAC_TIME_FEE_EDIT)->EnableWindow(FALSE);
		// 若已交足保险费
		if(m_insurance == 0.0)
			GetDlgItem(IDC_INSURANCE_EDIT)->EnableWindow(FALSE);
		// 不住宿或交足住宿费
		if(m_DormFee == 0.0)
			GetDlgItem(IDC_DORM_FEE_EDIT)->EnableWindow(FALSE);
		// 不存车的无须交存车费
		if(m_BicycleFee == 0.0)
			GetDlgItem(IDC_BICYCLE_FEE_EDIT)->EnableWindow(FALSE);
		// 若交足书费
		if(m_BookFee == 0.0)
			GetDlgItem(IDC_BOOK_FEE_EDIT)->EnableWindow(FALSE);
		// 若交足资料费
		if(m_FileFee == 0.0)
			GetDlgItem(IDC_FILE_FEE_EDIT)->EnableWindow(FALSE);

		UpdateData(FALSE);

		GetDlgItem(IDC_SEL_BUTTON)->EnableWindow(FALSE);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CChargeEdiDlg::OnSelButton() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CStuSelDlg dlg;
	if(dlg.DoModal()==IDOK)
	{
		cStuId = dlg.cStuId;
		m_name = dlg.Name;
		// 得到学生信息
		CStudent stu;
		stu.GetInfo(cStuId);
		// 判断此学生的入学年度,和输入的缴费年度比较
		if(m_Year < stu.iYear)
		{
			MessageBox("缴费年度不能小于入学年度!");
			return;			
		}
		// 得到专业信息
		CSpeciality spe;
		CString cSpe;
		cSpe.Format("%ld", stu.SpeId);
		spe.GetInfo(cSpe);
		m_speciality = spe.Name;
		// 得到部门信息
		m_dep = spe.GetDepName(cSpe);
		CString cYear;
		cYear.Format("%d",m_Year);
		// 判断学生收费信息
		if(sch.HaveChargeInfo(cStuId,cYear) == 1)
		{
			MessageBox("本学年已存在此学生收费信息,请选择补交费用!");
			return;
		}

		// 得到专业收费项目信息
		CChargeItem chi;
		if (chi.HaveSpe(cSpe,cYear) == false)
		{
			MessageBox("无此学生所在专业收费信息,请在专业收费管理中补充收费信息!");
			return;
		}
		// 得到此收费项目的总收费金额
		m_total = chi.GetSum(cSpe,cYear);
		// 得到项目编号
		CString cItemId;
		cItemId = chi.GetItemId(cSpe,cYear);
		chi.GetInfo(cItemId);
		m_pre = 0;

		// 特困生的处理:免学费
		if(stu.TeKun == "是")
		{
			m_total = m_total - chi.Tuition;
			m_tuition = 0.0;
			GetDlgItem(IDC_TUITION_EDIT)->EnableWindow(FALSE);
		}
		else
			m_tuition = chi.Tuition;
		// 不是住宿生处理:免住宿费
		if(stu.ZhuSu == "否")
		{
			m_total = m_total - chi.DormFee;
			m_DormFee = 0.0;
			GetDlgItem(IDC_DORM_FEE_EDIT)->EnableWindow(FALSE);
		}
		else
			m_DormFee = chi.DormFee;
		// 不存车学生处理:免存车费
		if(stu.CunChe == "否")
		{
			m_total = m_total - chi.BicycleFee;
			m_BicycleFee = 0.0;
			GetDlgItem(IDC_BICYCLE_FEE_EDIT)->EnableWindow(FALSE);
		}
		else
			m_BicycleFee = chi.BicycleFee;
		m_lack = m_total;

		// 填写其他信息
		m_incidental = chi.Incidental;
		m_MacTimeFee = chi.MacTimeFee;
		m_insurance = chi.Insurance;
		m_BookFee = chi.BookFee;
		m_FileFee = chi.FileFee;
		m_cur = m_total;

		UpdateData(FALSE);
		GetDlgItem(IDOK)->EnableWindow(TRUE);
	}
}

// 学费改变
void CChargeEdiDlg::OnChangeTuitionEdit() 
{
	// 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.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_cur = m_tuition + m_incidental + m_MacTimeFee + m_insurance + m_DormFee
		+ m_BicycleFee + m_BookFee + m_FileFee;
	UpdateData(FALSE);
}

// 杂费改变
void CChargeEdiDlg::OnChangeIncidentalEdit() 
{
	// 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.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_cur = m_tuition + m_incidental + m_MacTimeFee + m_insurance + m_DormFee
		+ m_BicycleFee + m_BookFee + m_FileFee;
	UpdateData(FALSE);
}

// 机时费改变
void CChargeEdiDlg::OnChangeMacTimeFeeEdit() 
{
	// 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.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_cur = m_tuition + m_incidental + m_MacTimeFee + m_insurance + m_DormFee
		+ m_BicycleFee + m_BookFee + m_FileFee;
	UpdateData(FALSE);
}

// 保险费改变
void CChargeEdiDlg::OnChangeInsuranceEdit() 
{
	// 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.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_cur = m_tuition + m_incidental + m_MacTimeFee + m_insurance + m_DormFee
		+ m_BicycleFee + m_BookFee + m_FileFee;
	UpdateData(FALSE);
}

// 住宿费改变
void CChargeEdiDlg::OnChangeDormFeeEdit() 
{
	// 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.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_cur = m_tuition + m_incidental + m_MacTimeFee + m_insurance + m_DormFee
		+ m_BicycleFee + m_BookFee + m_FileFee;
	UpdateData(FALSE);
}

// 存车费改变
void CChargeEdiDlg::OnChangeBicycleFeeEdit() 
{

⌨️ 快捷键说明

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