private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();

            if (m_enAction == action.Update)
            {
                objTPhieuNhapxuatthuoc.MarkOld();
                objTPhieuNhapxuatthuoc.IsLoaded = true;
                objTPhieuNhapxuatthuoc.IdPhieu  = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
            }
            objTPhieuNhapxuatthuoc.Vat          = 0;
            objTPhieuNhapxuatthuoc.SoHoadon     = string.Empty;
            objTPhieuNhapxuatthuoc.IdKhoxuat    = Utility.Int16Dbnull(cboKhoXuat.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.MaNhacungcap = txtNhacungcap.myCode;
            objTPhieuNhapxuatthuoc.TrangThai    = 0;
            objTPhieuNhapxuatthuoc.MotaThem     = txtLyDoNhap.Text;
            objTPhieuNhapxuatthuoc.IdNhanvien   = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
            if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
            {
                objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
            }
            objTPhieuNhapxuatthuoc.NgayHoadon     = dtNgayNhap.Value;
            objTPhieuNhapxuatthuoc.NgayTao        = globalVariables.SysDate;
            objTPhieuNhapxuatthuoc.NguoiTao       = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.NguoiGiao      = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.LoaiPhieu      = (byte)LoaiPhieu.PhieuTraNcc;
            objTPhieuNhapxuatthuoc.TenLoaiphieu   = Utility.TenLoaiPhieu(LoaiPhieu.PhieuTraNcc);
            objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
            return(objTPhieuNhapxuatthuoc);
        }
        private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();

            if (m_enAction == action.Update)
            {
                objTPhieuNhapxuatthuoc.MarkOld();
                objTPhieuNhapxuatthuoc.IsLoaded = true;
                objTPhieuNhapxuatthuoc.IdPhieu  = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
            }
            objTPhieuNhapxuatthuoc.Vat          = 0;
            objTPhieuNhapxuatthuoc.SoHoadon     = string.Empty;
            objTPhieuNhapxuatthuoc.IdKhonhap    = Utility.Int16Dbnull(cboKhoNhap.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.IdKhoxuat    = Utility.Int16Dbnull(cboKhoXuat.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.MaNhacungcap = "";
            objTPhieuNhapxuatthuoc.MotaThem     = "Trả thuốc từ khoa về kho lẻ";
            objTPhieuNhapxuatthuoc.TrangThai    = 0;
            objTPhieuNhapxuatthuoc.IdKhoalinh   = Utility.Int16Dbnull(cboKhoaTra.SelectedValue, 0);

            objTPhieuNhapxuatthuoc.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
            if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
            {
                objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
            }
            objTPhieuNhapxuatthuoc.NgayHoadon   = dtNgayNhap.Value;
            objTPhieuNhapxuatthuoc.NgayTao      = globalVariables.SysDate;
            objTPhieuNhapxuatthuoc.NguoiTao     = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.NguoiGiao    = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.LoaiPhieu    = (byte)LoaiPhieu.PhieuNhapTraKhoLe;
            objTPhieuNhapxuatthuoc.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraKhoLe);
            return(objTPhieuNhapxuatthuoc);
        }
        private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();

            if (m_enAction == action.Update)
            {
                objTPhieuNhapxuatthuoc.MarkOld();
                objTPhieuNhapxuatthuoc.IsLoaded = true;
                objTPhieuNhapxuatthuoc.IdPhieu  = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
            }
            objTPhieuNhapxuatthuoc.Vat            = 0;
            objTPhieuNhapxuatthuoc.SoHoadon       = string.Empty;
            objTPhieuNhapxuatthuoc.IdKhoxuat      = Utility.Int16Dbnull(cboKhohuy.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.MaNhacungcap   = "";
            objTPhieuNhapxuatthuoc.MotaThem       = Utility.DoTrim(txtMotathem.Text);
            objTPhieuNhapxuatthuoc.TrangThai      = 0;
            objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
            objTPhieuNhapxuatthuoc.IdNhanvien     = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
            if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
            {
                objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
            }
            objTPhieuNhapxuatthuoc.NgayHoadon     = dtNgayNhap.Value;
            objTPhieuNhapxuatthuoc.NgayTao        = globalVariables.SysDate;
            objTPhieuNhapxuatthuoc.NguoiTao       = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.NguoiGiao      = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.HoidongThanhly = txtHoidong.Rtf;
            objTPhieuNhapxuatthuoc.LoaiPhieu      = (byte)LoaiPhieu.PhieuHuy;
            objTPhieuNhapxuatthuoc.TenLoaiphieu   = Utility.TenLoaiPhieu(LoaiPhieu.PhieuHuy);
            objTPhieuNhapxuatthuoc.DuTru          = Utility.Bool2byte(false);
            return(objTPhieuNhapxuatthuoc);
        }
Exemplo n.º 4
0
        private TPhieuNhapxuatthuoc Taophieutrathuocthua()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();

            if (m_enAction == action.Update)
            {
                objTPhieuNhapxuatthuoc.MarkOld();
                objTPhieuNhapxuatthuoc.IsLoaded = true;
                objTPhieuNhapxuatthuoc.IdPhieu  = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
            }
            objTPhieuNhapxuatthuoc.NoiTru         = 1;
            objTPhieuNhapxuatthuoc.Vat            = 0;
            objTPhieuNhapxuatthuoc.SoHoadon       = string.Empty;
            objTPhieuNhapxuatthuoc.IdKhonhap      = Utility.Int16Dbnull(cboKhoNhan.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.MaNhacungcap   = "";
            objTPhieuNhapxuatthuoc.MotaThem       = txtLyDoXuat.Text;
            objTPhieuNhapxuatthuoc.TrangThai      = 0;
            objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
            objTPhieuNhapxuatthuoc.IdKhoalinh     = Utility.Int16Dbnull(cboKhoaTra.SelectedValue, 0);
            objTPhieuNhapxuatthuoc.MotaThem       = "Xuất thuốc tủ trực khoa nội trú trả về kho lẻ";
            objTPhieuNhapxuatthuoc.IdNhanvien     = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
            if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
            {
                objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
            }
            objTPhieuNhapxuatthuoc.TkNo             = Utility.DoTrim(txtNo.Text);
            objTPhieuNhapxuatthuoc.TkCo             = Utility.DoTrim(txtCo.Text);
            objTPhieuNhapxuatthuoc.SoChungtuKemtheo = Utility.DoTrim(txtSoCT.Text);
            objTPhieuNhapxuatthuoc.NgayHoadon       = dtNgayNhap.Value;
            objTPhieuNhapxuatthuoc.NgayTao          = globalVariables.SysDate;
            objTPhieuNhapxuatthuoc.NguoiTao         = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.NguoiGiao        = Utility.DoTrim(txtNguoigiao.Text);
            objTPhieuNhapxuatthuoc.NguoiNhan        = Utility.DoTrim(txtNguoinhan.Text);
            objTPhieuNhapxuatthuoc.LoaiPhieu        = (byte)LoaiPhieu.Phieutrathuocthua;
            objTPhieuNhapxuatthuoc.TenLoaiphieu     = Utility.TenLoaiPhieu(LoaiPhieu.Phieutrathuocthua);
            return(objTPhieuNhapxuatthuoc);
        }
Exemplo n.º 5
0
        /// <summary>
        /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult UpdatePhieuTraLaiKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgaySua =  globalVariables.SysDate;
                        objPhieuNhap.NguoiSua = globalVariables.UserName;
                        objPhieuNhap.MarkOld();
                        objPhieuNhap.IsNew = false;
                        objPhieuNhap.Save();
                        new Delete().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapTraCt in arrPhieuNhapCts)
                        {
                            objPhieuNhapTraCt.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapTraCt.GiaNhap)*
                                                          Utility.Int32Dbnull(objPhieuNhapTraCt.SoLuong);
                            objPhieuNhapTraCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                            objPhieuNhapTraCt.IsNew = true;
                            objPhieuNhapTraCt.Save();
                        }
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception);
                return ActionResult.Error;

            }
        }
 private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
 {
     TPhieuNhapxuatthuoc objPhieu = new TPhieuNhapxuatthuoc();
     if (m_enAction == action.Update)
     {
         objPhieu.MarkOld();
         objPhieu.IsLoaded = true;
         objPhieu.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
     }
     objPhieu.Vat = 0;
     objPhieu.SoHoadon = string.Empty;
     objPhieu.IdKhoxuat = Utility.Int16Dbnull(cboKhohuy.SelectedValue, -1);
     objPhieu.MaNhacungcap = "";
     objPhieu.MotaThem =Utility.DoTrim( txtMotathem.Text);
     objPhieu.TrangThai = 0;
     objPhieu.KieuThuocvattu = KIEU_THUOC_VT;
     objPhieu.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
     if (Utility.Int32Dbnull(objPhieu.IdNhanvien, -1) <= 0)
         objPhieu.IdNhanvien = globalVariables.gv_intIDNhanvien;
     objPhieu.NgayHoadon = dtNgayNhap.Value;
     objPhieu.NgayTao = globalVariables.SysDate;
     objPhieu.NguoiTao = globalVariables.UserName;
     objPhieu.NguoiGiao = globalVariables.UserName;
     objPhieu.DiadiemThanhly = txtDiadiem.Text;
     objPhieu.HoidongThanhly = txtHoidong.Rtf;
     objPhieu.ThoigianThanhlyTu = dtpFrom.Value;
     objPhieu.ThoigianThanhlyDen = dtpTo.Value;
     objPhieu.YkienDexuat = Utility.DoTrim(txtMotathem.Text);
     objPhieu.LoaiPhieu =(byte) LoaiPhieu.PhieuThanhly;
     objPhieu.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuThanhly);
     objPhieu.DuTru = Utility.Bool2byte(false);
     return objPhieu;
 }
 private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
 {
     TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();
     if (m_enAction == action.Update)
     {
         objTPhieuNhapxuatthuoc.MarkOld();
         objTPhieuNhapxuatthuoc.IsLoaded = true;
         objTPhieuNhapxuatthuoc.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
     }
     objTPhieuNhapxuatthuoc.Vat = 0;
     objTPhieuNhapxuatthuoc.SoHoadon = string.Empty;
     objTPhieuNhapxuatthuoc.IdKhonhap = Utility.Int16Dbnull(cboKhoNhan.SelectedValue, -1);
     objTPhieuNhapxuatthuoc.IdKhoxuat = Utility.Int16Dbnull(cboKhoXuat.SelectedValue, -1);
     objTPhieuNhapxuatthuoc.MaNhacungcap = "";
     objTPhieuNhapxuatthuoc.MotaThem = txtLyDoXuat.Text;
     objTPhieuNhapxuatthuoc.TrangThai = 0;
     objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
     objTPhieuNhapxuatthuoc.IdKhoalinh = Utility.Int16Dbnull(cboKhoaTra.SelectedValue, 0);
     objTPhieuNhapxuatthuoc.MotaThem = "Xuất thuốc tủ trực khoa nội trú trả về kho lẻ";
     objTPhieuNhapxuatthuoc.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
     if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
         objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
     objTPhieuNhapxuatthuoc.TkNo = Utility.DoTrim(txtNo.Text);
     objTPhieuNhapxuatthuoc.TkCo = Utility.DoTrim(txtCo.Text);
     objTPhieuNhapxuatthuoc.SoChungtuKemtheo = Utility.DoTrim(txtSoCT.Text);
     objTPhieuNhapxuatthuoc.NgayHoadon = dtNgayNhap.Value;
     objTPhieuNhapxuatthuoc.NgayTao = globalVariables.SysDate;
     objTPhieuNhapxuatthuoc.NguoiTao = globalVariables.UserName;
     objTPhieuNhapxuatthuoc.NguoiGiao =Utility.DoTrim( txtNguoigiao.Text);
     objTPhieuNhapxuatthuoc.NguoiNhan =Utility.DoTrim( txtNguoinhan.Text);
     objTPhieuNhapxuatthuoc.LoaiPhieu = (byte)LoaiPhieu.PhieuNhapTraKhoLe;
     objTPhieuNhapxuatthuoc.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraKhoLe);
     objTPhieuNhapxuatthuoc.DuTru = 0;// Utility.Bool2byte(chkPhieudutru.Checked);
     return objTPhieuNhapxuatthuoc;
 }
        private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();
            if (m_enAction == action.Update)
            {
                objTPhieuNhapxuatthuoc.MarkOld();
                objTPhieuNhapxuatthuoc.IsLoaded = true;
                objTPhieuNhapxuatthuoc.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
            }
            objTPhieuNhapxuatthuoc.Vat = 0;
            objTPhieuNhapxuatthuoc.SoHoadon = string.Empty;
            objTPhieuNhapxuatthuoc.IdKhonhap = Utility.Int16Dbnull(cboKhoNhap.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.IdKhoxuat = Utility.Int16Dbnull(cboKhoXuat.SelectedValue, -1);
            objTPhieuNhapxuatthuoc.MaNhacungcap = "";
            objTPhieuNhapxuatthuoc.MotaThem = "Trả thuốc từ khoa về kho lẻ";
            objTPhieuNhapxuatthuoc.TrangThai = 0;
            objTPhieuNhapxuatthuoc.IdKhoalinh = Utility.Int16Dbnull(cboKhoaTra.SelectedValue, 0);

            objTPhieuNhapxuatthuoc.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
            if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
                objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
            objTPhieuNhapxuatthuoc.NgayHoadon = dtNgayNhap.Value;
            objTPhieuNhapxuatthuoc.NgayTao = globalVariables.SysDate;
            objTPhieuNhapxuatthuoc.NguoiTao = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.NguoiGiao = globalVariables.UserName;
            objTPhieuNhapxuatthuoc.LoaiPhieu =(byte) LoaiPhieu.PhieuNhapTraKhoLe;
            objTPhieuNhapxuatthuoc.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraKhoLe);
            return objTPhieuNhapxuatthuoc;
        }
        private TPhieuNhapxuatthuoc TaophieuNhapkho()
        {
            TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc=new TPhieuNhapxuatthuoc();
            if(em_Action==action.Update)
            {
                objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text,-1));

            }
            if (objTPhieuNhapxuatthuoc != null)
            {
                if (objTPhieuNhapxuatthuoc.IdPhieu > 0)
                {
                    objTPhieuNhapxuatthuoc.MarkOld();
                    objTPhieuNhapxuatthuoc.IsNew = false;
                }
                objTPhieuNhapxuatthuoc.SoHoadon = Utility.sDbnull(txtSoHoaDon.Text);
                objTPhieuNhapxuatthuoc.IdKhonhap = Utility.Int16Dbnull(txtKhonhap.MyID, -1);
                objTPhieuNhapxuatthuoc.MaNhacungcap = txtNhacungcap.myCode;
                objTPhieuNhapxuatthuoc.MotaThem = Utility.DoTrim(txtLyDoNhap.Text);
                objTPhieuNhapxuatthuoc.TrangThai = 0;
                objTPhieuNhapxuatthuoc.PhieuVay = Utility.Bool2byte(chkPhieuvay.Checked);
                objTPhieuNhapxuatthuoc.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
                if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
                    objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
                objTPhieuNhapxuatthuoc.NgayHoadon = dtNgayNhap.Value;
                objTPhieuNhapxuatthuoc.NgayTao = globalVariables.SysDate;
                objTPhieuNhapxuatthuoc.NguoiTao = globalVariables.UserName;
                objTPhieuNhapxuatthuoc.NguoiGiao = Utility.DoTrim(txtNguoiGiao.Text);
                objTPhieuNhapxuatthuoc.NguoiNhan = Utility.DoTrim(txtNguoinhan.Text);
                objTPhieuNhapxuatthuoc.TkNo = Utility.DoTrim(txtNo.Text);
                objTPhieuNhapxuatthuoc.TkCo = Utility.DoTrim(txtCo.Text);
                objTPhieuNhapxuatthuoc.SoChungtuKemtheo = Utility.DoTrim(txtSoCTkemtheo.Text);
                objTPhieuNhapxuatthuoc.Vat = Utility.DecimaltoDbnull(txtVAT.Text);
                objTPhieuNhapxuatthuoc.LoaiPhieu = (byte)LoaiPhieu.PhieuNhapKho;
                objTPhieuNhapxuatthuoc.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapKho);
                objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
            }
            return objTPhieuNhapxuatthuoc;
        }
        public void Update(long IdPhieu,string MaPhieu,string SoHoadon,DateTime NgayHoadon,short? IdKhonhap,short? IdKhoxuat,decimal? Vat,string MaNhacungcap,string MotaThem,string NguoiGiao,string NguoiNhan,string NguoiHuy,short? IdNhanvien,byte? SttHthi,byte? TrangThai,DateTime? NgayTao,string NguoiTao,string NguoiSua,DateTime? NgaySua,decimal? TongTien,byte? LoaiPhieu,string TenLoaiphieu,short? IdNhanvienXacnhan,string NguoiXacnhan,DateTime? NgayXacnhan,short? IdKhoalinh,string KieuThuocvattu,string SoChungtuKemtheo,byte? PhieuVay,string TkNo,string TkCo,byte? DuTru,byte? NoiTru,string HoidongThanhly,string DiadiemThanhly,string YkienDexuat,DateTime? ThoigianThanhlyTu,DateTime? ThoigianThanhlyDen)
        {
            TPhieuNhapxuatthuoc item = new TPhieuNhapxuatthuoc();
            item.MarkOld();
            item.IsLoaded = true;

            item.IdPhieu = IdPhieu;

            item.MaPhieu = MaPhieu;

            item.SoHoadon = SoHoadon;

            item.NgayHoadon = NgayHoadon;

            item.IdKhonhap = IdKhonhap;

            item.IdKhoxuat = IdKhoxuat;

            item.Vat = Vat;

            item.MaNhacungcap = MaNhacungcap;

            item.MotaThem = MotaThem;

            item.NguoiGiao = NguoiGiao;

            item.NguoiNhan = NguoiNhan;

            item.NguoiHuy = NguoiHuy;

            item.IdNhanvien = IdNhanvien;

            item.SttHthi = SttHthi;

            item.TrangThai = TrangThai;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NguoiSua = NguoiSua;

            item.NgaySua = NgaySua;

            item.TongTien = TongTien;

            item.LoaiPhieu = LoaiPhieu;

            item.TenLoaiphieu = TenLoaiphieu;

            item.IdNhanvienXacnhan = IdNhanvienXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayXacnhan = NgayXacnhan;

            item.IdKhoalinh = IdKhoalinh;

            item.KieuThuocvattu = KieuThuocvattu;

            item.SoChungtuKemtheo = SoChungtuKemtheo;

            item.PhieuVay = PhieuVay;

            item.TkNo = TkNo;

            item.TkCo = TkCo;

            item.DuTru = DuTru;

            item.NoiTru = NoiTru;

            item.HoidongThanhly = HoidongThanhly;

            item.DiadiemThanhly = DiadiemThanhly;

            item.YkienDexuat = YkienDexuat;

            item.ThoigianThanhlyTu = ThoigianThanhlyTu;

            item.ThoigianThanhlyDen = ThoigianThanhlyDen;

            item.Save(UserName);
        }
 private TPhieuNhapxuatthuoc CreatePhieuNhapKho()
 {
     TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = new TPhieuNhapxuatthuoc();
     if (m_enAction == action.Update)
     {
         objTPhieuNhapxuatthuoc.MarkOld();
         objTPhieuNhapxuatthuoc.IsLoaded = true;
         objTPhieuNhapxuatthuoc.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1);
     }
     objTPhieuNhapxuatthuoc.Vat = 0;
     objTPhieuNhapxuatthuoc.SoHoadon = string.Empty;
     objTPhieuNhapxuatthuoc.IdKhoxuat = Utility.Int16Dbnull(cboKhoXuat.SelectedValue, -1);
     objTPhieuNhapxuatthuoc.MaNhacungcap = txtNhacungcap.myCode;
     objTPhieuNhapxuatthuoc.TrangThai = 0;
     objTPhieuNhapxuatthuoc.MotaThem = txtLyDoNhap.Text;
     objTPhieuNhapxuatthuoc.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1);
     if (Utility.Int32Dbnull(objTPhieuNhapxuatthuoc.IdNhanvien, -1) <= 0)
         objTPhieuNhapxuatthuoc.IdNhanvien = globalVariables.gv_intIDNhanvien;
     objTPhieuNhapxuatthuoc.NgayHoadon = dtNgayNhap.Value;
     objTPhieuNhapxuatthuoc.NgayTao = globalVariables.SysDate;
     objTPhieuNhapxuatthuoc.NguoiTao = globalVariables.UserName;
     objTPhieuNhapxuatthuoc.NguoiGiao = globalVariables.UserName;
     objTPhieuNhapxuatthuoc.LoaiPhieu =(byte) LoaiPhieu.PhieuTraNCC;
     objTPhieuNhapxuatthuoc.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuTraNCC);
     objTPhieuNhapxuatthuoc.KieuThuocvattu = KIEU_THUOC_VT;
     return objTPhieuNhapxuatthuoc;
 }
        public void Update(long IdPhieu, string MaPhieu, string SoHoadon, DateTime NgayHoadon, short?IdKhonhap, short?IdKhoxuat, decimal?Vat, string MaNhacungcap, string MotaThem, string NguoiGiao, string NguoiNhan, string NguoiHuy, short?IdNhanvien, byte?SttHthi, byte?TrangThai, DateTime?NgayTao, string NguoiTao, string NguoiSua, DateTime?NgaySua, decimal?TongTien, byte?LoaiPhieu, string TenLoaiphieu, short?IdNhanvienXacnhan, string NguoiXacnhan, DateTime?NgayXacnhan, short?IdKhoalinh, string KieuThuocvattu, string SoChungtuKemtheo, byte?PhieuVay, string TkNo, string TkCo, byte?DuTru, byte?NoiTru, string HoidongThanhly, string DiadiemThanhly, string YkienDexuat, DateTime?ThoigianThanhlyTu, DateTime?ThoigianThanhlyDen)
        {
            TPhieuNhapxuatthuoc item = new TPhieuNhapxuatthuoc();

            item.MarkOld();
            item.IsLoaded = true;

            item.IdPhieu = IdPhieu;

            item.MaPhieu = MaPhieu;

            item.SoHoadon = SoHoadon;

            item.NgayHoadon = NgayHoadon;

            item.IdKhonhap = IdKhonhap;

            item.IdKhoxuat = IdKhoxuat;

            item.Vat = Vat;

            item.MaNhacungcap = MaNhacungcap;

            item.MotaThem = MotaThem;

            item.NguoiGiao = NguoiGiao;

            item.NguoiNhan = NguoiNhan;

            item.NguoiHuy = NguoiHuy;

            item.IdNhanvien = IdNhanvien;

            item.SttHthi = SttHthi;

            item.TrangThai = TrangThai;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NguoiSua = NguoiSua;

            item.NgaySua = NgaySua;

            item.TongTien = TongTien;

            item.LoaiPhieu = LoaiPhieu;

            item.TenLoaiphieu = TenLoaiphieu;

            item.IdNhanvienXacnhan = IdNhanvienXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayXacnhan = NgayXacnhan;

            item.IdKhoalinh = IdKhoalinh;

            item.KieuThuocvattu = KieuThuocvattu;

            item.SoChungtuKemtheo = SoChungtuKemtheo;

            item.PhieuVay = PhieuVay;

            item.TkNo = TkNo;

            item.TkCo = TkCo;

            item.DuTru = DuTru;

            item.NoiTru = NoiTru;

            item.HoidongThanhly = HoidongThanhly;

            item.DiadiemThanhly = DiadiemThanhly;

            item.YkienDexuat = YkienDexuat;

            item.ThoigianThanhlyTu = ThoigianThanhlyTu;

            item.ThoigianThanhlyDen = ThoigianThanhlyDen;

            item.Save(UserName);
        }