/// <summary> /// hàm thực hiện việc xử lý thông tin chuyển khoa /// </summary> private void ProcessChuyenKhoa() { DataRow query = (from khoa in PDanhSachPhanBuongGiuong.AsEnumerable() where Utility.Int32Dbnull(khoa[NoitruPhanbuonggiuong.Columns.Id]) == Utility.Int32Dbnull(Utility.Int32Dbnull(txtPatientDept_ID.Text)) select khoa).FirstOrDefault(); if (query != null) { NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(Utility.Int32Dbnull(grdBuong.GetValue(NoitruDmucBuong.Columns.IdBuong))); if (objRoom != null) { query[NoitruDmucBuong.Columns.IdBuong] = Utility.Int32Dbnull(objRoom.IdBuong, -1); query[NoitruDmucBuong.Columns.TenBuong] = Utility.sDbnull(objRoom.TenBuong); } NoitruDmucGiuongbenh objBed = NoitruDmucGiuongbenh.FetchByID( Utility.Int32Dbnull(grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong))); if (objBed != null) { query[NoitruDmucGiuongbenh.Columns.IdGiuong] = Utility.Int32Dbnull(objBed.IdGiuong, -1); query[NoitruDmucGiuongbenh.Columns.TenGiuong] = Utility.sDbnull(objBed.TenGiuong); } query[NoitruPhanbuonggiuong.Columns.Id] = Utility.sDbnull(txtPatientDept_ID.Text); query.AcceptChanges(); } }
private NoitruDmucGiuongbenh createBed() { NoitruDmucGiuongbenh objBed = new NoitruDmucGiuongbenh(); objBed.IsNew = true; if (m_enAct == action.Update) { objBed = NoitruDmucGiuongbenh.FetchByID(Utility.Int16Dbnull(txtID.Text)); objBed.MarkOld(); objBed.IsNew = false; } objBed.IdKhoanoitru = Utility.Int16Dbnull(cboKhoaNoiTru.SelectedValue); objBed.IdBuong = Utility.Int16Dbnull(txtBuong.MyID); objBed.MotaThem = Utility.sDbnull(txt_Mo_Ta.Text); objBed.SonguoiToida = Utility.Int16Dbnull(txtSuChua.Value); objBed.SttHthi = Utility.Int16Dbnull(txt_STT_HTHI.Value); objBed.MaGiuong = Utility.sDbnull(txtMa.Text); objBed.MaBhyt = Utility.sDbnull(txtMaBHYT.Text); objBed.TenGiuong = Utility.sDbnull(txtTEN.Text); objBed.TenBhyt = Utility.sDbnull(txtTen_BHYT.Text); objBed.MaDonvitinh = txtDonvitinh.myCode; objBed.TthaiTunguyen = Utility.Bool2byte(chktutuc.Checked); objBed.GiaDichvu = Utility.DecimaltoDbnull(txtDongia.Text, 0); objBed.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0); objBed.GiaKhac = Utility.DecimaltoDbnull(txtGiakhac.Text, 0); objBed.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0); objBed.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0); objBed.TrangThai = (byte?)(chkTrangThai.Checked ? 1 : 0); return(objBed); }
private void BindData() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text); if (sqlQuery.GetRecordCount() > 0) { objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>(); if (objLuotkham != null) { txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); txtSoBHYT.Text = Utility.sDbnull(objLuotkham.MatheBhyt); DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru); if (objDmucKhoaphong != null) { txtDepartmentName.Tag = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong); txtDepartment_ID.Text = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong); txtDepartmentName.Text = Utility.sDbnull(objDmucKhoaphong.TenKhoaphong); } KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); if (objPatientInfo != null) { txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan); txtPatient_ID.Text = Utility.sDbnull(objLuotkham.IdBenhnhan); txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh); txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh); txtPatientSex.Text = objPatientInfo.GioiTinh;// Utility.Int32Dbnull(objPatientInfo.PatientSex) == 0 ? "Nam" : "Nữ"; } objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(objLuotkham.IdRavien); dtNgayvao.Value = objPhanbuonggiuong.NgayVaokhoa; if (objPhanbuonggiuong != null) { txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id); NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong); if (objRoom != null) { txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong); txtSoPhong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdBuong); } NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objNoitruDmucGiuongbenh != null) { txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong); txtSoGiuong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdGiuong); } } } } ModifyCommand(); }
private void cmdSuaGiuong_Click(object sender, EventArgs e) { int idphong = Utility.Int32Dbnull(grdBed.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong)); NoitruDmucGiuongbenh objBed = NoitruDmucGiuongbenh.FetchByID(idphong); if (objBed != null) { var frm = new frm_Add_GiuongNoiTru(); frm.objBed = objBed; frm.m_enAct = action.Update; frm.p_dtDataGiuong = m_dtDataGiuong; frm.grdList = grdBed; frm.MyGetData = new frm_Add_GiuongNoiTru.timkiem(LoadData); frm.ShowDialog(); } ModifyCommand(); }
void grdBed_UpdatingCell(object sender, UpdatingCellEventArgs e) { try { if (!Utility.isValidGrid(grdBed)) { return; } if (e.InitialValue.ToString() != e.Value.ToString()) { NoitruDmucGiuongbenh _obj = NoitruDmucGiuongbenh.FetchByID(Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.IdGiuong))); _obj.MaGiuong = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.MaGiuong.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.MaGiuong), ""); _obj.TenGiuong = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.TenGiuong.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.TenGiuong), ""); _obj.GiaDichvu = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.GiaDichvu.ToUpper() ? (decimal)e.Value : Utility.DecimaltoDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.GiaDichvu), 0); _obj.GiaBhyt = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.GiaBhyt.ToUpper() ? (decimal)e.Value : Utility.DecimaltoDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.GiaBhyt), 0); _obj.GiaKhac = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.GiaKhac.ToUpper() ? (decimal)e.Value : Utility.DecimaltoDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.GiaKhac), 0); _obj.PhuthuDungtuyen = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.PhuthuDungtuyen.ToUpper() ? (decimal)e.Value : Utility.DecimaltoDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.PhuthuDungtuyen), 0); _obj.PhuthuTraituyen = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.PhuthuTraituyen.ToUpper() ? (decimal)e.Value : Utility.DecimaltoDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.PhuthuTraituyen), 0); _obj.SonguoiToida = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.SonguoiToida.ToUpper() ? (byte)e.Value : Utility.Int16Dbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.SonguoiToida), 1); _obj.MotaThem = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.MotaThem.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.MotaThem), ""); _obj.TrangThai = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.TrangThai.ToUpper() ? (byte)e.Value : Utility.ByteDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.TrangThai), 1); _obj.TthaiTunguyen = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.TthaiTunguyen.ToUpper() ? (byte)e.Value : Utility.ByteDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.TthaiTunguyen), 0); _obj.DangSudung = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.DangSudung.ToUpper() ? (byte)e.Value : Utility.ByteDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.DangSudung), 1); _obj.SttHthi = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.SttHthi.ToUpper() ? (Int16)e.Value : Utility.Int16Dbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.SttHthi), 1); _obj.TenBhyt = e.Column.DataMember.ToUpper() == NoitruDmucGiuongbenh.Columns.TenBhyt.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdBed, NoitruDmucGiuongbenh.Columns.TenBhyt), ""); _obj.IsNew = false; _obj.MarkOld(); SqlQuery sqlQuery = new Select().From(NoitruDmucGiuongbenh.Schema) .Where(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(_obj.IdBuong) .And(NoitruDmucGiuongbenh.Columns.MaGiuong).IsEqualTo(_obj.MaGiuong) .And(NoitruDmucGiuongbenh.Columns.IdGiuong).IsNotEqualTo(_obj.IdGiuong); if (sqlQuery.GetRecordCount() > 0) { Utility.ShowMsg("Mã giường đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning); return; } _obj.Save(); } } catch (Exception ex) { } }
public static void LayThongTinGia(NoitruPhanbuonggiuong objPhanbuonggiuong, KcbLuotkham objPatientExam) { objPhanbuonggiuong.TuTuc = 0; SqlQuery sqlQuery = new Select().From <NoitruQheDoituongBuonggiuong>() .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(objPhanbuonggiuong.IdGiuong) .And(NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb).IsEqualTo(objPatientExam.MaDoituongKcb); NoitruQheDoituongBuonggiuong objRoomBedObjectType = sqlQuery.ExecuteSingle <NoitruQheDoituongBuonggiuong>(); if (objRoomBedObjectType != null) { objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objRoomBedObjectType.DonGia); objPhanbuonggiuong.PhuThu = Utility.Byte2Bool(objPatientExam.DungTuyen) ? Utility.DecimaltoDbnull(objRoomBedObjectType.PhuthuDungtuyen) : Utility.DecimaltoDbnull(objRoomBedObjectType.PhuthuTraituyen); NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); { objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.DonGia); objPhanbuonggiuong.KieuThue = "GIUONG"; } } else { NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objLBed != null) { objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objLBed.DonGia); objPhanbuonggiuong.PhuThu = Utility.DecimaltoDbnull(0); objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.KieuThue = "GIUONG"; objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.DonGia); if (!THU_VIEN_CHUNG.IsBaoHiem(objPatientExam.IdLoaidoituongKcb)) { objPhanbuonggiuong.TuTuc = 0; } } } objPhanbuonggiuong.TrongGoi = 0; // Utility.ByteDbnull(objPhanbuonggiuong.TrongGoi); if (objPhanbuonggiuong.IdGiuong > 0 || objPhanbuonggiuong.IdBuong > 0) //Có giường thì mới tính { TinhToanPtramBHYT.TinhPhanTramBHYT(objPhanbuonggiuong, objPatientExam, Utility.DecimaltoDbnull(objPatientExam.PtramBhytGoc)); } }
private void BindData() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text); if (sqlQuery.GetRecordCount() > 0) { objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>(); if (objLuotkham != null) { txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); txtSoBHYT.Text = Utility.sDbnull(objLuotkham.MatheBhyt); DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru); if (objLDepartment != null) { txtDepartment_ID.Text = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Tag = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong); } KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); if (objPatientInfo != null) { txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan); txtPatient_ID.Text = Utility.sDbnull(objLuotkham.IdBenhnhan); txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh); txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh); txtPatientSex.Text = objPatientInfo.GioiTinh; // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ"; } NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(IDBuonggiuong); // noitru_nhapvien.LaythongtinBuonggiuongHtai(objLuotkham); if (objPhanbuonggiuong != null) { dtNgayvao.Value = objPhanbuonggiuong.NgayVaokhoa; txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id); NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong); if (objRoom != null) { txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong); txtSoPhong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdBuong); } NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objNoitruDmucGiuongbenh != null) { txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong); txtSoGiuong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdGiuong); } } DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0]; dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia; txtGia.Init(dtGia, new List <string>() { NoitruGiabuonggiuong.Columns.IdGia, NoitruGiabuonggiuong.Columns.MaGia, NoitruGiabuonggiuong.Columns.TenGia }); cboGia.DataSource = dtGia; cboGia.DataMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.ValueMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia; m_dtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text)); Utility.SetDataSourceForDataGridEx_Basic(grdBuong, m_dtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong"); txtRoom_code.Init(m_dtDataRoom, new List <string>() { NoitruDmucBuong.Columns.IdBuong, NoitruDmucBuong.Columns.MaBuong, NoitruDmucBuong.Columns.TenBuong }); if (grdBuong.DataSource != null) { grdBuong.MoveFirst(); } } else { string tempt = txtMaLanKham.Text; ClearControl(); if (m_dtDataRoom != null) { m_dtDataRoom.Clear(); } if (m_dtDatabed != null) { m_dtDataRoom.Clear(); } txtMaLanKham.Text = tempt; txtMaLanKham.SelectAll(); txtMaLanKham.Focus(); } } }