VC++药品销售管理系统(源代码+总框图) 第7页
for(int i = 0;i <m_Numberx.GetLength();i++)
{
if(!isdigit(m_Numberx[i]))
return false;
}
return true;
}
void Back::OnButhuan()
{
UpdateData(true);
int Index1,JiShu;
bool Jin=true,Kcheck=true;
CMedManageApp *app = (CMedManageApp *)AfxGetApp();
if(m_Name.IsEmpty()) //若药名栏为空
{
MessageBox("请输入药名!");
}
else if(m_Kind.IsEmpty()) //若类别栏为空
{
MessageBox("请输入药品类别!");
}
else if(!Check2(m_Number)) //若类别栏中含非法字符
{
MessageBox("数据栏含非法字符!");
}
else if(!Check2(m_Price)) //若类别栏中含非法字符
{
MessageBox("价格栏含非法字符!");
}
else
{
Index1=app->single.GetYaoNum(2);
if(Index1)
{
while(Index1--)
{
if(m_Name==app->single.GetYao(Index1,2)->YName)
{
if(atoi(app->single.GetYao(Index1,2)->YNumber)<atoi(m_Number))
{MessageBox("退货过多");Kcheck=false;}
else
JiShu=Index1;
Kcheck=true;
break;
}
else
Kcheck=false;
}
if(Kcheck==true)
{
Index1=app->single.GetYaoNum(3);
while(Index1--)
{
if(app->single.GetYao(Index1,3)->YName==m_Name)
{
MessageBox("列表中已经有该项了");
Jin=false;
}
}
if(Jin==true)
{
app->single.AddYao(m_Name,m_Kind,m_Number,m_Price,3);
int temp=atoi(app->single.GetYao(JiShu,2)->YNumber)-atoi(m_Number);//修改退货列表
app->single.GetYao(JiShu,2)->YNumber.Format("%d",temp);
Index1=app->single.GetYaoNum(1);
while(Index1--)
{
if(app->single.GetYao(Index1,1)->YName==m_Name)
{
int temp1=atoi(app->single.GetYao(Index1,1)->YNumber)+atoi(m_Number);//修改库存
www.751com.cn
m_Money.Format("%d",atoi(m_Number)*atoi(m_Price));
UpdateData(false);
}
int Index;
Index=app->single.GetYaoNum(3);
m_BackList.ResetContent(); //列表清空
for(int i=0;i<Index;i++) //逐条加入信息
{
m_BackList.AddString(app->single.GetYao(i,3)->YName);
}
}
else
MessageBox("销售列表中没有此货物");
}
MessageBox("销售列表中还没有货物");
}
}
void Back::OnButcheck()
{
int Index;
CMedManageApp *app = (CMedManageApp *)AfxGetApp();
Index=app->single.GetYaoNum(3);
m_BackList.ResetContent(); //列表清空
for(int i=0;i<Index;i++) //逐条加入信息
{
m_BackList.AddString(app->single.GetYao(i,3)->YName);
}
}void Back::OnSelchangeList1()
{
CMedManageApp *app = (CMedManageApp *)AfxGetApp();
int nIndex=m_BackList.GetCurSel();
if(nIndex!=LB_ERR)
{
m_Name=app->single.GetYao(nIndex,3)->YName;
m_Kind=app->single.GetYao(nIndex,3)->YKind;
m_Number=app->single.GetYao(nIndex,3)->YNumber;
m_Price=app->single.GetYao(nIndex,3)->YPrice;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页