/// <summary>
 /// hàm thực hiện việc thêm mới thông tin
 /// </summary>
 private void InsertData()
 {
     try
     {
         TDmucKho objDmuckho = CreateKhoThuoc();
         objDmuckho.IsNew = true;
         objDmuckho.Save();
         txtIDKHO.Text = Utility.sDbnull(objDmuckho.IdKho);
         objDmuckho    = TDmucKho.FetchByID(Utility.Int32Dbnull(txtIDKHO.Text, -1));
         if (objDmuckho != null)
         {
             DataRow dataRow = p_dtDataChung.NewRow();
             Utility.FromObjectToDatarow(objDmuckho, ref dataRow);
             p_dtDataChung.Rows.Add(dataRow);
             Utility.GonewRowJanus(grdList, TDmucKho.Columns.IdKho, Utility.sDbnull(txtIDKHO.Text));
         }
         foreach (QheDoituongKho objdoituongkho in CreateDoiTuongKhoThem())
         {
             QuanHeDoiTuongKho.THEM_DOITUONG_KHO(objdoituongkho);
         }
         // Utility.ShowMsg("Bạn thực hiện thêm mới thành công", "Thông báo", MessageBoxIcon.Information);
         if (chkTrangThaiForm.Checked)
         {
             this.Close();
         }
         else
         {
             NhapLienTuc();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        private void ThemPhieuthanhly()
        {
            TPhieuNhapxuatthuoc objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new XuatThuoc().ThemPhieuXuatKho(objPhieuNhap, CreateArrPhieuChiTiet());

            switch (actionResult)
            {
            case ActionResult.Success:
                txtIDPhieuNhapKho.Text = Utility.sDbnull(objPhieuNhap.IdPhieu);
                txtMaPhieu.Text        = Utility.sDbnull(objPhieuNhap.MaPhieu);
                TPhieuNhapxuatthuoc objPhieu = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                DataRow             newDr    = p_mDataPhieuNhapKho.NewRow();
                Utility.FromObjectToDatarow(objPhieu, ref newDr);
                TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhohuy.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                }
                p_mDataPhieuNhapKho.Rows.Add(newDr);
                Utility.GonewRowJanus(grdList, TPhieuNhapxuatthuoc.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                //Utility.ShowMsg("Bạn thêm mới phiếu chuyển kho thành công", "Thông báo");
                m_enAction = action.Insert;

                b_Cancel = true;
                this.Close();
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình thêm phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
Exemple #3
0
        private void LoadThuocTrongKho()
        {
            TDmucKho _kho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKho.SelectedValue, -1));

            if (_kho != null)
            {
                kieu_thuocvattu = _kho.KhoThuocVt;
                if (kieu_thuocvattu != "THUOC" || kieu_thuocvattu != "VT")
                {
                    kieu_thuocvattu = "ALL";
                }
                DataSet ds = SPs.ThuocLaythongtinthuoctontrongkhoTheokho(Utility.Int32Dbnull(cboKho.SelectedValue, -1)).GetDataSet();
                m_dtKhothuoc = ds.Tables[0];
                m_dataFull   = ds.Tables[1];
                Utility.SetDataSourceForDataGridEx(grdList, m_dtKhothuoc, true, true, "1=1", "TEN_THUOC");
                string Orderby = TThuockho.Columns.SttBan;
                Utility.SetDataSourceForDataGridEx(grdDieuchinh, m_dataFull, true, true, "1=2", getOrderOut());

                if (grdList.GetDataRows().Length > 0)
                {
                    grdList.MoveFirst();
                    grdList_CurrentCellChanged(grdList, new EventArgs());
                }
            }
            else
            {
                m_dtKhothuoc.Rows.Clear();
                m_dataFull.Rows.Clear();
                m_dtkho.Rows.Clear();
            }
        }
        private void Getdata()
        {
            TDmucKho objDmucKho = TDmucKho.FetchByID(Utility.sDbnull(txtIDKHO.Text, -1));

            if (objDmucKho != null)
            {
                txt_STT_HTHI.Text          = Utility.sDbnull(objDmucKho.SttHthi, 1);
                txtMa.Text                 = Utility.sDbnull(objDmucKho.MaKho, "");
                txtTEN.Text                = Utility.sDbnull(objDmucKho.TenKho, "");
                radKhoChan.Checked         = objDmucKho.KieuKho == "CHAN";
                radKhoLe.Checked           = objDmucKho.KieuKho == "LE";
                optChanle.Checked          = objDmucKho.KieuKho == "CHANLE";
                chkChongiakhikedon.Checked = Utility.Byte2Bool(objDmucKho.ChophepChongia);
                txtKieubiendong.SetCode(objDmucKho.KieuBiendong);
                if (Utility.sDbnull(objDmucKho.KhoThuocVt) == "VT")
                {
                    optVT.Checked = true;
                }
                else if (Utility.sDbnull(objDmucKho.KhoThuocVt) == "THUOC")
                {
                    optThuoc.Checked = true;
                }
                else
                {
                    optThuocVT.Checked = true;
                }

                optKhothuong.Checked = Utility.ByteDbnull(objDmucKho.LoaiKho, 0) == 0;
                optKhoAo.Checked     = Utility.ByteDbnull(objDmucKho.LoaiKho, 0) == 1;
                txtKhoanoitru.SetId(Utility.sDbnull(objDmucKho.IdKhoaphong, "-1"));
                chkSoLuongTon.Checked = Utility.Int32Dbnull(objDmucKho.KtraTon) == 1;
                chkTuThuoc.Checked    = Utility.Int32Dbnull(objDmucKho.LaTuthuoc) == 1;
                chkHienThi.Checked    = Utility.Int32Dbnull(objDmucKho.TrangThai) == 1;
                int loaiBN = 0;
                if (Utility.sDbnull(objDmucKho.LoaiBnhan, "") == "TATCA")
                {
                    loaiBN = 0;
                }

                else if (Utility.sDbnull(objDmucKho.LoaiBnhan, "") == "NGOAITRU")
                {
                    loaiBN = 1;
                }
                else if (Utility.sDbnull(objDmucKho.LoaiBnhan, "") == "NOITRU")
                {
                    loaiBN = 2;
                }


                radTatCa.Checked    = loaiBN == 0;
                radNgoaiTru.Checked = loaiBN == 1;
                radNoiTru.Checked   = loaiBN == 2;
                txtGhiChu.Text      = Utility.sDbnull(objDmucKho.MotaThem);
                chkKhoBan.Checked   = Utility.Int32Dbnull(objDmucKho.LaQuaythuoc) == 1;
            }
        }
        private void UpdatePhieuXuatKho()
        {
            TPhieuNhapxuatthuoc objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new XuatThuoc().UpdatePhieuXuatKho(objPhieuNhap, CreateArrPhieuChiTiet());

            switch (actionResult)
            {
            case ActionResult.Success:
                TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                DataRow[]           arrDr =
                    p_mDataPhieuNhapKho.Select(string.Format("{0}={1}", TPhieuNhapxuatthuoc.Columns.IdPhieu,
                                                             Utility.Int32Dbnull(txtIDPhieuNhapKho.Text)));
                if (arrDr.GetLength(0) > 0)
                {
                    arrDr[0].Delete();
                }
                DataRow newDr = p_mDataPhieuNhapKho.NewRow();
                Utility.FromObjectToDatarow(objTPhieuNhapxuatthuoc, ref newDr);
                TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoNhap.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["TEN_KHO_NHAP"] = Utility.sDbnull(objKho.TenKho);
                }
                objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoXuat.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["TEN_KHO_XUAT"] = Utility.sDbnull(objKho.TenKho);
                }
                newDr["ID_KHOA_LINH"] = Utility.Int16Dbnull(cboKhoaTra.SelectedValue, 0);
                newDr["TEN_KHOA"]     = cboKhoaTra.Text;
                p_mDataPhieuNhapKho.Rows.Add(newDr);

                Utility.GonewRowJanus(grdList, TPhieuNhapxuatthuoc.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                Utility.ShowMsg("Bạn sửa  phiếu trả thành công", "Thông báo");
                m_enAction = action.Insert;

                b_Cancel = true;
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình sửa phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
Exemple #6
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        private void ThemPhieuXuatKho()
        {
            TPhieutrathuocKholeVekhochan objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new PhieuTraLai().ThemPhieuTraLaiKho
                                            (objPhieuNhap, CreateArrPhieuChiTiet());

            switch (actionResult)
            {
            case ActionResult.Success:
                txtIDPhieuNhapKho.Text = Utility.sDbnull(objPhieuNhap.IdPhieu);
                txtMaPhieu.Text        = Utility.sDbnull(objPhieuNhap.MaPhieu);
                TPhieutrathuocKholeVekhochan objDPhieuNhap = TPhieutrathuocKholeVekhochan.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                DataRow newDr = p_dtPhieuNhapTra.NewRow();
                Utility.FromObjectToDatarow(objDPhieuNhap, ref newDr);
                TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoLinh.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khonhap"] = Utility.sDbnull(objKho.TenKho);
                }
                objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoTra.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                }
                DmucNhanvien objStaff = DmucNhanvien.FetchByID(Utility.Int32Dbnull(cboNhanVien.SelectedValue));
                if (objStaff != null)
                {
                    newDr["ten_nhanvien"] = Utility.sDbnull(objStaff.TenNhanvien);
                }
                p_dtPhieuNhapTra.Rows.Add(newDr);
                grdList.UpdateData();
                //Utility.ShowMsg("Bạn thêm mới phiếu thành công", "Thông báo");
                Utility.GonewRowJanus(grdList, TPhieutrathuocKholeVekhochan.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                em_Action = action.Insert;
                b_Cancel  = true;
                this.Close();
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình thêm phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
        private void UpdatePhieuXuatKho()
        {
            TPhieuNhapxuatthuoc objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new XuatThuoc().UpdatePhieuXuatKho(objPhieuNhap, CreateArrPhieuChiTiet());

            switch (actionResult)
            {
            case ActionResult.Success:
                TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                DataRow[]           arrDr =
                    p_mDataPhieuNhapKho.Select(string.Format("{0}={1}", TPhieuNhapxuatthuoc.Columns.IdPhieu,
                                                             Utility.Int32Dbnull(txtIDPhieuNhapKho.Text)));
                if (arrDr.GetLength(0) > 0)
                {
                    arrDr[0].Delete();
                }
                DataRow newDr = p_mDataPhieuNhapKho.NewRow();
                Utility.FromObjectToDatarow(objTPhieuNhapxuatthuoc, ref newDr);
                DmucChung objNhaCC = THU_VIEN_CHUNG.LaydoituongDmucChung("NHACUNGCAP", txtNhacungcap.myCode);
                if (objNhaCC != null)
                {
                    newDr["ten_nhacungcap"] = Utility.sDbnull(objNhaCC.Ten);
                }
                TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoXuat.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                }
                p_mDataPhieuNhapKho.Rows.Add(newDr);

                Utility.GonewRowJanus(grdList, TPhieuNhapxuatthuoc.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                //Utility.ShowMsg("Bạn sửa  phiếu thành công", "Thông báo");
                m_enAction = action.Insert;
                this.Close();
                b_Cancel = true;
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình sửa phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
Exemple #8
0
        private void UpdatePhieuXuatKho()
        {
            TPhieutrathuocKholeVekhochan objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new PhieuTraLai().UpdatePhieuTraLaiKho(objPhieuNhap, CreateArrPhieuChiTiet());

            switch (actionResult)
            {
            case ActionResult.Success:
                TPhieutrathuocKholeVekhochan objDPhieuNhap = TPhieutrathuocKholeVekhochan.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                DataRow[] arrDr =
                    p_dtPhieuNhapTra.Select(string.Format("{0}={1}", TPhieutrathuocKholeVekhochan.Columns.IdPhieu,
                                                          Utility.Int32Dbnull(txtIDPhieuNhapKho.Text)));
                if (arrDr.GetLength(0) > 0)
                {
                    arrDr[0].Delete();
                }
                DataRow newDr = p_dtPhieuNhapTra.NewRow();
                Utility.FromObjectToDatarow(objDPhieuNhap, ref newDr);
                TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoLinh.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khonhap"] = Utility.sDbnull(objKho.TenKho);
                }
                objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhoTra.SelectedValue, -1));
                if (objKho != null)
                {
                    newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                }
                p_dtPhieuNhapTra.Rows.Add(newDr);
                Utility.GonewRowJanus(grdList, TPhieutrathuocKholeVekhochan.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                Utility.ShowMsg("Bạn sửa  phiếu thành công", "Thông báo");
                em_Action = action.Insert;
                this.Close();
                b_Cancel = true;
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình sửa phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
        /// <summary>
        /// hàm thực hiện việc cập nhập lại thông tin thành công
        /// </summary>
        private void UpdateData()
        {
            try
            {
                TDmucKho objDmuckho = CreateKhoThuoc();
                objDmuckho.Save();
                m_blnCancel = false;
                objDmuckho  = TDmucKho.FetchByID(Utility.Int32Dbnull(txtIDKHO.Text, -1));
                DataRow[] arrDr =
                    p_dtDataChung.Select(string.Format("{0}={1}", TDmucKho.Columns.IdKho, Utility.Int32Dbnull(txtIDKHO.Text)));
                if (arrDr.GetLength(0) > 0)
                {
                    arrDr[0].Delete();
                }
                p_dtDataChung.AcceptChanges();
                if (objDmuckho != null)
                {
                    DataRow dataRow = p_dtDataChung.NewRow();
                    Utility.FromObjectToDatarow(objDmuckho, ref dataRow);
                    p_dtDataChung.Rows.Add(dataRow);
                    Utility.GonewRowJanus(grdList, TDmucKho.Columns.IdKho, Utility.sDbnull(txtIDKHO.Text));
                }
                new Delete().From(QheDoituongKho.Schema)
                .Where(QheDoituongKho.Columns.IdKho).IsEqualTo(Utility.Int32Dbnull(txtIDKHO.Text, -1))
                .Execute();

                foreach (QheDoituongKho objdoituongkho in CreateDoiTuongKhoThem())
                {
                    QuanHeDoiTuongKho.THEM_DOITUONG_KHO(objdoituongkho);
                }
                Utility.ShowMsg("Bạn đã cập nhật dữ liệu thành công", "Thông báo", MessageBoxIcon.Information);
                if (chkTrangThaiForm.Checked)
                {
                    this.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }