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;
            }
        }
Example #2
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());
            }
        }
Example #3
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;
            }
        }
Example #4
0
        /// <summary>
        ///     hàm thực hiện việc in phiếu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdInPhieu_Click(object sender, EventArgs e)
        {
            int                 idcapphat = Utility.Int32Dbnull(txtID_CAPPHAT.Text);
            DataTable           dataTable = SPs.InphieuDenghiCapphatthuocNoitru(idcapphat).GetDataSet().Tables[0];
            TPhieuCapphatNoitru objTPhieuCapphatNoitru = TPhieuCapphatNoitru.FetchByID(idcapphat);

            if (objTPhieuCapphatNoitru != null)
            {
                DUOC_Noitru.InPhieuTongHopLinhThuocVT(objTPhieuCapphatNoitru, dataTable);
            }
        }
        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();
            }
        }
Example #6
0
        TPhieuCapphatNoitru TaoPhieuCapphatNoitru()
        {
            try
            {
                TPhieuCapphatNoitru objPhieucapphatnoitru = new TPhieuCapphatNoitru();
                if (m_Action == action.Update)
                {
                    TPhieuCapphatNoitruCollection lst = new Select().From(TPhieuCapphatNoitru.Schema)
                                                        .Where(TPhieuCapphatNoitru.IdCapphatColumn).IsEqualTo(_IDCAPPHAT).ExecuteAsCollection <TPhieuCapphatNoitruCollection>();
                    if (lst.Count > 0)
                    {
                        objPhieucapphatnoitru = lst[0];
                    }
                }
                if (m_Action == action.Update)
                {
                    objPhieucapphatnoitru.IdCapphat = _IDCAPPHAT;
                    if (UpdateNgaykedon)
                    {
                        objPhieucapphatnoitru.TuNgay  = dtTuNgay.Value.Date;
                        objPhieucapphatnoitru.DenNgay = dtDenNgay.Value.Date;
                    }
                    objPhieucapphatnoitru.NgaySua  = globalVariables.SysDate;
                    objPhieucapphatnoitru.NguoiSua = globalVariables.UserName;
                }
                else
                {
                    objPhieucapphatnoitru.TuNgay     = dtTuNgay.Value.Date;
                    objPhieucapphatnoitru.DenNgay    = dtDenNgay.Value.Date;
                    objPhieucapphatnoitru.NgayTao    = globalVariables.SysDate;
                    objPhieucapphatnoitru.NguoiTao   = globalVariables.UserName;
                    objPhieucapphatnoitru.IdKhoaLinh = Utility.Int32Dbnull(cboDepartment.SelectedValue, -1);
                    objPhieucapphatnoitru.IdNhanvien = Utility.Int32Dbnull(cboStaff.SelectedValue, -1);
                    objPhieucapphatnoitru.TrangThai  = 0;
                }
                objPhieucapphatnoitru.LoaiPhieu   = Utility.Bool2byte(optLinhBoSung.Checked);
                objPhieucapphatnoitru.IdKhoXuat   = StockID;
                objPhieucapphatnoitru.KieuThuocVt = KIEUTHUOC_VT;
                objPhieucapphatnoitru.NgayNhap    = dtpInputDate.Value.Date;
                objPhieucapphatnoitru.MotaThem    = optLinhBoSung.Checked ? "Phiếu tổng hợp lĩnh thuốc(VT) bổ sung" : "Phiếu tổng hợp lĩnh thuốc(VT) thường";

                return(objPhieucapphatnoitru);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #7
0
 /// <summary>
 /// in đơn thuôc đề nghị câp phát thuốc nội trú
 /// </summary>
 void PrintPhieuDenghiCapPhat()
 {
     try
     {
         int                 idcapphat             = _IDCAPPHAT;
         DataTable           dtDmucthuoc           = SPs.ThuocNoitruLaydulieuinphieulinhthuocnoitru(idcapphat).GetDataSet().Tables[0];
         TPhieuCapphatNoitru objPhieuCapphatNoitru = TPhieuCapphatNoitru.FetchByID(idcapphat);
         if (objPhieuCapphatNoitru != null)
         {
             thuoc_baocao.Inphieutonghoplinhthuocnoitru(objPhieuCapphatNoitru, dtDmucthuoc);
         }
     }
     catch (Exception)
     {
         Utility.ShowMsg("Có lỗi trong quá trình lấy dữ liệu");
         return;
     }
 }
Example #8
0
        private TPhieuCapphatNoitru CreatePhieuCapPhat()
        {
            try
            {
                var objPhieuCapPhat = new TPhieuCapphatNoitru();

                if (me_Action == action.Update)
                {
                    objPhieuCapPhat.MarkOld();
                    objPhieuCapPhat.IsLoaded  = false;
                    objPhieuCapPhat.IsNew     = false;
                    objPhieuCapPhat.IdCapphat = Utility.Int32Dbnull(txtID_CAPPHAT.Text);
                    objPhieuCapPhat.NgaySua   = globalVariables.SysDate;
                    objPhieuCapPhat.NguoiSua  = globalVariables.UserName;
                }
                else
                {
                    objPhieuCapPhat.NgayTao   = globalVariables.SysDate;
                    objPhieuCapPhat.NguoiTao  = globalVariables.UserName;
                    objPhieuCapPhat.DaCapPhat = false;
                }
                txtMOTA_THEM.Text          = Utility.sDbnull(txtMOTA_THEM.Text);
                objPhieuCapPhat.MaDoiTuong = Utility.sDbnull(txtMaDoiTuong.Text);
                objPhieuCapPhat.IdKhoaLinh = Utility.Int16Dbnull(txtID_KHOA_LINH.Text, -1);
                objPhieuCapPhat.IdNvien    = Utility.Int16Dbnull(txtID_NVIEN.Text, -1);
                objPhieuCapPhat.IdKhoXuat  = Utility.Int16Dbnull(txtId_KhoXuat.Text);
                objPhieuCapPhat.LinhBSung  = radLinhBoSung.Checked ? true : false;
                objPhieuCapPhat.NgayNhap   = dtNgayCapPhat.Value.Date;
                objPhieuCapPhat.LoaiPhieu  = Utility.sDbnull(radThuoc.Checked ? radThuoc.Tag : radLinhVTYT.Tag);
                objPhieuCapPhat.MotaThem   = Utility.sDbnull(txtMOTA_THEM.Text);
                object maxvalue =
                    grdDonThuoc.GetDataRows().AsEnumerable().Max(c => c.Cells[KcbDonthuoc.Columns.PresDate].Value);
                objPhieuCapPhat.DenNgay = Convert.ToDateTime(maxvalue);
                object minvalue =
                    grdDonThuoc.GetDataRows().AsEnumerable().Min(c => c.Cells[KcbDonthuoc.Columns.PresDate].Value);
                objPhieuCapPhat.TuNgay = Convert.ToDateTime(minvalue);
                return(objPhieuCapPhat);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #9
0
        public ActionResult CappnhatPhieucapphatNoitru(TPhieuCapphatNoitru _phieucapphat, List<TPhieuCapphatChitiet> lstPhieuCapphatCt, List<TThuocCapphatChitiet> lstThuocCapphatCt)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {

                        new Update(TPhieuCapphatNoitru.Schema).Set(TPhieuCapphatNoitru.NgayNhapColumn).EqualTo(_phieucapphat.NgayNhap.Date)
                            .Set(TPhieuCapphatNoitru.TuNgayColumn).EqualTo(_phieucapphat.TuNgay.Date)
                            .Set(TPhieuCapphatNoitru.DenNgayColumn).EqualTo(_phieucapphat.DenNgay.Date)
                            .Set(TPhieuCapphatNoitru.IdKhoXuatColumn).EqualTo(_phieucapphat.IdKhoXuat)
                             .Set(TPhieuCapphatNoitru.NgaySuaColumn).EqualTo(_phieucapphat.NgaySua.Value.Date)
                            .Set(TPhieuCapphatNoitru.NguoiSuaColumn).EqualTo(_phieucapphat.NguoiSua)
                            .Where(TPhieuCapphatNoitru.IdCapphatColumn).IsEqualTo(_phieucapphat.IdCapphat).Execute();
                        new Delete().From(TPhieuCapphatChitiet.Schema).Where(TPhieuCapphatChitiet.Columns.IdCapphat).IsEqualTo(
                            _phieucapphat.IdCapphat).Execute();
                        foreach (var _PhieuCapphatCt in lstPhieuCapphatCt)
                        {
                            _PhieuCapphatCt.IdCapphat = _phieucapphat.IdCapphat;
                            _PhieuCapphatCt.IsNew = true;
                            _PhieuCapphatCt.Save();
                        }
                        new Delete().From(TThuocCapphatChitiet.Schema).Where(TThuocCapphatChitiet.Columns.IdCapphat).IsEqualTo(
                           _phieucapphat.IdCapphat).Execute();
                        foreach (var _ThuocCapphatCt in lstThuocCapphatCt)
                        {
                            _ThuocCapphatCt.IdCapphat = _phieucapphat.IdCapphat;
                            _ThuocCapphatCt.IsNew = true;
                            _ThuocCapphatCt.Save();
                        }
                        Scope.Complete();
                    }
                    return ActionResult.Success;
                }
            }
            catch (Exception)
            {
                return ActionResult.Error;
            }
        }
        private bool CheckIDCapPhat()
        {
            TPhieuCapphatNoitru phieucapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtIDCapPhat.Text));

            if (phieucapphat == null)
            {
                return(false);
            }
            else
            {
                if (Utility.Int32Dbnull(phieucapphat.TrangThai) == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
 void cmdInsotamtra_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdList))
         {
             Utility.ShowMsg("Bạn cần chọn phiếu lĩnh thuốc nội trú trên lưới trước khi thực hiện lệnh in");
             grdList.MoveFirst();
             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;
         }
         DataTable dtData = SPs.ThuocNoitruInsotamtra(Utility.Int32Dbnull(grdList.CurrentRow.Cells[TPhieuCapphatNoitru.Columns.IdCapphat].Value, -1)).GetDataSet().Tables[0];
         if (dtData == null || dtData.Rows.Count <= 0)
         {
             Utility.ShowMsg("Không tìm thấy dữ liệu để in.");
             return;
         }
         Utility.AddColumToDataTable(ref dtData, "STT", typeof(Int32));
         int idx = 1;
         foreach (DataRow dr in dtData.Rows)
         {
             dr["STT"] = idx;
             idx++;
         }
         string ten_khoa      = Utility.sDbnull(Utility.getValueOfGridCell(grdList, "ten_khoaphong"), "Unknown");
         string loai_phieu    = Utility.sDbnull(Utility.getValueOfGridCell(grdList, "loai_phieu"), "0") == "0"?"Phiếu lĩnh thường":"Phiếu lĩnh bổ sung";
         string ngay_linh     = Utility.sDbnull(Utility.getValueOfGridCell(grdList, "sngay_xacnhan"), "Unknown");
         string sfileName     = AppDomain.CurrentDomain.BaseDirectory + "sotamtra\\sotamtra.xls";
         string sfileNameSave = AppDomain.CurrentDomain.BaseDirectory + "sotamtra\\" + string.Format("{0}_{1}", Utility.Bodau(ten_khoa), Utility.GetYYMMDDHHMMSS(globalVariables.SysDate)) + ".xls";
         new ExcelUtlity().WriteDataTableToExcel_SoTamTra(dtData, "sotamtra", sfileNameSave, loai_phieu, ten_khoa, ngay_linh);
     }
     catch (Exception ex)
     {
     }
 }
Example #12
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());
            }
        }
 private void cmdPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdList))
         {
             Utility.ShowMsg("Bạn cần chọn phiếu để in");
             return;
         }
         int                 idcapphat             = Utility.Int32Dbnull(grdList.GetValue(TPhieuCapphatNoitru.Columns.IdCapphat));
         DataTable           dataTable             = SPs.ThuocNoitruLaydulieuinphieulinhthuocnoitru(idcapphat).GetDataSet().Tables[0];
         TPhieuCapphatNoitru objPhieuCapphatNoitru = TPhieuCapphatNoitru.FetchByID(idcapphat);
         if (objPhieuCapphatNoitru != null)
         {
             thuoc_baocao.Inphieutonghoplinhthuocnoitru(objPhieuCapphatNoitru, dataTable);
         }
     }
     catch (Exception)
     {
         Utility.ShowMsg("Có lỗi trong quá trình lấy dữ liệu");
         return;
     }
 }
 private void cmdUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdList))
         {
             Utility.ShowMsg("Bạn cần chọn phiếu để sử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ể sửa phiếu");
             return;
         }
         frm_AddCapPhatThuocNoiTru frm = new frm_AddCapPhatThuocNoiTru(KIEU_THUOC_VT, loaiphieu);
         frm.m_Action     = action.Update;
         frm.dtList       = dtList;
         frm.StaffId      = Utility.Int32Dbnull(grdList.CurrentRow.Cells[TPhieuCapphatNoitru.Columns.IdNhanvien].Value, -1);
         frm.DepartmentId = Utility.Int32Dbnull(grdList.CurrentRow.Cells[TPhieuCapphatNoitru.Columns.IdKhoaLinh].Value, -1);
         frm._IDCAPPHAT   = _ID_CAPPHAT;
         frm.ShowDialog();
         grdList_SelectionChanged(grdList, new EventArgs());
     }
     catch (Exception ex)
     {
     }
     finally
     {
         modifyActButtons();
     }
 }
        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();
            }
        }
Example #16
0
        private void AdTPhieuCapphatNoitru()
        {
            try
            {
                if (p_phieuCapPhatThuoc != null)
                {
                    EnumerableRowCollection <DataRow> query = from phieu in p_phieuCapPhatThuoc.AsEnumerable()
                                                              where
                                                              Utility.Int32Dbnull(phieu[TPhieuCapphatNoitru.Columns.IdCapphat]) ==
                                                              Utility.Int32Dbnull(txtID_CAPPHAT.Text)
                                                              select phieu;
                    if (!query.Any())
                    {
                        DataRow             drv             = p_phieuCapPhatThuoc.NewRow();
                        TPhieuCapphatNoitru objPhieuCapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtID_CAPPHAT.Text));
                        Utility.FromObjectToDatarow(objPhieuCapphat, ref drv);
                        if (p_phieuCapPhatThuoc.Columns.Contains("ten_KHOA_LINH"))
                        {
                            drv["ten_KHOA_LINH"] = Utility.sDbnull(txtTen_KHOA_LINH.Text);
                        }
                        if (p_phieuCapPhatThuoc.Columns.Contains("ten_kho_xuat"))
                        {
                            drv["ten_kho_xuat"] = Utility.sDbnull(txtTenKho.Text);
                        }
                        if (p_phieuCapPhatThuoc.Columns.Contains("ten_nvien"))
                        {
                            drv["ten_nvien"] = Utility.sDbnull(globalVariables.gv_sStaffName);
                        }
                        p_phieuCapPhatThuoc.Rows.Add(drv);
                    }
                    else
                    {
                        DataRow drv = query.FirstOrDefault();
                        if (drv != null)
                        {
                            drv["ID_CAPPHAT"] = Utility.Int32Dbnull(txtID_CAPPHAT.Text);

                            drv["ID_KHO_XUAT"] = Utility.Int32Dbnull(txtId_KhoXuat.Text);
                            if (p_phieuCapPhatThuoc.Columns.Contains("ten_kho_xuat"))
                            {
                                drv["ten_kho_xuat"] = Utility.sDbnull(txtTenKho.Text);
                            }
                            drv["ID_KHOA_LINH"] = Utility.Int32Dbnull(txtID_KHOA_LINH.Text);
                            if (p_phieuCapPhatThuoc.Columns.Contains("ten_KHOA_LINH"))
                            {
                                drv["ten_KHOA_LINH"] = Utility.sDbnull(txtTen_KHOA_LINH.Text);
                            }
                            drv["ID_NVIEN"] = Utility.Int32Dbnull(txtID_NVIEN.Text);
                            if (p_phieuCapPhatThuoc.Columns.Contains("ten_nvien"))
                            {
                                drv["ten_nvien"] = Utility.sDbnull(txtTen_NVIEN.Text);
                            }
                            drv["NGAY_NHAP"]  = dtNgayCapPhat.Text;
                            drv["MOTA_THEM"]  = Utility.sDbnull(txtMOTA_THEM.Text);
                            drv["Loai_Phieu"] = radThuoc.Checked ? "THUOC" : "VT";
                            drv["Da_CapPhat"] = chkDa_CapPhat.Checked;
                        }
                        drv.AcceptChanges();
                        p_phieuCapPhatThuoc.AcceptChanges();
                    }
                }
            }
            catch (Exception exception)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(exception.ToString());
                }
            }
        }
        TPhieuCapphatNoitru TaoPhieuCapphatNoitru()
        {
            try
            {
                TPhieuCapphatNoitru objPhieucapphatnoitru = new TPhieuCapphatNoitru();
                if (m_Action == action.Update)
                {
                    TPhieuCapphatNoitruCollection lst = new Select().From(TPhieuCapphatNoitru.Schema)
                        .Where(TPhieuCapphatNoitru.IdCapphatColumn).IsEqualTo(_IDCAPPHAT).ExecuteAsCollection<TPhieuCapphatNoitruCollection>();
                    if (lst.Count > 0) objPhieucapphatnoitru = lst[0];
                }
                if (m_Action == action.Update)
                {
                    objPhieucapphatnoitru.IdCapphat = _IDCAPPHAT;
                    if (UpdateNgaykedon)
                    {
                        objPhieucapphatnoitru.TuNgay = dtTuNgay.Value.Date;
                        objPhieucapphatnoitru.DenNgay = dtDenNgay.Value.Date;
                    }
                    objPhieucapphatnoitru.NgaySua = globalVariables.SysDate;
                    objPhieucapphatnoitru.NguoiSua = globalVariables.UserName;
                }
                else
                {
                    objPhieucapphatnoitru.TuNgay = dtTuNgay.Value.Date;
                    objPhieucapphatnoitru.DenNgay = dtDenNgay.Value.Date;
                    objPhieucapphatnoitru.NgayTao = globalVariables.SysDate;
                    objPhieucapphatnoitru.NguoiTao = globalVariables.UserName;
                    objPhieucapphatnoitru.IdKhoaLinh = Utility.Int32Dbnull(cboDepartment.SelectedValue, -1);
                    objPhieucapphatnoitru.IdNhanvien = Utility.Int32Dbnull(cboStaff.SelectedValue, -1);
                    objPhieucapphatnoitru.TrangThai = 0;
                }
                objPhieucapphatnoitru.LoaiPhieu = Utility.Bool2byte(optLinhBoSung.Checked);
                objPhieucapphatnoitru.IdKhoXuat = StockID;
                objPhieucapphatnoitru.KieuThuocVt = KIEUTHUOC_VT;
                objPhieucapphatnoitru.NgayNhap = dtpInputDate.Value.Date;
                objPhieucapphatnoitru.MotaThem = optLinhBoSung.Checked ? "Phiếu tổng hợp lĩnh thuốc(VT) bổ sung" : "Phiếu tổng hợp lĩnh thuốc(VT) thường";

                return objPhieucapphatnoitru;
            }
            catch (Exception)
            {
                return null;
            }
        }
Example #18
0
        private void getData()
        {
            TPhieuCapphatNoitru objPhieuCapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtID_CAPPHAT.Text));

            if (objPhieuCapphat != null)
            {
                txtID_CAPPHAT.Text = Utility.sDbnull(objPhieuCapphat.IdCapphat);
                if (!string.IsNullOrEmpty(Utility.sDbnull(objPhieuCapphat.NgayNhap)))
                {
                    dtNgayCapPhat.Value = Convert.ToDateTime(objPhieuCapphat.NgayNhap);
                }
                else
                {
                    dtNgayCapPhat.Value = DateTime.Now;
                }
                txtID_KHOA_LINH.Text = Utility.sDbnull(objPhieuCapphat.IdKhoaLinh);
                idKhoaLinh           = Utility.Int32Dbnull(objPhieuCapphat.IdKhoaLinh);
                DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objPhieuCapphat.IdKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                //chkIsBoSung.Checked = Convert.ToBoolean(objPhieuCapphat.LinhBSung);

                IsPhieuBoSung         = Convert.ToBoolean(objPhieuCapphat.loaiPhieu);
                radLinhBoSung.Checked = IsPhieuBoSung;
                loaiphieu             = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                txtID_NVIEN.Text      = Utility.sDbnull(objPhieuCapphat.idn);
                DmucNhanvien objStaff = DmucNhanvien.FetchByID(objPhieuCapphat.IdNvien);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }
                txtId_KhoXuat.Text = Utility.sDbnull(objPhieuCapphat.IdKhoXuat);
                id_khoXuat         = Utility.Int32Dbnull(objPhieuCapphat.IdKhoXuat);
                DKho objKho = DKho.FetchByID(objPhieuCapphat.IdKhoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                madoituong         = Utility.sDbnull(objPhieuCapphat.MaDoiTuong);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                if (globalVariables.gv_TongHopDonThuocMaDoiTuong)
                {
                    SqlQuery sqlQuery =
                        new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                    var objectType = sqlQuery.ExecuteSingle <LObjectType>();
                    if (objectType != null)
                    {
                        txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                    }
                }
                else
                {
                    txtObjectType_Name.Text = "Tất cả";
                }
                txtMOTA_THEM.Text = Utility.sDbnull(objPhieuCapphat.MotaThem);
                me_Action         = action.Update;
            }
            else
            {
                dtNgayCapPhat.Value  = globalVariables.SysDate;
                txtID_KHOA_LINH.Text = Utility.sDbnull(idKhoaLinh);
                LDepartment objLDepartment = LDepartment.FetchByID(idKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                txtID_NVIEN.Text = Utility.sDbnull(globalVariables.gv_StaffID);
                LStaff objStaff = LStaff.FetchByID(globalVariables.gv_StaffID);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }

                txtId_KhoXuat.Text = Utility.sDbnull(id_khoXuat);
                DKho objKho = DKho.FetchByID(id_khoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                //loaiphieu = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                radLinhBoSung.Checked = IsPhieuBoSung;
                // IsPhieuBoSung = Convert.ToBoolean(objPhieuCapphat.LinhBSung);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                if (globalVariables.gv_TongHopDonThuocMaDoiTuong)
                {
                    SqlQuery sqlQuery =
                        new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                    var objectType = sqlQuery.ExecuteSingle <LObjectType>();
                    if (objectType != null)
                    {
                        txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                    }
                }
                else
                {
                    txtObjectType_Name.Text = "Tất cả";
                }
            }
            LoadDonThuoc();
        }
        private void getData()
        {
            TPhieuCapphatNoitru objPhieuCapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtID_CAPPHAT.Text));

            if (objPhieuCapphat != null)
            {
                txtID_CAPPHAT.Text   = Utility.sDbnull(objPhieuCapphat.IdCapphat);
                dtNgayCapPhat.Value  = dtNgayCapPhat.Value;
                txtID_KHOA_LINH.Text = Utility.sDbnull(objPhieuCapphat.IdKhoaLinh);
                idKhoaLinh           = Utility.Int32Dbnull(objPhieuCapphat.IdKhoaLinh);
                DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objPhieuCapphat.IdKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                }
                //chkIsBoSung.Checked = Convert.ToBoolean(objPhieuCapphat.LinhBSung);

                IsPhieuBoSung         = Utility.Byte2Bool(objPhieuCapphat.LoaiPhieu);
                radLinhBoSung.Checked = IsPhieuBoSung;
                loaiphieu             = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                txtID_NVIEN.Text      = Utility.sDbnull(objPhieuCapphat.IdNhanviencapphat);
                DmucNhanvien objStaff = DmucNhanvien.FetchByID(objPhieuCapphat.IdNhanviencapphat);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.TenNhanvien);
                }
                txtId_KhoXuat.Text = Utility.sDbnull(objPhieuCapphat.IdKhoXuat);
                id_khoXuat         = Utility.Int32Dbnull(objPhieuCapphat.IdKhoXuat);
                DKho objKho = DKho.FetchByID(objPhieuCapphat.IdKhoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                madoituong         = Utility.sDbnull(objPhieuCapphat.MaDoiTuong);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                SqlQuery    sqlQuery   = new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                LObjectType objectType = sqlQuery.ExecuteSingle <LObjectType>();
                if (objectType != null)
                {
                    txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                }
                txtMOTA_THEM.Text = Utility.sDbnull(objPhieuCapphat.MotaThem);
            }
            else
            {
                dtNgayCapPhat.Value  = BusinessHelper.GetSysDateTime();
                txtID_KHOA_LINH.Text = Utility.sDbnull(idKhoaLinh);
                LDepartment objLDepartment = LDepartment.FetchByID(idKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                txtID_NVIEN.Text = Utility.sDbnull(globalVariables.gv_StaffID);
                LStaff objStaff = LStaff.FetchByID(globalVariables.gv_StaffID);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }

                txtId_KhoXuat.Text = Utility.sDbnull(id_khoXuat);
                DKho objKho = DKho.FetchByID(id_khoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                //loaiphieu = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                radLinhBoSung.Checked = IsPhieuBoSung;
                // IsPhieuBoSung = Convert.ToBoolean(objPhieuCapphat.LinhBSung);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                SqlQuery    sqlQuery   = new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                LObjectType objectType = sqlQuery.ExecuteSingle <LObjectType>();
                if (objectType != null)
                {
                    txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                }
            }
            LoadPhieuDonThuoc();
        }
Example #20
0
        /// <summary>
        /// hàm thưc hiện việc in phiếu vật tư và thuốc
        /// </summary>
        /// <param name="objDPhieuCapphat"></param>
        /// <param name="dataTable"></param>
        public static void Inphieutonghoplinhthuocnoitru(TPhieuCapphatNoitru objDPhieuCapphat, DataTable dataTable)
        {
            if (objDPhieuCapphat != null)
            {
                // string loaiphieulinh = objDPhieuCapphat.LinhBSung == false ? "Lĩnh thường" : "Lĩnh bổ sung";

                if (objDPhieuCapphat.KieuThuocVt == "VT")
                    PhieuTongHopLinhThuoc(dataTable,
                        objDPhieuCapphat.NgayNhap,"thuoc_noitru_phieutonghopvattunoitru");
                else
                {

                    var query = from thuoc in dataTable.AsEnumerable()
                                where Utility.Int32Dbnull(thuoc[DmucThuoc.Columns.TinhChat]) >= 1
                                select thuoc;

                    if (query.Any())
                    {
                        DataTable m_dtThuocGayNghien = query.CopyToDataTable();
                        if (m_dtThuocGayNghien != null)
                        {
                            PhieuTongHopLinhThuoc(m_dtThuocGayNghien, objDPhieuCapphat.NgayNhap, "thuoc_noitru_phieutonghopthuocgaynghiennoitru");
                        }
                        query = from thuoc in dataTable.AsEnumerable()
                                where Utility.Int32Dbnull(thuoc[DmucThuoc.Columns.TinhChat]) == 0
                                select thuoc;
                        if (query.Any())
                        {
                            DataTable m_dtThuocThuong = query.CopyToDataTable();
                            if (m_dtThuocThuong != null)
                                PhieuTongHopLinhThuoc(m_dtThuocThuong, objDPhieuCapphat.NgayNhap,"thuoc_noitru_phieutonghopthuocnoitru");
                        }

                    }
                    else
                    {
                        query = from thuoc in dataTable.AsEnumerable()
                                where Utility.Int32Dbnull(thuoc[DmucThuoc.Columns.TinhChat], 0) == 0
                                select thuoc;
                        if (query.Any())
                        {
                            dataTable = query.CopyToDataTable();
                            if (dataTable != null)
                            {
                                DataTable m_dtPhieuLinhThuoc = PhieuLinhThuoc(dataTable, "THUOC");
                                if (m_dtPhieuLinhThuoc != null)
                                {
                                    PhieuTongHopLinhThuoc(dataTable, objDPhieuCapphat.NgayNhap,"thuoc_noitru_phieutonghopthuocnoitru");
                                }
                                m_dtPhieuLinhThuoc = PhieuLinhThuoc(dataTable, "VT");
                                if (m_dtPhieuLinhThuoc != null)
                                {

                                    PhieuTongHopLinhThuoc(dataTable, objDPhieuCapphat.NgayNhap, "thuoc_noitru_phieutonghopvattunoitru");
                                }
                            }

                        }

                    }

                }
            }
        }
        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();
            }
        }
        public void Insert(DateTime TuNgay,DateTime DenNgay,int IdKhoaLinh,int IdKhoXuat,int IdNhanvien,int? IdNhanviencapphat,DateTime NgayNhap,byte? LoaiPhieu,string KieuThuocVt,string SoPhieu,DateTime? NgayXacnhan,string NguoiXacnhan,DateTime NgayTao,string NguoiTao,DateTime? NgaySua,string NguoiSua,short TrangThai,string MotaThem,int? IdChot,DateTime? NgayChot,int? NguoiChot,byte? TrangthaiChot,int? NguoiHuychot,DateTime? NgayHuychot,string LydoHuychot)
        {
            TPhieuCapphatNoitru item = new TPhieuCapphatNoitru();

            item.TuNgay = TuNgay;

            item.DenNgay = DenNgay;

            item.IdKhoaLinh = IdKhoaLinh;

            item.IdKhoXuat = IdKhoXuat;

            item.IdNhanvien = IdNhanvien;

            item.IdNhanviencapphat = IdNhanviencapphat;

            item.NgayNhap = NgayNhap;

            item.LoaiPhieu = LoaiPhieu;

            item.KieuThuocVt = KieuThuocVt;

            item.SoPhieu = SoPhieu;

            item.NgayXacnhan = NgayXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NgaySua = NgaySua;

            item.NguoiSua = NguoiSua;

            item.TrangThai = TrangThai;

            item.MotaThem = MotaThem;

            item.IdChot = IdChot;

            item.NgayChot = NgayChot;

            item.NguoiChot = NguoiChot;

            item.TrangthaiChot = TrangthaiChot;

            item.NguoiHuychot = NguoiHuychot;

            item.NgayHuychot = NgayHuychot;

            item.LydoHuychot = LydoHuychot;

            item.Save(UserName);
        }
        public ActionResult ThemPhieuCapPhatNoiTru(TPhieuCapphatNoitru _phieucapphat,List< TPhieuCapphatChitiet> lstPhieuCapphatCt, List<TThuocCapphatChitiet> lstThuocCapphatCt)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        _phieucapphat.IsNew = true;
                        _phieucapphat.Save();
                        if (_phieucapphat.IdCapphat > 0)
                        {
                            foreach (var _PhieuCapphatCt in lstPhieuCapphatCt)
                            {
                                _PhieuCapphatCt.IdCapphat = _phieucapphat.IdCapphat;
                                _PhieuCapphatCt.IsNew = true;
                                _PhieuCapphatCt.Save();
                            }
                            foreach (var _ThuocCapphatCt in lstThuocCapphatCt)
                            {
                                _ThuocCapphatCt.IdCapphat = _phieucapphat.IdCapphat;
                                _ThuocCapphatCt.IsNew = true;
                                _ThuocCapphatCt.Save();
                            }
                        }

                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception)
            {
                return ActionResult.Error;
            }
        }
        public void Update(int IdCapphat,DateTime TuNgay,DateTime DenNgay,int IdKhoaLinh,int IdKhoXuat,int IdNhanvien,int? IdNhanviencapphat,DateTime NgayNhap,byte? LoaiPhieu,string KieuThuocVt,string SoPhieu,DateTime? NgayXacnhan,string NguoiXacnhan,DateTime NgayTao,string NguoiTao,DateTime? NgaySua,string NguoiSua,short TrangThai,string MotaThem)
        {
            TPhieuCapphatNoitru item = new TPhieuCapphatNoitru();
            item.MarkOld();
            item.IsLoaded = true;

            item.IdCapphat = IdCapphat;

            item.TuNgay = TuNgay;

            item.DenNgay = DenNgay;

            item.IdKhoaLinh = IdKhoaLinh;

            item.IdKhoXuat = IdKhoXuat;

            item.IdNhanvien = IdNhanvien;

            item.IdNhanviencapphat = IdNhanviencapphat;

            item.NgayNhap = NgayNhap;

            item.LoaiPhieu = LoaiPhieu;

            item.KieuThuocVt = KieuThuocVt;

            item.SoPhieu = SoPhieu;

            item.NgayXacnhan = NgayXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NgaySua = NgaySua;

            item.NguoiSua = NguoiSua;

            item.TrangThai = TrangThai;

            item.MotaThem = MotaThem;

            item.Save(UserName);
        }