Esempio n. 1
0
        TPhieutrathuocthua getPhieu()
        {
            _item = new TPhieutrathuocthua();
            if (m_enAction == action.Update)
            {
                _item = TPhieutrathuocthua.FetchByID(idPhieutra);
            }
            _item.MaPhieu       = "";
            _item.NgayLapphieu  = dtpInputDate.Value;
            _item.NguoiLapphieu = Utility.Int16Dbnull(txtNhanvien.MyID, -1);
            _item.IdKhoatra     = Utility.Int16Dbnull(txtKhoanoitru.MyID, -1);
            _item.IdKhonhan     = Utility.Int16Dbnull(txtKhothuoc.MyID, -1);

            if (m_enAction == action.Insert)
            {
                _item.KieuThuocVt = kieu_thuoc_vt;
                _item.TrangThai   = 0;
                _item.NguoiTao    = globalVariables.UserName;
                _item.NgayTao     = globalVariables.SysDate;
            }
            else
            {
                _item.NguoiSua = globalVariables.UserName;
                _item.NgaySua  = globalVariables.SysDate;
            }
            return(_item);
        }
Esempio n. 2
0
        void cmdPrint_Click(object sender, EventArgs e)
        {
            TPhieutrathuocthua objPhieutrathuocthua = TPhieutrathuocthua.FetchByID(idPhieutra);

            if (objPhieutrathuocthua != null)
            {
                thuoc_baocao.InPhieutrathuocthua(objPhieutrathuocthua, "PHIẾU TRẢ THUỐC THỪA", globalVariables.SysDate);
            }
        }
        void cmdInphieu_Click(object sender, EventArgs e)
        {
            int _Id = Utility.Int32Dbnull(grdList.GetValue(TPhieutrathuocthua.Columns.Id), -1);

            TPhieutrathuocthua objPhieutrathuocthua = TPhieutrathuocthua.FetchByID(_Id);

            if (objPhieutrathuocthua != null)
            {
                thuoc_baocao.InPhieutrathuocthua(objPhieutrathuocthua, "PHIẾU TRẢ THUỐC THỪA", globalVariables.SysDate);
            }
        }
Esempio n. 4
0
 void ResetDataByStatus()
 {
     if (m_enAction == action.Update)
     {
         _item = TPhieutrathuocthua.FetchByID(idPhieutra);
     }
     cmdAccept.Tag              = m_enAction == action.Update ? "0" : "1";
     lnkTonghoplai.Visible      = m_enAction == action.Update;
     cmdAccept.ContextMenuStrip = m_enAction == action.Update ? contextMenuStrip2 : null;
     SetStatus();
     ModifyCommands();
 }
        private void cmdHuychuyenkho_Click(object sender, EventArgs e)
        {
            try
            {
                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(TPhieutrathuocthua.Columns.Id), -1);
                    TPhieutrathuocthua objTPhieutrathuocthua = TPhieutrathuocthua.FetchByID(IdPhieu);
                    if (objTPhieutrathuocthua != null)
                    {
                        ActionResult actionResult =
                            new Trathuocthua().HuyXacnhanphieuphieutrathuocthua(objTPhieutrathuocthua, 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 thừa từ khoa nội trú về kho thành công", "Thông báo");
                            grdList.CurrentRow.BeginEdit();
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.TrangThai].Value = 0;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NgayTra].Value   = DBNull.Value;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NguoiTra].Value  = DBNull.Value;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NguoiNhan].Value = DBNull.Value;
                            grdList.CurrentRow.Cells["sngay_tra"].Value     = "";
                            grdList.CurrentRow.Cells["ten_nguoitra"].Value  = "";
                            grdList.CurrentRow.Cells["ten_nguoinhan"].Value = "";
                            grdList.CurrentRow.EndEdit();
                            break;

                        case ActionResult.Exceed:
                            Utility.ShowMsg("Thuốc trong kho nhận đã được sử dụng hết nên bạn không thể hủy phiếu trả thuốc thừa");
                            break;

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

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
            finally
            {
                ModifyCommand();
            }
        }
        /// <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
            {
                Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
                if (Utility.AcceptQuestion("Bạn đã chắc chắn muốn xác nhận trả thuốc thừa từ phiếu đang chọn hay không?\nSau khi xác nhận, dữ liệu thuốc sẽ được cộng vào kho nhận", "Thông báo", true))
                {
                    string             errMsg  = "";
                    int                IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieutrathuocthua.Columns.Id), -1);
                    TPhieutrathuocthua objTPhieutrathuocthua = TPhieutrathuocthua.FetchByID(IdPhieu);
                    if (objTPhieutrathuocthua != null)
                    {
                        DateTime            _ngayxacnhan     = globalVariables.SysDate;
                        string              _nguoitra        = "";
                        frm_ChonngayXacnhan _ChonngayXacnhan = new frm_ChonngayXacnhan();
                        _ChonngayXacnhan.pdt_InputDate = objTPhieutrathuocthua.NgayLapphieu;
                        _ChonngayXacnhan.ShowDialog();
                        if (_ChonngayXacnhan.b_Cancel)
                        {
                            return;
                        }
                        else
                        {
                            _ngayxacnhan = _ChonngayXacnhan.pdt_InputDate;
                            _nguoitra    = _ChonngayXacnhan.txtNhanvien.Text;
                        }
                        objTPhieutrathuocthua.NgayTra  = _ngayxacnhan;
                        objTPhieutrathuocthua.NguoiTra = Utility.Int16Dbnull(_ChonngayXacnhan.txtNhanvien.MyID, -1);
                        ActionResult actionResult =
                            new Trathuocthua().Xacnhanphieutrathuocthua(objTPhieutrathuocthua);
                        switch (actionResult)
                        {
                        case ActionResult.Success:
                            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Trả thuốc thừa từ khoa nội trú về kho thành công", false);
                            grdList.CurrentRow.BeginEdit();
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.TrangThai].Value = 1;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NgayTra].Value   = _ngayxacnhan;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NguoiTra].Value  = objTPhieutrathuocthua.NguoiTra;
                            grdList.CurrentRow.Cells[TPhieutrathuocthua.Columns.NguoiNhan].Value = globalVariables.gv_intIDNhanvien;
                            grdList.CurrentRow.Cells["sngay_tra"].Value     = _ngayxacnhan.ToString("dd/MM/yyyy");
                            grdList.CurrentRow.Cells["ten_nguoitra"].Value  = _nguoitra;
                            grdList.CurrentRow.Cells["ten_nguoinhan"].Value = Utility.getTenNhanvien();
                            grdList.CurrentRow.EndEdit();
                            grdList.UpdateData();
                            break;

                        case ActionResult.Exceed:
                            Utility.ShowMsg("Một số chi tiết thuốc không tồn tại nên hệ thống không thể xác nhận. Đề nghị bạn kiểm tra lại");
                            break;

                        case ActionResult.DataChanged:
                            Utility.ShowMsg("Dữ liệu cấp phát đã bị thay đổi nên bạn không thể xác nhận. Đề nghị nhấn nút tìm kiếm để lấy lại dữ liệu mới nhất");
                            break;

                        case ActionResult.Error:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
            finally
            {
                ModifyCommand();
            }
        }