コード例 #1
0
        /// <summary>
        /// update thông tin của phân tạo phiếu thông tin của phần de nghi cap phat thuoc noi tru
        /// </summary>
        void UpdataData()
        {
            try
            {
                List <TThuocCapphatChitiet> lstTThuocCapphatChitiet = Taodulieuchitietcapphat();
                TPhieuCapphatNoitru         objTPhieuCapphatNoitru  = TaoPhieuCapphatNoitru();
                if (lstTThuocCapphatChitiet == null || lstTThuocCapphatChitiet.Count() <= 0)
                {
                    //Utility.ShowMsg("Chưa có thuốc nào được chọn cấp phát");
                    return;
                }
                ActionResult actionResult = new CapphatThuocKhoa().CappnhatPhieucapphatNoitru(objTPhieuCapphatNoitru, TaoPhieuCapphatChitiet(), lstTThuocCapphatChitiet);
                switch (actionResult)
                {
                case ActionResult.Success:
                    //Utility.ShowMsg("Cập nhật thông tin thành công");
                    cmdPrint.Enabled       = true;
                    cmdPrintDetail.Enabled = true;
                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Có lỗi trong quá trình lưu thông tin");
                    break;
                }
            }
            catch (Exception ex)
            {
                log.ErrorException("ban ra Exception=", ex);
                Utility.ShowMsg("Có lỗi trong quá trình lưu thông tin /n" + ex.ToString());
            }
        }
コード例 #2
0
 void mnuHuyLinhthuocAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdPres))
         {
             return;
         }
         List <int> lstNoValidData = new List <int>();
         List <int> lstID_Donthuoc = (from p in grdPres.GetDataRows().AsEnumerable()
                                      where Utility.Int32Dbnull(((DataRowView)p.DataRow)[TPhieuCapphatChitiet.Columns.DaLinh], -1) == 1
                                      select Utility.Int32Dbnull(((DataRowView)p.DataRow)["id_donthuoc"], -1)).ToList <int>();
         if (lstID_Donthuoc.Count <= 0)
         {
             return;
         }
         if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn hủy bệnh nhân lĩnh thuốc cho {0} đơn thuốc đang chọn hay không?", lstID_Donthuoc.Count.ToString()), "Thông báo", true))
         {
             frm_NhaplydoHuy _NhaplydoHuy = new frm_NhaplydoHuy();
             _NhaplydoHuy.ShowDialog();
             if (!_NhaplydoHuy.m_blnCancel)
             {
                 if (CapphatThuocKhoa.BenhNhanLinhThuoc(idPhieucapphat, lstID_Donthuoc, 0, ref lstNoValidData) == ActionResult.Success)
                 {
                     foreach (GridEXRow _row in grdPres.GetDataRows())
                     {
                         if (lstID_Donthuoc.Contains(Utility.Int32Dbnull(_row.Cells["id_donthuoc"].Value, -1)))
                         {
                             _row.BeginEdit();
                             _row.Cells["da_linh"].Value = 0;
                             if (lstNoValidData.Count > 0 && lstNoValidData.Contains(Utility.Int32Dbnull(_row.Cells["id_donthuoc"].Value, -1)))
                             {
                                 _row.Cells["not_valid"].Value = 1;
                             }
                             _row.EndEdit();
                         }
                     }
                     grdPres.Refetch();
                     Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuốc thành công!", false);
                 }
                 else
                 {
                     Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuóc không thành công!Liên hệ VMS để được trợ giúp", true);
                 }
                 mnuHuyLinhthuocAll.Enabled     = m_Donthuoc.Select("da_linh=1").Length > 0;
                 mnuLinhthuocAll.Enabled        = m_Donthuoc.Select("da_linh=0").Length > 0;
                 mnuHuyLinhthuocCurrent.Enabled = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "1";
                 mnuLinhthuocCurrent.Enabled    = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "0";
                 if (lstNoValidData.Count > 0)
                 {
                     Utility.ShowMsg("Chú ý: Một số đơn thuốc bạn chọn chứa thuốc trả lại đã được tổng hợp trong phiếu trả thuốc thừa nên hệ thống bỏ qua không thực hiện và đánh dấu màu đỏ. Đề nghị bạn kiểm tra lại");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
コード例 #3
0
        private void cmdCheck_Click(object sender, EventArgs e)
        {
            if (cboKhoxuat.SelectedValue.ToString() == "-1")
            {
                Utility.ShowMsg("Bạn cần chọn kho xuất");
                cboKhoxuat.Focus();
                return;
            }
            TPhieuCapphatNoitru _item = TPhieuCapphatNoitru.FetchByID(_ID_CAPPHAT);

            if (_item == null)
            {
                Utility.ShowMsg("Phiếu bạn chọn đã bị người khác tác động xóa mất. Đề nghị nhấn tìm kiếm để thử kiểm tra lại");
                return;
            }
            ActionResult ActionResult = new CapphatThuocKhoa().Kiemtratonthuoc(_ID_CAPPHAT, Utility.Int16Dbnull(cboKhoxuat.SelectedValue, -1));

            switch (ActionResult)
            {
            case ActionResult.Success:
                Utility.ShowMsg("Thuốc trong kho còn đủ để cấp phát");
                break;

            case ActionResult.NotEnoughDrugInStock:
                //Đã thông báo
                break;

            case ActionResult.UNKNOW:
                Utility.ShowMsg("Tồn tại thuốc trong đơn cấp phát đã bị xóa khỏi bảng danh mục thuốc. Mời bạn kiểm tra lại!");
                break;

                break;
            }
        }
コード例 #4
0
        /// <summary>
        ///     hàm thực hiện việc lưu lại thông tin
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSave_Click(object sender, EventArgs e)
        {
            TPhieuCapphatNoitru objPhieuCapphat = CreatePhieuCapPhat();
            ActionResult        actionResult    =
                new CapphatThuocKhoa().UpdatePhieuCapPhat(objPhieuCapphat,
                                                          CreatePhieuCapPhatCT(), Utility.Int32Dbnull(txtId_KhoXuat.Text));

            switch (actionResult)
            {
            case ActionResult.Success:
                if (me_Action == action.Insert)
                {
                    me_Action = action.Update;
                }
                txtID_CAPPHAT.Text = Utility.sDbnull(objPhieuCapphat.IdCapphat);
                AdTPhieuCapphatNoitru();
                Utility.set(lblMessage, "Bạn lưu thành công", true);
                if (chkLuuVaIn.Checked)
                {
                    cmdInPhieu.PerformClick();
                }
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình lưu phiếu cấp phát", "Thông báo", MessageBoxIcon.Error);
                break;
            }
        }
コード例 #5
0
        void mnuHuyLinhthuocCurrent_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.isValidGrid(grdPres))
                {
                    return;
                }
                List <int> lstNoValidData = new List <int>();
                List <int> lstID_Donthuoc = new List <int>()
                {
                    Utility.Int32Dbnull(grdPres.GetValue("id_donthuoc"), -1)
                };
                if (Utility.AcceptQuestion("Bạn có chắc chắn hủy lĩnh thuốc cho Bệnh nhân đang chọn hay không?", "Thông báo", true))
                {
                    if (Trathuocthua.ThuocNoitruKiemtraThuoctralai(idPhieucapphat, Utility.Int64Dbnull(grdPres.GetValue("id_donthuoc"))))
                    {
                        Utility.ShowMsg("Đơn thuốc của bệnh nhân bạn đang chọn đã có chi tiết được tổng hợp trả thuốc thừa nên không thể đánh dấu hủy lĩnh thuốc được.\nĐề nghị bạn kiểm tra lại!");
                        return;
                    }
                    if (CapphatThuocKhoa.BenhNhanLinhThuoc(idPhieucapphat, lstID_Donthuoc, 0, ref lstNoValidData) == ActionResult.Success)
                    {
                        grdPres.CurrentRow.BeginEdit();
                        grdPres.CurrentRow.Cells["da_linh"].Value = 0;
                        if (lstNoValidData.Count > 0 && lstNoValidData.Contains(Utility.Int32Dbnull(grdPres.CurrentRow.Cells["id_donthuoc"].Value, -1)))
                        {
                            grdPres.CurrentRow.Cells["not_valid"].Value = 1;
                        }
                        grdPres.CurrentRow.EndEdit();
                        grdPres.Refetch();
                        Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuốc thành công!", false);
                    }
                    else
                    {
                        Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuốc không thành công!Liên hệ VMS để được trợ giúp", true);
                    }



                    mnuHuyLinhthuocAll.Enabled     = m_Donthuoc.Select("da_linh=1").Length > 0;
                    mnuLinhthuocAll.Enabled        = m_Donthuoc.Select("da_linh=0").Length > 0;
                    mnuHuyLinhthuocCurrent.Enabled = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "1";
                    mnuLinhthuocCurrent.Enabled    = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "0";
                    if (lstNoValidData.Count > 0)
                    {
                        Utility.ShowMsg("Chú ý: Một số đơn thuốc bạn chọn chứa thuốc trả lại đã được tổng hợp trong phiếu trả thuốc thừa nên hệ thống bỏ qua không thực hiện và đánh dấu màu đỏ. Đề nghị bạn kiểm tra lại");
                    }
                    //}
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #6
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.isValidGrid(grdList))
                {
                    Utility.ShowMsg("Bạn cần chọn phiếu để xóa");
                    return;
                }
                TPhieuCapphatNoitru _item = TPhieuCapphatNoitru.FetchByID(_ID_CAPPHAT);
                if (_item == null)
                {
                    Utility.ShowMsg("Phiếu bạn chọn đã bị người khác tác động xóa mất. Đề nghị nhấn tìm kiếm để thử kiểm tra lại");
                    return;
                }
                if (DAPHATTHUOC_BENHNHAN())
                {
                    Utility.ShowMsg("Đã phát thuốc cho Bệnh nhân nên bạn không thể xóa phiếu");
                    return;
                }

                if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn xóa phiếu lĩnh thuốc nội trú đang chọn hay không?", "Xác nhận xóa", true))
                {
                    return;
                }
                ActionResult actionResult = new CapphatThuocKhoa().XoaPhieuCapPhatNoiTru(_ID_CAPPHAT);
                switch (actionResult)
                {
                case ActionResult.Success:
                    if (dtDrugList != null)
                    {
                        dtDrugList.Rows.Clear();
                    }
                    DataRow[] drDetele = dtList.Select(TPhieuCapphatNoitru.Columns.IdCapphat + " = " + _ID_CAPPHAT);
                    dtList.Rows.Remove(drDetele[0]);
                    dtList.AcceptChanges();

                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Có lỗi trong quá trình xóa dữ liệu");
                    break;
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Có lỗi trong quá trình xóa dữ liệu /n" + ex);
            }
            finally
            {
                modifyActButtons();
            }
        }
コード例 #7
0
        private void cmdHuychuyenkho_Click(object sender, EventArgs e)
        {
            try
            {
                cmdHuychuyenkho.Enabled = false;
                if (Utility.AcceptQuestion("Bạn có muốn hủy xác nhận phiếu trả thuốc từ khoa nội trú về kho hay không?", "Thông báo", true))
                {
                    string errMsg  = "";
                    int    IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                    TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);
                    if (objTPhieuNhapxuatthuoc != null)
                    {
                        if (Utility.ByteDbnull(objTPhieuNhapxuatthuoc.TrangThai, 0) == 0)
                        {
                            return;
                        }
                        ActionResult actionResult =
                            new CapphatThuocKhoa().HuyXacNhanPhieuTrathuocTutrucKhoaVeKho(objTPhieuNhapxuatthuoc, ref errMsg);
                        switch (actionResult)
                        {
                        case ActionResult.Success:
                            Utility.ShowMsg("Bạn thực hiện hủy xác nhận phiếu trả thuốc từ khoa nội trú về kho thành công", "Thông báo");
                            grdList.CurrentRow.BeginEdit();
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.TrangThai].Value    = 0;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NgayXacnhan].Value  = DBNull.Value;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NguoiXacnhan].Value = DBNull.Value;
                            grdList.CurrentRow.EndEdit();
                            break;

                        case ActionResult.Exceed:
                            Utility.ShowMsg("Thuốc trong kho lẻ(nhận) đã được sử dụng hết nên bạn không thể hủy phiếu trả thuốc ", "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.NotEnoughDrugInStock:
                            Utility.ShowMsg("Thuốc trong kho lẻ(nhận) đã sử dụng gần hết nên không còn đủ số lượng để hoàn trả lại tủ thuốc", "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
コード例 #8
0
        private void cmdHuychuyenkho_Click(object sender, EventArgs e)
        {
            try
            {
                cmdHuychuyenkho.Enabled = false;
                Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
                if (Utility.AcceptQuestion("Bạn có chắc chắn muốn hủy xác nhận phiếu xuất thuốc Bệnh nhân nội trú đang chọn hay không?", "Thông báo", true))
                {
                    string errMsg  = "";
                    int    IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                    TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);
                    if (objTPhieuNhapxuatthuoc != null)
                    {
                        ActionResult actionResult =
                            new CapphatThuocKhoa().HuyXacNhanPhieuCapphatkholeBNNoitru(objTPhieuNhapxuatthuoc, ref errMsg);
                        switch (actionResult)
                        {
                        case ActionResult.Success:
                            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Bạn thực hiện hủy xác nhận phiếu cấp phát thành công", false);
                            grdList.CurrentRow.BeginEdit();
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.TrangThai].Value    = 0;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NgayXacnhan].Value  = DBNull.Value;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NguoiXacnhan].Value = DBNull.Value;
                            grdList.CurrentRow.EndEdit();
                            break;

                        case ActionResult.Exceed:
                            Utility.ShowMsg("Thuốc trong kho nhập đã được sử dụng hết nên bạn không thể hủy phiếu cấp phát", "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.NotEnoughDrugInStock:
                            Utility.ShowMsg("Thuốc trong kho nhập đã gần hết nên bạn không thể hủy phiếu cấp phát", "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
コード例 #9
0
        private void cmdHuyXacNhan_Click(object sender, EventArgs e)
        {
            ActionResult actionHXN = CapphatThuocKhoa.BenhNhanLinhThuoc(dtChitietcapphattheodon, 0);

            switch (actionHXN)
            {
            case ActionResult.Success:
                UpdateGird(0);
                ModifyCommands();
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi khi hủy xác nhận Bệnh nhân lĩnh thuốc nội trú");
                break;
            }
        }
コード例 #10
0
        /// <summary>
        /// thêm thông tni của đề nghị cấp phat thuốc nọi trú
        /// </summary>
        void InsertData()
        {
            try
            {
                List <TThuocCapphatChitiet> lstTThuocCapphatChitiet = Taodulieuchitietcapphat();
                TPhieuCapphatNoitru         objTPhieuCapphatNoitru  = TaoPhieuCapphatNoitru();
                if (lstTThuocCapphatChitiet == null || lstTThuocCapphatChitiet.Count() <= 0)
                {
                    //Utility.ShowMsg("Chưa có thuốc nào được chọn cấp phát");
                    return;
                }
                ActionResult actionResult = new CapphatThuocKhoa().ThemPhieuCapPhatNoiTru(objTPhieuCapphatNoitru, TaoPhieuCapphatChitiet(), lstTThuocCapphatChitiet);

                switch (actionResult)
                {
                case ActionResult.Success:
                    //Chuyển về trạng thái Update
                    m_Action               = action.Update;
                    _IDCAPPHAT             = objTPhieuCapphatNoitru.IdCapphat;
                    cmdPrint.Enabled       = true;
                    cmdPrintDetail.Enabled = true;
                    ProcessDataInsert(_IDCAPPHAT);
                    if (_OnInsertCompleted != null)
                    {
                        _OnInsertCompleted(_IDCAPPHAT);
                    }
                    //Utility.ShowMsg("Đã thực hiện cấp phát thuốc thành công\nBạn có thể in phiếu cấp phát thuốc tổng hợp hoặc phiếu cấp phát thuốc chi tiết để mang đến quầy thuốc xin cấp phát.");
                    cmdPrint.Focus();
                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Có lỗi trong quá trình lưu thông tin");
                    break;
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Có lỗi trong quá trình lưu thông tin /n" + ex.ToString());
            }
        }
コード例 #11
0
        /// <summary>
        /// hàm thực hiện việc cho phép chuyển thông tin xác nhận vào kho
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdNhapKho_Click(object sender, EventArgs e)
        {
            try
            {
                cmdNhapKho.Enabled = false;
                Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
                if (Utility.AcceptQuestion("Bạn có muốn thực hiện trả thuốc từ tủ trực khoa nội trú về kho lẻ hay không?", "Thông báo", true))
                {
                    string errMsg  = "";
                    int    IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                    TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);
                    if (objTPhieuNhapxuatthuoc != null)
                    {
                        DateTime _ngayxacnhan = globalVariables.SysDate;
                        if (THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_HIENTHI_NGAYXACNHAN", "0", false) == "1")
                        {
                            frm_ChonngayXacnhan _ChonngayXacnhan = new frm_ChonngayXacnhan();
                            _ChonngayXacnhan.pdt_InputDate = objTPhieuNhapxuatthuoc.NgayHoadon;
                            _ChonngayXacnhan.ShowDialog();
                            if (_ChonngayXacnhan.b_Cancel)
                            {
                                return;
                            }
                            else
                            {
                                _ngayxacnhan = _ChonngayXacnhan.pdt_InputDate;
                            }
                        }
                        ActionResult actionResult =
                            new CapphatThuocKhoa().XacNhanPhieuTrathuocTutrucKhoaveKho(objTPhieuNhapxuatthuoc, _ngayxacnhan, ref errMsg);
                        switch (actionResult)
                        {
                        case ActionResult.Success:
                            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Trả thuốc từ tủ thuốc khoa nội trú về kho thành công", false);
                            grdList.CurrentRow.BeginEdit();
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.TrangThai].Value    = 1;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NgayXacnhan].Value  = _ngayxacnhan;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NguoiXacnhan].Value = globalVariables.UserName;
                            grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.TrangThai].Value    = 1;
                            grdList.CurrentRow.EndEdit();
                            break;

                        case ActionResult.Exceed:
                            Utility.ShowMsg("Không có thuốc trong tủ trực nên không thể xác nhận phiếu trả thuốc\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Warning);
                            break;

                        case ActionResult.NotEnoughDrugInStock:
                            Utility.ShowMsg("Thuốc trong tủ trực không còn đủ số lượng nên không thể xác nhận phiếu trả thuốc\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Warning);
                            break;

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
コード例 #12
0
        private void PerformCancelConfirmAction()
        {
            try
            {
                if (!Utility.isValidGrid(grdList))
                {
                    Utility.ShowMsg("Bạn cần chọn phiếu để hủy xác nhận");
                    return;
                }

                if (_ID_CAPPHAT == -1)
                {
                    return;
                }
                TPhieuCapphatNoitru _item = TPhieuCapphatNoitru.FetchByID(_ID_CAPPHAT);
                if (_item == null)
                {
                    Utility.ShowMsg("Phiếu bạn chọn đã bị người khác tác động xóa mất. Đề nghị nhấn tìm kiếm để thử kiểm tra lại");
                    return;
                }
                if (DAPHATTHUOC_BENHNHAN())
                {
                    Utility.ShowMsg("Đã phát thuốc cho Bệnh nhân nên bạn không thể hủy xác nhận phiếu");
                    return;
                }
                if (Utility.AcceptQuestion("Bạn có muốn hủy xác nhận cấp phát thuốc cho phiếu đang chọn không?", "Xác nhận hủy cấp phát theo phiếu ", true))
                {
                    short        ID_KHO_XUAT = Utility.Int16Dbnull(grdList.CurrentRow.Cells[TPhieuCapphatNoitru.Columns.IdKhoXuat].Value, -1);
                    string       errmsg      = "";
                    ActionResult action      = new CapphatThuocKhoa().HuyXacnhanphieuCapphatNoitru(_ID_CAPPHAT, ID_KHO_XUAT, ref errmsg);
                    switch (action)
                    {
                    case ActionResult.Success:
                        DataRow dr = Utility.FetchOnebyCondition(dtList, "ID_CAPPHAT=" + _ID_CAPPHAT);
                        if (dr != null)
                        {
                            dr[TPhieuCapphatNoitru.Columns.IdKhoXuat] = -1;
                            dr["TRANG_THAI"]    = 0;
                            dr["ten_trangthai"] = "Chưa cấp phát";
                            dtList.AcceptChanges();
                        }
                        ProcessStatus();
                        Utility.ShowMsg("Đã thực hiện hủy cấp phát thuốc theo phiếu thành công!");
                        break;

                    case ActionResult.DataChanged:
                        Utility.ShowMsg("Phiếu này đã bị người khác vừa thay đổi. Bạn cần nhấn lại nút tìm kiếm để kiểm tra lại tình trạng tồn tại của phiếu");
                        break;

                    case ActionResult.Error:
                        Utility.ShowMsg("Không tìm thấy chi tiết trong bảng đơn thuốc chi tiết. Đề nghị bug lại dữ liệu");
                        break;

                    case ActionResult.Exceed:
                        Utility.ShowMsg("Không xóa hết dữ liệu chi tiết của lần cấp phát bệnh nhân. Bug lại code");
                        break;

                    case ActionResult.Exception:
                        Utility.ShowMsg("Lỗi exception:\n" + errmsg);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.ToString().Trim());
                return;
            }
            finally
            {
                modifyActButtons();
            }
        }
コード例 #13
0
        private void cmdConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.isValidGrid(grdList))
                {
                    Utility.ShowMsg("Bạn cần chọn phiếu để xác nhận");
                    return;
                }
                TPhieuCapphatNoitru _item = TPhieuCapphatNoitru.FetchByID(_ID_CAPPHAT);
                if (_item == null)
                {
                    Utility.ShowMsg("Phiếu bạn chọn đã bị người khác tác động xóa mất. Đề nghị nhấn tìm kiếm để thử kiểm tra lại");
                    return;
                }
                if (DAPHATTHUOC_BENHNHAN())
                {
                    Utility.ShowMsg("Đã phát thuốc cho Bệnh nhân nên bạn không thể xác nhận phiếu");
                    return;
                }
                Int16 StockID = 0;
                if (cboKhoxuat.Items.Count <= 0 || cboKhoxuat.SelectedValue.ToString() == "-1" || cboKhoxuat.SelectedIndex <= -1)
                {
                    Utility.ShowMsg("Bạn cần chọn kho xuất");
                    cboKhoxuat.Focus();
                    return;
                }
                StockID = Utility.Int16Dbnull(cboKhoxuat.SelectedValue, -1);
                if (
                    Utility.AcceptQuestion(string.Format(
                                               "Bạn có muốn lấy thuốc từ kho {0} để cấp cho phiếu đang chọn hay không?", cboKhoxuat.Text),
                                           "Xác nhận ", true))
                {
                    ActionResult ActionResult = new CapphatThuocKhoa().XacnhanphieuCapphatNoitru(_ID_CAPPHAT, StockID, dtNgayPhatThuoc.Value);
                    switch (ActionResult)
                    {
                    case ActionResult.Success:

                        Utility.ShowMsg("Xác nhận cấp phát thuốc thành công");
                        DataRow dr = Utility.FetchOnebyCondition(dtList, "ID_CAPPHAT=" + _ID_CAPPHAT);
                        if (dr != null)
                        {
                            dr[TPhieuCapphatNoitru.Columns.IdKhoXuat] = -1;
                            dr["TRANG_THAI"]    = 1;
                            dr["ten_trangthai"] = "Đã cấp phát";
                            dtList.AcceptChanges();
                        }
                        ProcessStatus();
                        break;

                    case ActionResult.DataChanged:
                        Utility.ShowMsg("Phiếu này đã bị người khác vừa thay đổi. Bạn cần nhấn lại nút tìm kiếm để kiểm tra lại tình trạng tồn tại của phiếu");
                        break;

                    case ActionResult.NotEnoughDrugInStock:
                        Utility.ShowMsg("Số thuốc trong kho không đủ để cấp phát\nVui lòng bấm vào nút Kiểm tra thuốc trong kho bên cạnh để xem chi tiết thuốc còn thiếu");
                        break;

                    case ActionResult.Error:
                        Utility.ShowMsg("Có lỗi trong quá trình cấp phát thuốc");
                        break;

                    case ActionResult.Exceed:
                        Utility.ShowMsg("Có lỗi trong quá trình cập nhật trạng thái đơn thuốc");
                        break;
                    }
                }
            }
            catch
            {
            }
            finally
            {
                modifyActButtons();
            }
        }
コード例 #14
0
 void grdChitiet_UpdatingCell(object sender, Janus.Windows.GridEX.UpdatingCellEventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdChitiet))
         {
             return;
         }
         int  TrangthaiTralai = Utility.Int32Dbnull(Utility.getValueOfGridCell(grdChitiet, TPhieuCapphatChitiet.Columns.TrangthaiTralai), 0);
         int  IdPhieutralai   = Utility.Int32Dbnull(Utility.getValueOfGridCell(grdChitiet, TPhieuCapphatChitiet.Columns.IdPhieutralai), 0);
         long IdChitiet       = Utility.Int64Dbnull(Utility.getValueOfGridCell(grdChitiet, TPhieuCapphatChitiet.Columns.IdChitiet), 0);
         int  soluong         = Utility.Int32Dbnull(grdChitiet.CurrentRow.Cells[TPhieuCapphatChitiet.Columns.SoLuong].Value, -1);
         int  soluongtralai   = 0;
         int  thuclinh        = soluong;
         if (TrangthaiTralai == 1)
         {
             Utility.ShowMsg("Chi tiết này đã được tổng hợp thành phiếu trả thuốc thừa nên bạn không thể thay đổi lại thông tin số lượng thực lĩnh(hoặc số lượng trả lại) nữa\nMời bạn kiểm tra lại");
             e.Cancel = true;
             return;
         }
         if (TrangthaiTralai == 2)
         {
             Utility.ShowMsg("Chi tiết này đã được tổng hợp thành phiếu trả thuốc thừa và đã trả lại kho thuốc nên bạn không thể thay đổi lại thông tin số lượng thực lĩnh(hoặc số lượng trả lại) nữa\nMời bạn kiểm tra lại");
             e.Cancel = true;
             return;
         }
         if (IdPhieutralai > 0)
         {
             Utility.ShowMsg("Chi tiết này đã được tổng hợp thành phiếu trả thuốc thừa nên bạn không thể thay đổi lại thông tin số lượng thực lĩnh(hoặc số lượng trả lại) nữa\nMời bạn kiểm tra lại");
             e.Cancel = true;
             return;
         }
         int soluongsua = Utility.Int32Dbnull(e.Value, 0);
         if (soluongsua > soluong)
         {
             Utility.ShowMsg(string.Format("Số lượng thực lĩnh (hoặc trả lại) phải nhỏ hơn hoặc bằng số lượng kê {0}", soluong.ToString()));
             e.Cancel = true;
             return;
         }
         grdChitiet.CurrentRow.BeginEdit();
         if (e.Column.Key == TPhieuCapphatChitiet.Columns.SoLuongtralai)
         {
             soluongtralai = soluongsua;
             thuclinh      = soluong - soluongsua;
             grdChitiet.CurrentRow.Cells[TPhieuCapphatChitiet.Columns.ThucLinh].Value = soluong - soluongsua;
         }
         else
         {
             thuclinh      = soluongsua;
             soluongtralai = soluong - soluongsua;
             grdChitiet.CurrentRow.Cells[TPhieuCapphatChitiet.Columns.SoLuongtralai].Value = soluong - soluongsua;
         }
         grdChitiet.CurrentRow.EndEdit();
         grdChitiet.Refetch();
         CapphatThuocKhoa.CapnhatThuclinh(
             IdChitiet
             , thuclinh
             , soluongtralai
             );
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }