示例#1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            clsBangKe obj = new clsBangKe();
            obj.GetByKey(m_BangKe_Id);

            if (m_BangKe_Id == 0)
            {
                MessageBox.Show("Bạn vui lòng chọn bảng kê để xóa.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //lblThongBao.Text = "Bạn vui lòng chọn bảng kê để xóa!";
                //timerThongBao.Enabled = true;
                return;
            }

            if (obj.DaGuiBHYT.Value)
            {
                MessageBox.Show("Bảng kê này đã gửi BHXH.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //lblThongBao.Text = "Bảng kê này đã gửi BHXH!.";
                //timerThongBao.Enabled = true;
                return;
            }

            if (MessageBox.Show("Bạn có muốn xóa bảng kê này?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                int kq = obj.Delete(m_BangKe_Id);
                if (kq > 0)
                {
                    //MessageBox.Show("Xóa bảng kê thành công?", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    lblThongBao.Text = "Xóa bảng kê thành công.";
                    timerThongBao.Enabled = true;

                    SetControlStatusReadOnly(true);
                    ResetControl();
                }
            }
        }
示例#2
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            TrangThai = "CapNhat";
            txtMaKhamChuBenh.Enabled = false;
            if (m_BangKe_Id == 0)
            {
                TrangThai = "";
                MessageBox.Show("Bạn vui lòng chọn bảng kê để chỉnh sửa.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //lblThongBao.Text = "Bạn vui lòng chọn bảng kê để chỉnh sửa!";
                //timerThongBao.Enabled = true;
                return;
            }

            clsBangKe obj = new clsBangKe();
            obj.GetByKey(m_BangKe_Id);

            if (obj.DaGuiBHYT.Value)
            {
                MessageBox.Show("Bảng kê này đã gửi BHXH.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //lblThongBao.Text = "Bảng kê này đã gửi BHXH!";
                //timerThongBao.Enabled = true;
                return;
            }

            btnThem.Enabled = false;
            btnSua.Enabled = false;
            btnXoa.Enabled = false;
            btnDong.Enabled = false;

            btnGuiBHXH.Enabled = false;

            btnLuu.Enabled = true;
            btnHuyBo.Enabled = true;

            btnCheckThe.Enabled = true;

            SetControlStatusReadOnly(false);
        }
示例#3
0
        //Gui BHXH
        private void btnGuiBHXH_Click(object sender, EventArgs e)
        {
            //WSUpdateBangKe
            //WSPutBangKe

            if (m_BangKe_Id == 0)
            {
                MessageBox.Show("Bạn vui lòng chọn bảng kê để gửi BHXH.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //lblThongBao.ForeColor = Color.Red;
                //lblThongBao.Text = "Bạn vui lòng chọn bảng kê để gửi BHXH!";
                //timerThongBao.Enabled = true;
                return;
            }

            if (MessageBox.Show("Bạn có muốn gửi BHXH?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                clsBangKe bangKe = new clsBangKe();
                bangKe.GetByKey(m_BangKe_Id);

                string TrangThai = "";

                if (bangKe.DaGuiBHYT.Value == false)
                {
                    TrangThai = "WSPutBangKe";
                }
                else
                {
                    TrangThai = "WSUpdateBangKe";
                }
                Send(bangKe, TrangThai);
            }
        }
示例#4
0
        private void UpdateData()
        {
            SQLiteDAL DAL = new SQLiteDAL();
            DAL.BeginTransaction();
            clsBangKe objBangKe = new clsBangKe();
            List<clsBangKeChiTiet> chitiets = new List<clsBangKeChiTiet>();

            try
            {
                objBangKe.GetByKey(m_BangKe_Id);

                FillBangKe(ref objBangKe);
                int kq = objBangKe.Update(DAL);

                if (kq > 0)
                {
                    kq = objBangKe.DeleteBangKeChiTiet(m_BangKe_Id, DAL);
                    if (kq > 0)
                    {
                        FillBangKe(ref chitiets, m_BangKe_Id);
                        foreach (clsBangKeChiTiet ct in chitiets)
                        {
                            kq = ct.Insert(DAL);
                            if (kq <= 0)
                            {
                                DAL.RollbackTransaction();
                                return;
                            }
                        }
                    }
                    else
                    {
                        DAL.RollbackTransaction();
                        return;
                    }

                }
                else
                {
                    DAL.RollbackTransaction();
                    return;
                }

                DAL.CommitTransaction();
                //MessageBox.Show("Cập nhật bảng kê thành công", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                lblThongBao.Text = "Cập nhật bảng kê thành công.";
                timerThongBao.Enabled = true;
            }
            catch (Exception ex)
            {
                DAL.RollbackTransaction();
                m_BangKe_Id = 0;
                txtSoHoSo.Text = "";
                MessageBox.Show("Cập nhật bảng kê không thành công.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //lblThongBao.Text = "Cập nhật bảng kê không thành công";
                //timerThongBao.Enabled = true;
            }
        }
示例#5
0
        private void txtSoTheBHYT_Validated(object sender, EventArgs e)
        {
            //Khi nhập xong số thẻ BHYT tự động chọn mức hưởng dựa vào ký tự số 3.
            //Vì trước đây có 7 mức hưởng, sau này chuyển thành 5 mức hưởng. Các thẻ cũ thì vẫn chưa đổi số thẻ nhưng vẫn hưởng theo mức hưởng mới.
            //Phải check trong bảng DM_ChuyenDoi trước theo cặp key DoiTuong (2 ký tự đầu) và mức hưởng cũ (ký tự số 3) --> chọn mức hưởng (theo mức hưởng mới).
            //Nếu không có trong bảng DM_ChuyenDoi thì nhảy theo bảng DM_MucHuong và check thêm 2 ký đầu và ký tự số 3 có đúng không trong bảng DM_MucHuongChuyenDoi
            int MucHuong = clsDM_ChuyenDoiMucHuong.GetMucHuongMoi(txtSoTheBHYT.Text);
            cboMucHuong.SelectedValue = MucHuong;

            txtNgayVao_Validated(null, null);

            if (txtSoTheBHYT.Text.Replace("-", "").Length >= 15)
            {
                if (TrangThai == "")
                {
                    LoadData(2);
                }
                else if (TrangThai == "ThemMoi" && (txtSoDK.Text.Trim().Length == 0 && txtMaBenhNhan.Text.Trim().Length == 0
                    && txtMaKhamChuBenh.Text.Trim().Length == 0))
                {
                    clsBangKe obj = new clsBangKe();

                    IsRunCheck = true;
                    if (txtSoTheBHYT.Text.Replace("-", "").Trim().Length > 0)
                    {
                        obj.GetByKey(txtSoTheBHYT.Text.Replace("-", "").Trim());
                        if (obj.MaKhamChuaBenh == null || obj.MaKhamChuaBenh.Trim() == "")
                        {
                            //Do nothing
                        }
                        else
                        {
                            txtTuNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.TuNgayBH);
                            txtDenNgay.Text = string.Format("{0:dd/MM/yyyy}", obj.DenNgayBH);
                            txtDiaChi.Text = obj.DiaChi;
                            cboGioiTinh.SelectedValue = obj.GioiTinh.ToString();
                            cboMaNoiSinhSong.SelectedValue = obj.MaNoiSinhSong;
                            txtMaCSKCBBD.Text = obj.MaCSKCBBanDau;
                            txtTenCSKCBBD.Text = obj.TenCSKCBBanDau;
                            txtNgaySinh.Text = string.Format("{0:dd/MM/yyyy}", obj.NgaySinh);
                            txtMaBenhNhan.Text = obj.MaNguoiBenh;
                            cboTuyenKham.SelectedValue = obj.TuyenKhamBenh.ToString();
                            cboMaNoiSinhSong.SelectedValue = obj.MaNoiSinhSong;
                            txtNamSinh.Text = obj.NamSinh.ToString();
                            txtHoTen.Text = obj.HoTen.ToString();
                        }

                        IsRunCheck = false;
                    }
                }

                LoadMaCSKCBTheoMaTinh();

            }
        }
示例#6
0
        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;
        }