private void f_Load_Data() { m_frmtimbenhnhan = new frmTimbenhnhan(m_v, m_userid); m_frmtimbenhnhan.ShowInTaskbar = false; string atmp = m_v.s_curmmyyyy; m_cur_ngay = m_v.f_parse_date(atmp); m_cur_yy = m_cur_ngay.Year.ToString().Substring(2); cbGioitinh.DataSource = m_v.get_data("select ma,ten from medibv.dmphai order by ma desc").Tables[0]; cbGioitinh.DisplayMember = "ten"; cbGioitinh.ValueMember = "ma"; cbKymien.DataSource = m_v.get_data("select ma,ten from medibv.v_dsduyet order by ten desc").Tables[0]; cbKymien.DisplayMember = "ten"; cbKymien.ValueMember = "ma"; cbLoaibn.DataSource = m_v.get_data("select id,ten from medibv.v_loaibn order by id").Tables[0]; cbLoaibn.DisplayMember = "ten"; cbLoaibn.ValueMember = "id"; cbKhoaTD.DataSource = m_v.get_data("select makp,tenkp from medibv.btdkp_bv order by makp").Tables[0]; cbKhoaTD.DisplayMember = "tenkp"; cbKhoaTD.ValueMember = "makp"; cbDoituongTD.DataSource = m_v.get_data("select madoituong,doituong,field_gia,mien,mabv,sothe,ngay from medibv.doituong order by madoituong").Tables[0]; cbDoituongTD.DisplayMember = "doituong"; cbDoituongTD.ValueMember = "madoituong"; cbTuoi.DataSource = m_v.f_get_dmtuoi().Tables[0]; cbTuoi.DisplayMember = "ten"; cbTuoi.ValueMember = "id"; }
private void f_Load_Sua() { try { DataRowView arv = (DataRowView)(dataGridView1.CurrentRow.DataBoundItem); string sql = ""; sql = "select a.id,a.sohieubl,a.sohieu,a.tu,a.den,a.soghi,case when a.dangsd is null then 0 else a.dangsd end as dangsd, case when a.khambenh is null then 0 else a.khambenh end as khambenh, a.loai, b.hoten,to_char(a.ngaylinh,'dd/mm/yyyy') as ngaylinh, a.userid from medibv.v_quyenso a left join medibv.v_dlogin b on a.userid=b.id where a.id=" + arv["id"].ToString(); foreach (DataRow r in m_v.get_data(sql).Tables[0].Rows) { m_id = r["id"].ToString(); txtID.Text = r["id"].ToString(); txtSohieubl.Text = r["sohieubl"].ToString(); txtSohieu.Text = r["sohieu"].ToString(); txtTuso.Text = r["tu"].ToString(); txtDenso.Text = r["den"].ToString(); txtSoghi.Text = r["soghi"].ToString(); txtNgaylinh.Value = m_v.f_parse_date(r["ngaylinh"].ToString()); f_Set_id_loai(r["loai"].ToString()); chkDangsd.Checked = r["dangsd"].ToString() == "1"; chkKhambenh.Checked = r["khambenh"].ToString() == "1"; chkHide.Checked = r["hide"].ToString() == "1"; txtTuso_Validated(null, null); txtDenso_Validated(null, null); txtSoghi_Validated(null, null); break; } } catch { } }
private void butLuu_Click(object sender, EventArgs e) { try { string angaykhoaso = m_v.f_ngaykhoaso(m_userid); string atmp = f_Get_Sobienlai(); if (atmp.Split(':')[1] == "1")//Hết số { MessageBox.Show(this, "Hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } if (s_loaidv == "" || s_quyenso == "") { MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } atmp = f_Get_Sobienlai_dichvu(); if (s_quyenso_dichvu == "" && ((v_loai == "0" && bTT_Tachhoadon) || (v_loai == "1" && bTTRV_Tachhoadon) || (v_loai == "2" && bBHYT_Tachhoadon) || (v_loai == "2" && bBhyt_dichvu))) { MessageBox.Show(this, "Chọn quyển sổ dịch vụ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } if (v_loai == "1") { atmp = f_Get_Sobienlai_thatthu(); if (atmp.Split(':')[1] == "1")//Hết số { MessageBox.Show(this, "Quyển số thất thu hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } if (s_loaidv == "" || (s_quyenso_thatthu == "" && bTtrv_thatthu)) { MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } //---------------------------------------------- atmp = f_Get_Sobienlai_thua(); if (atmp.Split(':')[1] == "1")//Hết số { MessageBox.Show(this, "Quyển số thừa hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } if (s_loaidv == "" || (s_quyenso_thua == "" && bTtrv_thatthu)) { MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } atmp = f_Get_Sobienlai_dichvu(); if (atmp.Split(':')[1] == "1")//Hết số { MessageBox.Show(this, "Quyển số thừa hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); dichvu.Focus(); return; } if (s_loaidv == "" || (s_quyenso_dichvu == "" && (bTtrv_dichvu || bTt_gtgt))) { MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); cbLoai.Focus(); return; } } if (angaykhoaso != "xx/xx/xxxx" && angaykhoaso.Trim() != "") { if (m_v.f_parse_date(angaykhoaso) >= txtNgaythu.Value) { MessageBox.Show(this, lan.Change_language_MessageText("Ngày làm việc phải > ") + angaykhoaso, lan.Change_language_MessageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtNgaythu.Focus(); return; } else { this.DialogResult = DialogResult.OK; System.GC.Collect(); this.Close(); } } else { this.DialogResult = DialogResult.OK; System.GC.Collect(); this.Close(); } f_capnhat_db(m_v.mmyy(txtNgaythu.Text.Substring(0, 10))); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }