📄 chargeedidlg.cpp
字号:
// 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::OnChangeBookFeeEdit()
{
// 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::OnChangeFileFeeEdit()
{
// 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::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
//将用户输入的数据赋值到对象cur中,为更新数据库做准备
CStuCharge cur;
cur.StuId = atol(cStuId);
cur.iYear = m_Year;
CTime CurrentTime;
CurrentTime = CTime::GetCurrentTime();
cur.ChargeDate = CurrentTime.Format("%Y-%m-%d");
// 读取学生信息
CStudent csd;
csd.GetInfo(cStuId);
CChargeItem chi;
CString cChi;
cChi.Format("%ld", csd.SpeId);
CString cYear;
cYear.Format("%d",m_Year);
if(chi.HaveSpe(cChi,cYear) == false)
{
MessageBox("无此学生所在专业收费信息,请在专业收费管理中补充收费信息!");
return;
}
// 取得项目编号
cChi = chi.GetItemId(cChi,cYear);
chi.GetInfo(cChi);
CStudent stu;
CString cStu;
cStu.Format("%ld", cur.StuId);
stu.GetInfo(cStu);
// 收费金额有效性判断
if(cId == "")
{
if((stu.TeKun == "否") && (stu.PinKun == "否"))
{
if(m_tuition != chi.Tuition)
{
MessageBox("请输入全部学费金额!");
return;
}
}
if(m_tuition > chi.Tuition)
{
MessageBox("请输入正确的学费金额!");
return;
}
if(m_incidental > chi.Incidental)
{
MessageBox("请输入正确的杂费金额!");
return;
}
if(m_MacTimeFee > chi.MacTimeFee)
{
MessageBox("请输入正确的机时费金额!");
return;
}
if(m_insurance > chi.Insurance)
{
MessageBox("请输入正确的保险费金额!");
return;
}
if(stu.ZhuSu == "是")
{
if(m_DormFee > chi.DormFee)
{
MessageBox("请输入正确的住宿费金额!");
return;
}
}
if(stu.CunChe == "是")
{
if(m_BicycleFee > chi.BicycleFee)
{
MessageBox("请输入正确的存车费金额!");
return;
}
}
if(m_BookFee > chi.BookFee)
{
MessageBox("请输入正确的书费金额!");
return;
}
if(m_FileFee > chi.FileFee)
{
MessageBox("请输入正确的资料费金额!");
return;
}
}
else
{
sch.GetInfo(cStuId);
if(m_incidental > (sch.Should_Incidental - sch.Fact_Incidental ))
{
MessageBox("请输入正确的杂费金额!");
return;
}
if(m_MacTimeFee > (sch.Should_MacTimeFee - sch.Fact_MacTimeFee))
{
MessageBox("请输入正确的机时费金额!");
return;
}
if(m_insurance > (sch.Should_Insurance - sch.Fact_Insurance))
{
MessageBox("请输入正确的保险费金额!");
return;
}
if(m_DormFee > (sch.Should_DormFee -sch.Fact_DormFee))
{
MessageBox("请输入正确的住宿金额!");
return;
}
if(m_BicycleFee > (sch.Should_BicycleFee - sch.Fact_BicycleFee))
{
MessageBox("请输入正确的存车金额!");
return;
}
if(m_BookFee > (sch.Should_BookFee - sch.Fact_BookFee))
{
MessageBox("请输入正确的书费金额!");
return;
}
if(m_FileFee > (sch.Should_FileFee - sch.Fact_FileFee))
{
MessageBox("请输入正确的资料费金额!");
return;
}
}
// 填写StuCharge类信息
if(cId == "") // 第一次交费时
{
// 贫困生可缓交学费
if(stu.PinKun == "是")
{
cur.Should_Tuition = chi.Tuition;
cur.Fact_Tuition = m_tuition;
}
// 特困生可免学费
else if(stu.TeKun == "是")
{
cur.Should_Tuition = 0;
cur.Fact_Tuition = 0;
}
// 普通生必须交全学费
else
{
cur.Should_Tuition = chi.Tuition;
cur.Fact_Tuition = chi.Tuition;
}
cur.Should_Incidental = chi.Incidental;
cur.Fact_Incidental = m_incidental;
cur.Should_MacTimeFee = chi.MacTimeFee;
cur.Fact_MacTimeFee = m_MacTimeFee;
cur.Should_Insurance = chi.Insurance;
cur.Fact_Insurance = m_insurance;
if(stu.ZhuSu == "是")
cur.Should_DormFee = chi.DormFee;
else
cur.Should_DormFee = 0.0;
cur.Fact_DormFee = m_DormFee;
if(stu.CunChe == "是")
cur.Should_BicycleFee = chi.BicycleFee;
else
cur.Should_BicycleFee = 0.0;
cur.Fact_BicycleFee = m_BicycleFee;
cur.Should_BookFee = chi.BookFee;
cur.Fact_BookFee = m_BookFee;
cur.Should_FileFee = chi.FileFee;
cur.Fact_FileFee = m_FileFee;
cur.Should_Total = m_total;
cur.Fact_Total = m_cur;
cur.Memo = m_memo;
}
else // 补交费用时
{
// 贫困生可缓交学费
if(stu.PinKun == "是")
{
cur.Should_Tuition = chi.Tuition;
cur.Fact_Tuition = m_tuition + sch.Fact_Tuition;
}
// 特困生可免学费
else if(stu.TeKun == "是")
{
cur.Should_Tuition = 0.0;
cur.Fact_Tuition = 0.0;
}
// 普通学生
else
{
cur.Should_Tuition = chi.Tuition;
cur.Fact_Tuition = chi.Tuition; // 普通学生一定是全交
}
cur.Should_Incidental = chi.Incidental;
cur.Fact_Incidental = m_incidental + sch.Fact_Incidental;
cur.Should_MacTimeFee = chi.MacTimeFee;
cur.Fact_MacTimeFee = m_MacTimeFee + sch.Fact_MacTimeFee;
cur.Should_Insurance = chi.Insurance;
cur.Fact_Insurance = m_insurance + sch.Fact_Insurance;
if(stu.ZhuSu == "是")
cur.Should_DormFee = chi.DormFee;
else
cur.Should_DormFee = 0.0;
cur.Fact_DormFee = m_DormFee + sch.Fact_DormFee;
if(stu.CunChe == "是")
cur.Should_BicycleFee = chi.BicycleFee;
else
cur.Should_BicycleFee = 0.0;
cur.Fact_BicycleFee = m_BicycleFee + sch.Fact_BicycleFee;
cur.Should_BookFee = chi.BookFee;
cur.Fact_BookFee = m_BookFee + sch.Fact_BookFee;
cur.Should_FileFee = chi.FileFee;
cur.Fact_FileFee = m_FileFee + sch.Fact_FileFee;
cur.Should_Total = m_total;
cur.Fact_Total = m_cur + sch.Fact_Total;
cur.Memo = m_memo;
}
if (cId == "") //表示插入数据
cur.SqlInsert();
else //根据StuId的值更新记录
cur.SqlUpdate(cId);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -