e.GetYaoNum1 whileIndex1-- ifapp-gtsingle.GetYaoIndex11-gtYNamem_Name MessageBoxquot列表中已经有该项了quot Jinfalse ifJintrue app-gtsingle.AddYaom_Namem_Kindm_Numberm_Price1 CDialog::OnOK 4.3 销售模块的实现 (1)药品销售系统的药品销售功能模块实现药品销售的相关操作,如图4.3所示,为药品销售界面。
药品销售功能模块由药名、类别、数量、价格、总价、销售列表和销售详情组成,此对话框由七个静态文本框、四个可编辑文本框、列表和四个按钮构成,实现销售药品的功能,分为售出、查询、修改和退出等功能,在药品采购完之后,从库存里售出相应的药品,如果库存里没有相应药品的采购,则无法进行销售。
图4.3 药品销售界面 (2)各控件的说明如下: 药品:输入销售的药品名,为字符型变量,否则出错; 类别:输入销售的药品类别,为字符型变量。
数量:输入销售的药品数量,为整形变量,其值不能小于0,大于采购的数量,否则库存不够,无法进行销售。
价格:输入销售的药品价格,为整形变量,其值大于0。
总价:在输入完药品名、类别、数量和价格之后,进行相应的操作时,总价会显示总的价格。
销售列表:在输入完药品名、类别、数量和价格,售出药品之后,销售列表会显示当前销售的药品名。
销售详单:在售出药品之后,在销售列表中有相应的药品名,而对应的销售记录在销售详单里,通过列表显示出来。
售出:在输入完药品名、类别、数量和价格,点击售出,则将相应的药品名和记录添加到销售列表和销售详单里。
查询:点击查询按钮之后,销售列表里会显示售出的药品名进行查询,通过销售详单显示相应的记录。
修改:只能对销售的数量进行修改,修改成功后将记录添加到销售列表和销售详单里。
退出:点击该按钮即实现退出销售界面。
(3)核心代码: bool CheckCString ampm_Numberx //检查是否含不是数字的项 forint i 0i ltm_Numberx.GetLengthi ifisdigitm_Numberxi return false return true void Sell::OnTotal UpdateDatatrue int Index1JiShu bool JintrueKchecktrue CMedManageApp app CMedManageApp AfxGetApp ifm_Name.IsEmpty //若药名栏为空 MessageBoxquot请输入药名!quot else ifm_Kind.IsEmpty //若类别栏为空 MessageBoxquot请输入药品类别!quot else ifCheckm_Number //若类别栏中含非法字符 MessageBoxquot数据栏含非法字符!quot else ifCheckm_Price //若类别栏中含非法字符 MessageBoxquot价格栏含非法字符!quot else Index1app-gtsingle.GetYaoNum1 ifIndex1 whileIndex1-- ifm_Nameapp-gtsingle.GetYaoIndex11-gtYName ifatoiapp-gtsingle.GetYaoIndex11-gtYNumberltatoim_Number MessageBoxquot库存不够quotKcheckfalse else JiShuIndex1 Kchecktrue break else Kcheckfalse ifKchecktrue Index1app-gtsingle.GetYaoNum2 whileIndex1-- ifapp-gtsingle.GetYaoIndex12-gtYNamem_Name MessageBoxquot列表中已经有该项了quot Jinfalse ifJintrue app-gtsingle.AddYaom_Namem_Kindm_Numberm_Price2 int tempatoiapp-gtsingle.GetYaoJiShu1-gtYNumber-atoim_Number app-gtsingle.GetYaoJiShu1-gtYNumber.Formatquotdquottemp m_Total.Formatquotdquotatoim_Numberatoim_Price UpdateDatafalse VC药品销售管理系统源代码总框图 int Index Indexapp-gtsingle.GetYaoNum2 m_XiaoList.ResetContent //列表清空 forint i0iltIndexi//逐条加入信息 m_XiaoList.AddStringapp-gtsingle.GetYaoi2-gtYName else MessageBoxquot库存中没有此货物quot MessageBoxquot库存中还没有此货物quot void Sell::OnOK CDialog::OnOK void Sell::OnSelchangeList1 CMedManageApp app CMedManageApp AfxGetApp int nIndexm_XiaoList.GetCurSel m_SingXiao.ResetContent ifnIndexLB_ERR m_SingXiao.AddStringapp-gtsingle.GetYaonIndex2-gtYName m_SingXiao.AddStringapp-gtsingle.GetYaonIndex2-gtYKind m_SingXiao.AddStringapp-gtsingle.GetYaonIndex2-gtYNumber m_SingXiao.AddStringapp-gtsingle.GetYaonIndex2-gtYPrice m_Nameapp-gtsingle.GetYaonIndex2-gtYName m_Kindapp-gtsingle.GetYaonIndex2-gtYKind m_Numberapp-gtsingle.GetYaonIndex2-gtYNumber m_Priceapp-gtsingle.GetYaonIndex2-gtYPrice UpdateDatafalse void Sell::OnButsearch int Index CMedManageApp app CMedManageApp AfxGetApp Indexapp-gtsingle.GetYaoNum2 m_XiaoList.ResetContent //列表清空 forint i0iltIndexi //逐条加入信息 m_XiaoList.AddStringapp-gtsingle.GetYaoi2-gtYName void Sell::OnButalter UpdateDatatrue CMedManageApp app CMedManageApp AfxGetApp int nIndexm_XiaoList.GetCurSel CString temp ifnIndexLB_ERR tempapp-gtsingle.GetYaonIndex2-gtYNumber app-gtsingle.GetYaonIndex2.
上一篇:
CserialPort类(附VC基于MFC单文档协议通讯源程序及详细编程步骤)
下一篇:
钻孔桩(旋挖钻)施工方法探析