Exemplo n.º 1
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)
        {
            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
            int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);

            if (objTPhieuNhapxuatthuoc != null)
            {
                string   errMsg       = "";
                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 XuatThuocAo().XacNhanPhieuXuatKho(objTPhieuNhapxuatthuoc, _ngayxacnhan, ref errMsg);
                switch (actionResult)
                {
                case ActionResult.Success:
                    Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Xác nhận phiếu chuyển 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ó " + ten_kieuthuoc_vt + " trong kho xuất nên không thể xác nhận phiếu xuất\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Warning);
                    break;

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

                case ActionResult.Error:
                    break;
                }
            }

            ModifyCommand();
        }
Exemplo n.º 2
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 kho Bệnh nhân đang chọn hay không?", "Thông báo", true))
                {
                    int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                    TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);
                    if (objTPhieuNhapxuatthuoc != null)
                    {
                        string       errMsg       = "";
                        ActionResult actionResult =
                            new XuatThuocAo().HuyXacNhanPhieuXuatKho(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 xuất kho Bệnh nhân 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("" + ten_kieuthuoc_vt + " nhập từ phiếu này đã được sử dụng hết nên bạn không thể hủy xác nhận phiếu\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.NotEnoughDrugInStock:
                            Utility.ShowMsg("" + ten_kieuthuoc_vt + " nhập từ phiếu này đã gần hết nên bạn không thể hủy xác nhận phiếu\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Error);
                            break;

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
Exemplo n.º 3
0
        private void cmdHuychuyenkho_Click(object sender, EventArgs e)
        {
            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 chuyển kho đang chọn hay không?", "Thông báo", true))
            {
                int    IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                string khoxuat = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khoxuat"].Value, "");
                string khonhap = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khonhap"].Value, "");
                TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(IdPhieu);
                if (objTPhieuNhapxuatthuoc != null)
                {
                    string       errMsg       = "";
                    ActionResult actionResult =
                        new XuatThuocAo().HuyXacNhanPhieuXuatKho(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 chuyển kho 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();
                        THU_VIEN_CHUNG.Log(this.Name, globalVariables.UserName,
                                           string.Format(
                                               "Hủy chuyển kho tuyến huyện với số phiếu là :{0} - Từ kho {1} đến kho {2}",
                                               id_PhieuNhap, khoxuat, khonhap), action.Update);
                        break;

                    case ActionResult.Exceed:
                        Utility.ShowMsg("" + ten_kieuthuoc_vt + " nhập từ phiếu này đã được sử dụng hết nên bạn không thể hủy xác nhận phiếu\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Error);
                        break;

                    case ActionResult.NotEnoughDrugInStock:
                        Utility.ShowMsg("" + ten_kieuthuoc_vt + " nhập từ phiếu này đã gần hết nên bạn không thể hủy xác nhận phiếu\n" + errMsg, "Thông báo lỗi", MessageBoxIcon.Error);
                        break;

                    case ActionResult.Error:
                        break;
                    }
                }
            }
            ModifyCommand();
        }