private void LoadTLMessage()
        {
            List <ZY_PatList> patList = IN_InterFace.QueryAllZYPat((int)_currentDeptId, _searchDeptId);
            ZY_PatList        nullPat = new ZY_PatList();

            nullPat.PatListID         = 0;
            _recipeOrder              = IN_InterFace.QueryRecipeOrder(nullPat, (int)_currentDeptId);
            dgrdRecipeInfo.DataSource = _recipeOrder;
            _allDispPats.Clear();
            foreach (ZY_PatList pat in patList)
            {
                DataTable singleOrder = IN_InterFace.QueryRecipeOrder(pat, (int)_currentDeptId);
                _allDispPats.Add(pat.CureNo, singleOrder);
            }
            LstPatBind(patList);
        }
 private void lstPatInfo_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
         if (_dispenseModel == 1)
         {
             _recipeOrder = IN_InterFace.QueryRecipeOrder(_currentZYPat, (int)_currentDeptId);
             dgrdRecipeInfo.DataSource = _recipeOrder;
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     finally
     {
         this.Cursor = DefaultCursor;
     }
 }
 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;
     }
 }
Example #4
0
        private void treeDrugMsg_AfterCheck(object sender, TreeViewEventArgs e)
        {
            try
            {
                DataTable dt = (DataTable)dgrdRecipeInfo.DataSource;
                if (e.Node != null)
                {
                    this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                    if (e.Node.Level == 2 && e.Node.Checked)
                    {
                        ZY_PatList currentMsg = (ZY_PatList)(e.Node.Tag);
                        _selectDeptId = Convert.ToInt32(currentMsg.CurrDeptCode);
                        selectPat.Remove(currentMsg);
                        selectPat.Add(currentMsg);
                        TreeNode rootNode = treeDrugMsg.Nodes[0];
                        foreach (TreeNode node in rootNode.Nodes)
                        {
                            foreach (TreeNode msgNode in node.Nodes)
                            {
                                if (((ZY_PatList)msgNode.Tag).CurrDeptCode != currentMsg.CurrDeptCode &&
                                    msgNode.Checked == true)
                                {
                                    msgNode.Parent.Checked = false;
                                    break;
                                }
                            }
                        }
                        _allDispPats.Remove(currentMsg.CureNo);
                        if (dt != null)
                        {
                            DataTable recipeDt = IN_InterFace.QueryRecipeOrder(currentMsg, (int)_currentDeptId);
                            _allDispPats.Add(currentMsg.CureNo, recipeDt);
                            DataTable recipeCopy = recipeDt.Clone();
                            recipeCopy.Clear();

                            for (int index = 0; index < recipeDt.Rows.Count; index++)
                            {
                                // _recipeOrder.Rows.Add(recipeDt.Rows[index].ItemArray);
                                recipeCopy.Rows.Add(recipeDt.Rows[index].ItemArray);
                                decimal presamount = (recipeCopy.Rows[index]["presamount"] == null || recipeCopy.Rows[index]["presamount"].ToString() == "0" ? 1 : Convert.ToDecimal(recipeCopy.Rows[index]["presamount"].ToString()));
                                recipeCopy.Rows[index]["amount"] = Convert.ToDecimal(recipeCopy.Rows[index]["amount"].ToString()) / presamount;
                                dt.Rows.Add(recipeCopy.Rows[index].ItemArray);
                            }
                            dgrdRecipeInfo.DataSource = dt;
                        }
                        else
                        {
                            _recipeOrder = IN_InterFace.QueryRecipeOrder(currentMsg, (int)_currentDeptId);
                            _allDispPats.Add(currentMsg.CureNo, _recipeOrder);
                            DataTable dtCopy = _recipeOrder.Clone();
                            dtCopy.Clear();
                            for (int i = 0; i < _recipeOrder.Rows.Count; i++)
                            {
                                dtCopy.Rows.Add(_recipeOrder.Rows[i].ItemArray);
                                decimal presamount = (dtCopy.Rows[i]["presamount"] == null || dtCopy.Rows[i]["presamount"].ToString() == "0" ? 1 : Convert.ToDecimal(dtCopy.Rows[i]["presamount"].ToString()));
                                dtCopy.Rows[i]["amount"] = Convert.ToDecimal(dtCopy.Rows[i]["amount"].ToString()) / presamount;
                            }
                            dgrdRecipeInfo.DataSource = dtCopy;
                        }
                    }
                    if (e.Node.Level == 2 && !e.Node.Checked)
                    {
                        ZY_PatList currentMsg = (ZY_PatList)(e.Node.Tag);
                        selectPat.Remove(currentMsg);
                        _allDispPats.Remove(currentMsg.CureNo);
                        if (_recipeOrder != null)
                        {
                            DataRow[] removeRows = dt.Select("cureno=" + "'" + currentMsg.CureNo.ToString() + "'");
                            foreach (DataRow removeRow in removeRows)
                            {
                                dt.Rows.Remove(removeRow);
                            }
                        }
                        dgrdRecipeInfo.DataSource = dt;
                    }
                    if ((e.Node.Level == 2 && e.Node.Checked) ||
                        (e.Node.Level == 1 && e.Node.Checked))
                    {
                        e.Node.Parent.Checked = true;
                    }
                    if ((e.Node.Level == 1 && !e.Node.Checked) ||
                        (e.Node.Level == 0 && !e.Node.Checked))
                    {
                        foreach (TreeNode node in e.Node.Nodes)
                        {
                            node.Checked = false;
                        }
                    }
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
            finally
            {
                this.Cursor = DefaultCursor;
            }
        }