📄 myhomeworkdlg.cpp
字号:
OnOK();
}
void CMyhomeworkDlg::OnResultButton()
{
// TODO: Add your control notification handler code here
//单选框的选择
int iManagerRadio;
iManagerRadio=GetCheckedRadioButton(IDC_MANAGER_RADIO,IDC_SALESMAN_RADIO);
////////////////////
//如果manager被选中
if(iManagerRadio==IDC_MANAGER_RADIO)
{
CString namestr1;
m_managerCombo.GetLBText(m_managerCombo.GetCurSel(),namestr1);
if((m_managerkey=="Zhao"&&namestr1=="Zhao")||(m_managerkey=="qiaofeng"&&namestr1=="乔峰")||(m_managerkey=="xuzhu"&&namestr1=="虚竹")||(m_managerkey=="duanyu"&&namestr1=="段誉"))
{
if(m_managergrade<=4&&m_managergrade>=1)
{
CString managermsg;
m_managerCombo.GetLBText(m_managerCombo.GetCurSel(),managermsg);
m_welcome.SetSel(0,-1);
m_welcome.SetMargins(1,10);
m_welcome.ReplaceSel(managermsg);
m_welcome.ReplaceSel("经理您好!");
///////////////////////////////////
//级别输出
UpdateData(TRUE);
m_showgrade.Format("%d",m_managergrade);
UpdateData(FALSE);
///////////////////////////////////
//计算工资
manager.grade=m_managergrade;
m_result.Format("%10.2f",manager.pay());
UpdateData(FALSE);
}else{AfxMessageBox("级别输入错误!请重新输入!");}
UpdateData(FALSE);
}else{AfxMessageBox("密码错误,请重新输入!");}
}
//////////////////////////////////
//technician
if(iManagerRadio==IDC_TECHNICIAN_RADIO)
{
CString namestr2;
m_technicianCombo.GetLBText(m_technicianCombo.GetCurSel(),namestr2);
if((m_techniciankey=="Wang"&&namestr2=="Wang")||(m_techniciankey=="cangjinggedashi"&&namestr2=="藏经阁大师")||(m_techniciankey=="fangzhangdashi"&&namestr2=="方丈大师")||(m_techniciankey=="kurongdashi"&&namestr2=="枯荣大师"))
{
if(m_techniciangrade<=4&&m_techniciangrade>=1)
{
CString technicianmsg;
m_technicianCombo.GetLBText(m_technicianCombo.GetCurSel(),technicianmsg);
m_welcome.SetSel(0,-1);
m_welcome.SetMargins(1,10);
m_welcome.ReplaceSel(technicianmsg);
m_welcome.ReplaceSel("技术员您好!");
///////////////////////////////////
//级别输出
UpdateData(TRUE);
m_showgrade.Format("%d",m_techniciangrade);
UpdateData(FALSE);
///////////////////////////////////
//计算工资
technician.grade=m_techniciangrade;
technician.hours=m_hours;
m_result.Format("%10.2f",technician.pay());
UpdateData(FALSE);
}else{AfxMessageBox("级别输入错误!请重新输入!");}
UpdateData(FALSE);
}else{AfxMessageBox("密码错误,请重新输入!");}
}
//////////////////////////////
//salesmanager
if(iManagerRadio==IDC_SALESMANAGER_RADIO)
{
CString namestr3;
m_salesmanagerCombo.GetLBText(m_salesmanagerCombo.GetCurSel(),namestr3);
if((m_salesmanagerkey=="Li"&&namestr3=="Li")||(m_salesmanagerkey=="azhu"&&namestr3=="阿珠")||(m_salesmanagerkey=="wangguniang"&&namestr3=="王姑娘")||(m_salesmanagerkey=="xixiagongzhu"&&namestr3=="西夏公主"))
{
if(m_salesmanagergrade<=4&&m_salesmanagergrade>=1)
{
CString salesmanagermsg;
m_salesmanagerCombo.GetLBText(m_salesmanagerCombo.GetCurSel(),salesmanagermsg);
m_welcome.SetSel(0,-1);
m_welcome.SetMargins(1,10);
m_welcome.ReplaceSel(salesmanagermsg);
m_welcome.ReplaceSel("销售经理您好!");
///////////////////////////////////
//级别输出
UpdateData(TRUE);
//附加功能三
/*若销售经理所在部门的月销售额超过500000元,则将其级别提升1级;
若该销售经理已经为4级(最高级),则加发奖金50000元。
(如某销售经理级别为4级,所在部门该月销售额超过500000元,则计算当月薪水时,多发奖金5000元,
公式为:salary = fixed_salary + rate3*sales + grade*1000+5000 rate3=7‰, fixed_salary=4000,
grade=4)
*程序运行要求: 输入销售经理姓名、级别、部门销售额。
要求显示当前级别、奖金金额(没有奖金时,显示为0)和本月月薪。*/
if(m_sales<=500000)
{
m_salesmanagergrade=m_salesmanagergrade;
}else
{
m_salesmanagergrade=m_salesmanagergrade+1;
if(m_salesmanagergrade>4)
{
m_salesmanagergrade=4;
salesmanager.moresalary=true;
AfxMessageBox("鉴于您的优秀表现,特发奖金5000元!");
}else
{
AfxMessageBox("鉴于您的优秀表现,恭喜您提升一级!");
}
}
m_showgrade.Format("%d",m_salesmanagergrade);
UpdateData(FALSE);
//计算工资
salesmanager.grade2=m_salesmanagergrade;
salesmanager.sales=m_sales;
m_result.Format("%10.2f",salesmanager.pay());
UpdateData(FALSE);
}else{AfxMessageBox("级别输入错误!请重新输入!");}
UpdateData(FALSE);
}else{AfxMessageBox("密码错误,请重新输入!");}
}
////////////////////////////////////////////////
//salesman
if(iManagerRadio==IDC_SALESMAN_RADIO)
{
CString namestr4;
m_salesmanCombo.GetLBText(m_salesmanCombo.GetCurSel(),namestr4);
if((m_salesmankey=="Sun"&&namestr4=="Sun")||(m_salesmankey=="duanyanqing"&&namestr4=="段延庆")||(m_salesmankey=="jiumozhi"&&namestr4=="鸠摩智")||(m_salesmankey=="murongfu"&&namestr4=="慕容复"))
{
if(m_salesmangrade<=4&&m_salesmangrade>=1)
{
CString salesmanmsg;
m_salesmanCombo.GetLBText(m_salesmanCombo.GetCurSel(),salesmanmsg);
m_welcome.SetSel(0,-1);
m_welcome.SetMargins(1,10);
m_welcome.ReplaceSel(salesmanmsg);
m_welcome.ReplaceSel("推销员您好!");
//级别输出
UpdateData(TRUE);
//附加功能二
/*若推销员每月个人销售额超过80000元,则将其级别提升1级;
若每月个人销售额超过160000元,则将其级别提升2级。其薪水按提升后的级别计算。
(如某推销员原级别为1级,本月销售额为17000元,则计算当月薪水时,将其级别提升为3级,
计算公式为:salary = sales*rate2+ grade*1000, rate2=8%, grade=3)
*程序运行要求: 输入推销员姓名、级别、个人销售额。
要求显示其本月销售额、当前级别和本月月薪。*/
CString str1="您本月的销售额为:";
CString str3=(CString)m_sales2;
str3.Format("%10.2f",m_sales2);
CString str2="元,恭喜您提升一级!";
CString str4="元,恭喜您提升二级!";
if(m_sales2<=80000)
{
m_salesmangrade=m_salesmangrade;
}else if(m_sales2<=160000)
{
m_salesmangrade=m_salesmangrade+1; //若推销员每月个人销售额超过80000元,则将其级别提升1级
AfxMessageBox(str1+str3+str2);
}else
{
m_salesmangrade=m_salesmangrade+2; //若推销员每月个人销售额超过160000元,则将其级别提升2级
AfxMessageBox(str1+str3+str4);
}
if(m_salesmangrade>=4)
{
m_salesmangrade=4;
}
m_showgrade.Format("%d",m_salesmangrade);
UpdateData(FALSE);
//计算工资
salesman.grade=m_salesmangrade;
salesman.sales=m_sales2;
m_result.Format("%10.2f",salesman.pay());
UpdateData(FALSE);
}else{AfxMessageBox("级别输入错误!请重新输入!");}
UpdateData(FALSE);
}else{AfxMessageBox("密码错误,请重新输入!");}
}
////////////////////////////
//职员编号
int num_of_employee;
num_of_employee=++max_num;
m_Num.Format("%d",num_of_employee);
UpdateData(FALSE);
}
void CMyhomeworkDlg::OnChangeInputmanagergradeEdit()
{
// 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_showgrade.Format("%d",m_managergrade);
}
void CMyhomeworkDlg::OnChangeInputtechniciangradeEdit()
{
// 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.
UpdateData(TRUE);
m_showgrade.Format("%d",m_techniciangrade);
// TODO: Add your control notification handler code here
}
void CMyhomeworkDlg::OnChangeInputsalesmangradeEdit()
{
// 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_showgrade.Format("%d",m_salesmangrade);
}
void CMyhomeworkDlg::OnChangeInputsalesmanagergradeEdit()
{
// 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_showgrade.Format("%d",m_salesmanagergrade);
}
void CMyhomeworkDlg::OnChangeManagerEdit()
{
// 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);
UpdateData(FALSE);
}
void CMyhomeworkDlg::OnChangeSalesmanEdit()
{
// 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);
UpdateData(FALSE);
}
void CMyhomeworkDlg::OnChangeSalesmanagerEdit()
{
// 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);
UpdateData(FALSE);
}
void CMyhomeworkDlg::OnChangeTechnicianEdit()
{
// 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);
UpdateData(FALSE);
}
void CMyhomeworkDlg::OnSelchangeManagerCombo()
{
// TODO: Add your control notification handler code here
}
void CMyhomeworkDlg::OnSelchangeSalesmanCombo()
{
// TODO: Add your control notification handler code here
}
void CMyhomeworkDlg::OnSelchangeSalesmanagerCombo()
{
// TODO: Add your control notification handler code here
}
void CMyhomeworkDlg::OnSelchangeTechnicianCombo()
{
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -