private void LoadThongTin() { try { clsDM_CSKCB obj = new clsDM_CSKCB(); obj.GetByKey(txtMaCoSoKCB.Text); lblTenCSKCB.Text = obj.TenCSKCB; cboTuyen.SelectedValue = obj.Tuyen.ToString(); } catch { } }
//public bool CheckConnection(string path) //{ // try // { // SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=" + path + ";Version=3;"); // m_dbConnection.Open(); // m_dbConnection.Close(); // return true; // } // catch // { // return false; // } //} public string GetThongTinCSKCB() { try { clsDM_CSKCB m_CSKCB = new clsDM_CSKCB(); m_CSKCB.GetByKey(MaCSKCB); if (m_CSKCB.MaCSKCB != null) { string LoaiTuyen = ""; switch (m_CSKCB.Tuyen) { case (byte)EnumTuyen.Xa: LoaiTuyen = "Tuyến Xã"; TuyenKham = "xa"; break; case (byte)EnumTuyen.Huyen: LoaiTuyen = "Tuyến Huyện"; TuyenKham = "huyen"; break; case (byte)EnumTuyen.Tinh: LoaiTuyen = "Tuyến Tỉnh"; TuyenKham = "tinh"; break; case (byte)EnumTuyen.TW: LoaiTuyen = "Tuyến TƯ"; TuyenKham = "tw"; break; default: LoaiTuyen = ""; TuyenKham = "t"; break; } return "Mã CSKCB: " + m_CSKCB.MaCSKCB + " - " + m_CSKCB.TenCSKCB + " - " + LoaiTuyen; } else { TuyenKham = string.Empty; return ""; } } catch { TuyenKham = string.Empty; return "Không tìm thấy CSDL."; } }
private void btnPrint_Click(object sender, EventArgs e) { if (m_SoLuuTru.Trim() == "") { MessageBox.Show("Bạn vui lòng chọn giấy chuyển tuyến để in!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); //lblThongBao.Text = "Bạn vui lòng chọn bảng kê để in!"; //timerThongBao.Enabled = true; return; } try { clsBaoCao bc = new clsBaoCao(); clsDM_CSKCB objCSKCB = new clsDM_CSKCB(); SystemConfig sys = SystemConfig.Instance; objCSKCB.GetByKey(sys.MaCSKCB); DataTable dt = new DataTable("BaoCao"); dt = bc.GetBySoLuuTru(m_SoLuuTru,Code); string path = string.Format("{0}/Reports/{1}.rpt", Directory.GetCurrentDirectory(), "GiayRaVien"); ReportDocument rpDocument = new ReportDocument(); rpDocument.Load(path); rpDocument.SetDataSource(dt); ParameterDiscreteValue val = new ParameterDiscreteValue(); val.Value = objCSKCB.TenCSKCB; ParameterDiscreteValue TenSYT = new ParameterDiscreteValue(); TenSYT.Value = conf.TenSYT; ParameterValues paramVals = new ParameterValues(); ParameterValues paramSYT = new ParameterValues(); paramVals.Add(val); paramSYT.Add(TenSYT); rpDocument.ParameterFields["TenBenhVien"].CurrentValues = paramVals; rpDocument.ParameterFields["TenSYT"].CurrentValues = paramSYT; rpDocument.DataDefinition.ParameterFields["TenBenhVien"].ApplyCurrentValues(paramVals); rpDocument.DataDefinition.ParameterFields["TenSYT"].ApplyCurrentValues(paramSYT); int nCopy = (int)nupPage.Value; string PrinterName = cboMayIn.Text; rpDocument.PrintOptions.PrinterName = PrinterName; rpDocument.PrintToPrinter(nCopy, false, 0, 0); } catch { lblThongBao.Text = "Vui lòng kiểm tra lại máy in."; timerThongBao.Enabled = true; } }
private void txtMaCSKCBBD_Validating(object sender, CancelEventArgs e) { try { clsDM_CSKCB obj = new clsDM_CSKCB(); obj.GetByKey(txtMaCSKCBBD.Text); txtTenCSKCBBD.Text = obj.TenCSKCB; CheckDungTuyen(); } catch { } }
private void frmReport_Load(object sender, EventArgs e) { try { clsBaoCao bc = new clsBaoCao(); clsDM_CSKCB objCSKCB = new clsDM_CSKCB(); SystemConfig sys = SystemConfig.Instance; objCSKCB.GetByKey(sys.MaCSKCB); ParameterFields paramFields = new ParameterFields(); //add ten benh vien ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramField.Name = "TenBenhVien"; paramDiscreteValue.Value = objCSKCB.TenCSKCB; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); // ParameterField paramField1 = new ParameterField(); ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue(); paramField1.Name = "TenSYT"; paramDiscreteValue1.Value = sys.TenSYT; paramField1.CurrentValues.Add(paramDiscreteValue1); paramFields.Add(paramField1); DataTable dt = new DataTable("BaoCao"); if (reportname.Trim().ToLower() == "BCVP".ToLower()) { dt = bc.GetBangKeNhom1(m_BangKe_Id); dt.Columns.Add("BarCode", typeof(byte[])); //BarcodeLib.Barcode b = new BarcodeLib.Barcode(); //if (dt.Rows.Count > 0) //{ // if (!string.IsNullOrEmpty(dt.Rows[0]["MaNguoiBenh"].ToString())) // { // Image bar = b.Encode(BarcodeLib.TYPE.CODE128, dt.Rows[0]["MaNguoiBenh"].ToString(), Color.Black, Color.White, 300, 150); // byte[] imageData = converterByte(bar); // dt.Rows[0]["BarCode"] = imageData; // } //} string path = string.Format("{0}/Reports/BCVP_{1}.rpt", Directory.GetCurrentDirectory(), m_LoaiBangKe); rpDocument.Load(path); rpDocument.SetDataSource(dt); repordView.ParameterFieldInfo = paramFields; repordView.ReportSource = rpDocument; } else { dt = bc.GetBySoLuuTru(m_SoLuuTru, m_LoaiGiay); string path = string.Format("{0}/Reports/{1}.rpt", Directory.GetCurrentDirectory(), reportname); rpDocument.Load(path); rpDocument.SetDataSource(dt); repordView.ParameterFieldInfo = paramFields; repordView.ReportSource = rpDocument; } } catch(Exception ex) { } }
private void txtMaCSKCBBD_TextChanged(object sender, EventArgs e) { try { clsDM_CSKCB obj = new clsDM_CSKCB(); obj.GetByKey(txtMaCSKCBBD.Text); txtTenCSKCBBD.Text = obj.TenCSKCB;//txtMaCSKCBBD.SelectedValues["TenCSKCB"].ToString(); } catch { } }
private void LoadData(int status) { if (IsRunCheck == true) { return; } //Nếu trang thái là 3 và có số đăng ký ở trang thái thêm mới thì GetSoDangKy từ DangKyKhamBenh if (status == 3 && txtSoDK.Text.Trim().Length > 0 && TrangThai == "ThemMoi") { clsDangKyKhamBenh obj = new clsDangKyKhamBenh(); obj.GetByKey(txtSoDK.Text.Trim()); if (obj.KhamBenh_Id <= 0) { txtSoDK.Text = string.Empty; ResetControl(); return; } IsRunCheck = true; txtSoTheBHYT.Text = obj.SoTheBHYT.ToString(); txtHoTen.Text = obj.HoTen; txtDiaChi.Text = obj.DiaChi; txtTuNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.TuNgay); txtDenNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.DenNgay); txtNgaySinh.Text = string.Format("{0:dd/MM/yyyy}", obj.NgaySinh); txtNgayVao.Text = string.Format("{0:dd/MM/yyyy}", obj.NgayDenKham); txtNamSinh.Text = obj.NgaySinh.Value.Year.ToString(); clsDM_CSKCB objCSKCB = new clsDM_CSKCB(); objCSKCB.GetByKey(obj.MaCSKCBBĐ); txtMaCSKCBBD.Text = obj.MaCSKCBBĐ; txtTenCSKCBBD.Text = objCSKCB.TenCSKCB; txtNoiChuyenDen.Text = obj.MaNoiChuyenDen; cboTuyenKham.SelectedValue = obj.LyDoVV.ToString(); cboGioiTinh.SelectedValue = obj.GioiTinh.ToString(); cboMaNoiSinhSong.SelectedValue = obj.MaNoiSinhSong.ToString(); LoadMaCSKCBTheoMaTinh(); //CheckDungTuyen(); txtMaBenhNhan.Focus(); } /* * Load thông tin từ Bảng Kê * Trang thái 0 : Get từ Form Search * Trang Thai 1: Get thông tin bằng Mã khám chữa bệnh * Trạng thái 2: Get thông tin bằng thẻ BHYT * Trang thái 3: Get bằng số đăng ký. */ if (status == 0 || status == 1 || status == 2 || (TrangThai == "" && status == 3)) { clsBangKe obj = new clsBangKe(); if (TrangThai.Trim() == "" && status == 1) { if (txtMaKhamChuBenh.Text.Trim().Length > 0) { obj.GetByMaKhamChuaBenh(txtMaKhamChuBenh.Text); if (obj.MaKhamChuaBenh == null || obj.MaKhamChuaBenh.Trim() == "") { MessageBox.Show("Không tìm thấy Mã khám chữa bệnh " + txtMaKhamChuBenh.Text + " này.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); ResetControl(); txtMaKhamChuBenh.Focus(); return; } m_BangKe_Id = obj.BangKe_Id; } else { ResetControl(); txtMaKhamChuBenh.Focus(); return; } IsRunCheck = true; } else if (TrangThai.Trim() == "" && status == 2) { if (txtSoTheBHYT.Text.Replace("-", "").Trim().Length > 0) { obj.GetByKey(txtSoTheBHYT.Text.Replace("-", "").Trim()); if (obj.MaKhamChuaBenh == null || obj.MaKhamChuaBenh.Trim() == "") { MessageBox.Show("Không tìm thấy số thẻ " + txtSoTheBHYT.Text + " này.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); ResetControl(); txtSoTheBHYT.Focus(); return; } } else { ResetControl(); txtSoTheBHYT.Focus(); return; } IsRunCheck = true; } else if (TrangThai.Trim() == "" && status == 3) { obj.GetBySoDK(txtSoDK.Text); if (obj.MaKhamChuaBenh == null || obj.MaKhamChuaBenh.Trim() == "") { MessageBox.Show("Không tìm thấy số đăng ký " + txtSoDK.Text + " này.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); ResetControl(); txtSoDK.Focus(); return; } } else if (status == 0) { IsRunCheck = true; obj.GetByKey(m_BangKe_Id); } m_BangKe_Id = obj.BangKe_Id; //txtSoHoSo.Text = obj.SoHoSo; txtSoHoSo.Text = obj.BangKe_Id.ToString(); txtMaKhamChuBenh.Text = obj.MaKhamChuaBenh; //if (status != 2) //{ txtSoTheBHYT.Text = obj.SoTheBHYT; //} txtTuNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.TuNgayBH); txtDenNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.DenNgayBH); txtDiaChi.Text = obj.DiaChi; txtKhoa.Text = obj.Khoa; txtHoTen.Text = obj.HoTen; txtMaBenhNhan.Text = obj.MaNguoiBenh; cboTuyenKham.SelectedValue = obj.TuyenKhamBenh.ToString(); txtNamSinh.Text = obj.NamSinh.ToString(); cboTinhTrang.SelectedIndex = obj.DaGuiBHYT.Value ? 1 : 0; txtSoNgay.Text = obj.SoNgayDieuTri.Value.ToString(); txtNgayVao.Text = string.Format("{0:dd/MM/yyyy}", obj.NgayDenKham); txtNgayRa.Text = string.Format("{0:dd/MM/yyyy}", obj.NgayKetThuc); txtNgayQuyetToan.Text = string.Format("{0:dd/MM/yyyy}", obj.NgayQuyetToan); txtMaICD.Text = obj.MaICD; txtChanDoan.Text = obj.ChanDoan; cboGioiTinh.SelectedValue = obj.GioiTinh.ToString(); cboMaNoiSinhSong.SelectedValue = obj.MaNoiSinhSong; txtMaCSKCBBD.Text = obj.MaCSKCBBanDau; txtTenCSKCBBD.Text = obj.TenCSKCBBanDau; txtNoiChuyenDen.Text = obj.MaNoiChuyenDen; txtNgaySinh.Text = string.Format("{0:dd/MM/yyyy}", obj.NgaySinh); txtBenhKhac.Text = obj.BenhKhac; chkChungTuKhongCCT.Checked = obj.ChungNhanKhongCCT.Value; txtSoDK.Text = obj.SoHoSo; LoadMaCSKCBTheoMaTinh(); // txtMaCSKCBBD.UpdateData(); txtThuoc.Clear(); clsBangKeChiTiet chitiet = new clsBangKeChiTiet(); TableChiPhiThuoc = chitiet.GetAll(m_BangKe_Id); grdChiPhiThuoc.DataSource = TableChiPhiThuoc; txtTongChiPhi.Text = string.Format("{0:#,##0}", TableChiPhiThuoc.Compute("Sum(ThanhTienBHYT)", "True")); txtBHYTThanhToan.Text = string.Format("{0:#,##0}", TableChiPhiThuoc.Compute("Sum(BHYTThanhToan)", "True")); txtNguoiBenhTra.Text = string.Format("{0:#,##0}", TableChiPhiThuoc.Compute("Sum(NguoiBenhTra)", "True")); txtNguonKhac.Text = string.Format("{0:#,##0}", TableChiPhiThuoc.Compute("Sum(NguonKhac)", "True")); txtNgoaiDinhSuat.Text = string.Format("{0:#,##0}", TableChiPhiThuoc.Compute("Sum(ChiPhiNgoaiDinhSuat)", "True")); txtThuoc.Focus(); txtThuoc.Text = ""; txtSoLuongThuoc.Value = 1; txtPhanTramHuong.Value = obj.PhanTramDuocHuong ?? 0; } //txtMaICD.UpdateData(); this.grdChiPhiThuoc.Sort(this.grdChiPhiThuoc.Columns["GroupName"], ListSortDirection.Ascending); IsRunCheck = false; }