private void btnDispense_Click(object sender, EventArgs e)
 {
     try
     {
         Decimal newDispFee = 0;
         this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
         if (ConfigManager.IsChecking(_currentDeptId) == true)
         {
             MessageBox.Show("药品正在盘点中......");
             return;
         }
         if (this._recipeOrder == null)
         {
             MessageBox.Show("没有药品可发");
             return;
         }
         if (this._recipeOrder.Rows.Count < 1)
         {
             MessageBox.Show("没有药品可发");
             return;
         }
         if (_dispenseModel == 1)
         {
             if (_currentZYPat == null)
             {
                 MessageBox.Show("没有病人需要发药");
                 return;
             }
             YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(_currentZYPat, (int)_currentDeptId, (int)_currentUserId);
             newDispFee = IN_InterFace.QueryPatDispFee(_currentZYPat, (int)_currentDeptId);
             if (this.CompareFee(newDispFee) == false)
             {
                 MessageBox.Show("该病人因费用冲账发药信息需要刷新,请重新刷新");
                 return;
             }
             if (_recipeOrder != null)
             {
                 List <BillOrder> dispList = _billProcessor.BuildNewDispOrder(_recipeOrder, dispMaster, _dispenseModel);
                 _billProcessor.SaveBill(dispMaster, dispList, _currentDeptId);
                 MessageBox.Show("发药成功...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 _recipeOrder = IN_InterFace.QueryRecipeOrder(_currentZYPat, (int)_currentDeptId);
                 dgrdRecipeInfo.DataSource = _recipeOrder;
             }
         }
         //如果是住院统领
         else
         {
             ZY_PatList dispPat;
             for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++)
             {
                 dispPat     = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag;
                 newDispFee += IN_InterFace.QueryPatDispFee(dispPat, (int)_currentDeptId);
             }
             if (CompareFee(newDispFee) == false)
             {
                 MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新");
                 return;
             }
             List <BillMaster> dispList = new List <BillMaster>();
             for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++)
             {
                 dispPat = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag;
                 YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(dispPat, (int)_currentDeptId, (int)_currentUserId);
                 dispList.Add(dispMaster);
             }
             YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats));
             MessageBox.Show("发药成功,开始打印统领发药单据...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             PrintDispTL(dispList, newDispDept);
             LoadTLMessage();
         }
         this.txtQueryNum.Focus();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     finally
     {
         this.Cursor = DefaultCursor;
     }
 }
示例#2
0
        private void btnDispense_Click(object sender, EventArgs e)
        {
            try
            {
                Decimal newDispFee = 0;
                this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                if (ConfigManager.IsChecking(_currentDeptId) == true)
                {
                    MessageBox.Show("药品正在盘点中......");
                    return;
                }
                if (this._recipeOrder == null)
                {
                    MessageBox.Show("没有药品可发");
                    return;
                }
                if (this._recipeOrder.Rows.Count < 1)
                {
                    MessageBox.Show("没有药品可发");
                    return;
                }

                for (int index = 0; index < selectPat.Count; index++)
                {
                    newDispFee += IN_InterFace.QueryPatDispFee(selectPat[index], (int)_currentDeptId);
                }
                if (CompareFee(newDispFee) == false)
                {
                    MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新");
                    return;
                }
                List <BillMaster> dispList = new List <BillMaster>();
                for (int index = 0; index < selectPat.Count; index++)
                {
                    DataTable   dt         = (DataTable)_allDispPats[selectPat[index].CureNo];
                    YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId,
                                                                                   Convert.ToInt32(dt.Rows[0]["presamount"].ToString()), Convert.ToInt32(dt.Rows[0]["group_id"].ToString()));
                    dispList.Add(dispMaster);
                    for (int j = 1; j < dt.Rows.Count; j++)
                    {
                        if (dt.Rows[j]["group_id"].ToString().Trim() != dt.Rows[j - 1]["group_id"].ToString().Trim())
                        {
                            dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId,
                                                                               Convert.ToInt32(dt.Rows[j]["presamount"].ToString()), Convert.ToInt32(dt.Rows[j]["group_id"].ToString()));
                            dispList.Add(dispMaster);
                        }
                    }
                }
                YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats));
                MessageBox.Show("发药成功,开始打印摆药单...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                PrintBy();
                // PrintDispTL(dispList, newDispDept);
                dgrdRecipeInfo.DataSource = null;
                LoadMsgMaster();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
            finally
            {
                this.Cursor = DefaultCursor;
            }
        }