private void tmn_Hotkey_Click(object sender, EventArgs e) { try { if (m_loaiform != "" && m_userid != "") { frmHotkey af = new frmHotkey(m_v, m_userid, m_loaiform, ""); af.ShowInTaskbar = false; if (af.ShowDialog() == DialogResult.OK) { if (af.s_hotkey != "") { string ahotkey = af.s_hotkey; string aghichu = af.s_ghichu; m_v.execute_data("delete from medibv.v_optionhotkey where userid=" + m_userid + " and loai=" + m_loaiform + " and hotkey='" + af.s_hotkey + "'"); foreach (string atmp in f_GetItem().Split(',')) { m_v.upd_v_optionhotkey(decimal.Parse(m_userid), decimal.Parse(m_loaiform), ahotkey, decimal.Parse(atmp), aghichu); } m_dshotkey = m_v.f_get_hotkey(m_userid, m_loaiform); m_reset = true; } } } } catch { } }
private void f_Prepare() { decimal n = 0; try { n = decimal.Parse(m_v.get_data("select ma from medibv.dm_1021_ct").Tables[0].Rows.Count.ToString()); } catch { m_v.execute_data("create table medibv.dm_1021_ct(ma number(3), mavp number(7), constraint pk_dm_1021_ct primary key(ma,mavp))"); } }
private void f_Load_DG() { try { 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,to_char(a.ngayud,'dd/mm/yyyy hh24:mi') as ngayud,a.dichvu,a.chinhanh,a.hide from " + m_v.user + ".v_quyenso a inner join " + m_v.user + ".v_dlogin b on a.userid=b.id" + (m_v.sys_dungchungso ? "" : " and a.userid=" + m_userid); m_dsds = m_v.get_data(sql); if (m_dsds == null) { m_v.execute_data("alter table " + m_v.user + ".v_quyenso add sohieubl text"); m_v.execute_data("update " + m_v.user + ".v_quyenso set sohieubl=sohieu where sohieubl is null"); m_v.execute_data("alter table " + m_v.user + ".v_quyenso add soghiam numeric(7) default -1"); m_dsds = m_v.get_data(sql); } dataGridView1.DataSource = m_dsds.Tables[0]; toolStrip_Tim_TextChanged(null, null); } catch//(Exception ex) { //MessageBox.Show(ex.ToString()); } }
private void butLuu_Click(object sender, EventArgs e) { try { DataSet ads = m_dsgoivp; int n = ads.Tables[0].Rows.Count; m_v.execute_data("delete from medibv.v_trongoi where id = " + m_id_gia.ToString()); if (n > 0) { if (MessageBox.Show(this, lan.Change_language_MessageText("Đồng ý cập nhật chi tiết gói viện phí (") + n.ToString() + " Mục)?", m_v.s_AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { butLuu.Enabled = false; //ttStatus.Text = lan.Change_language_MessageText("Đang cập nhật, xin chờ ...!"); decimal i = 0, aid = 0, aid_nhom = 0, aid_loai = 0, aid_gia = 0, asotien = 0, astt = 1, adongia = 0, asoluong = 0, adoituong = 0; try { aid = decimal.Parse(m_id_gia); } catch { aid = 0; } if (aid == 0) { MessageBox.Show(this, lan.Change_language_MessageText("Chưa chọn giá viện phí!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } foreach (DataRow r in ads.Tables[0].Rows) { i++; try { aid_nhom = decimal.Parse(r["id_nhom"].ToString()); } catch { aid_nhom = 0; } try { aid_loai = decimal.Parse(r["id_loai"].ToString()); } catch { aid_loai = 0; } try { aid_gia = decimal.Parse(r["id"].ToString()); } catch { aid_gia = 0; } try { astt = decimal.Parse(r["stt"].ToString()); } catch { astt = 1; } try { asotien = decimal.Parse(r["sotien"].ToString()); } catch { asotien = 0; } try { asoluong = decimal.Parse(r["soluong"].ToString()); } catch { asoluong = 1; } try { adoituong = decimal.Parse(r["madoituong"].ToString()); } catch { adoituong = 0; } if (asoluong < 0) { asoluong = 1; } adongia += asotien; try { //ttStatus.Text = lan.Change_language_MessageText("Đang cập nhật:")+" " + i.ToString() + "/" + n.ToString() + " !"; m_v.execute_data("insert into medibv.v_trongoi (id,id_nhom,id_loai,id_gia,soluong,sotien,stt,madoituong) values(" + aid.ToString() + "," + aid_nhom.ToString() + "," + aid_loai.ToString() + "," + aid_gia.ToString() + "," + asoluong.ToString() + "," + asotien.ToString() + "," + astt.ToString() + "," + adoituong.ToString() + ") "); } catch { } } string aval = m_dsgoivp.Tables[0].Rows.Count > 0 ? "1" : "0"; m_v.execute_data("update medibv.v_giavp set trongoi=" + aval + " where id = " + aid.ToString()); m_v.execute_data("update medibv.v_giavp set trongoi=0 where trongoi=1 and id not in (select distinct id from medibv.v_trongoi where id_gia<>0)"); //ttStatus.Text = lan.Change_language_MessageText("Cập nhật xong!"); f_Load_DG(); butLuu.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btOK_Click(object sender, EventArgs e) { // chuyển tồn từ tháng được chọn sang tháng hiện tại // string angay1 = txtTN.Text; //string athang1 = angay1.Substring(3, 2); // string anam = m_v.s_curyyyy; if (!kiemTra()) { return; } string ammyy1 = txtTuMM.Value.ToString().PadLeft(2, '0') + txtTuYYYY.Value.ToString().Substring(2, 2); string ammyy = txtDenMM.Value.ToString().PadLeft(2, '0') + txtDenYYYY.Value.ToString().Substring(2, 2); DataSet ds = new DataSet(); string sql = "", sql1 = ""; Object ob = MessageBox.Show("Bạn có muốn chuyển tồn tháng " + txtTuMM.Value.ToString() + " năm " + txtTuYYYY.Value.ToString(), LibVP.AccessData.Msg, MessageBoxButtons.YesNo); if ((txtTuMM.Value == txtDenMM.Value) && (txtDenYYYY.Value == txtTuYYYY.Value)) { MessageBox.Show("Chuyển số liệu thành công !"); } else { if (ob.ToString() == "Yes") { if (m_v.bMmyy(ammyy1))//gam 12/09/2011 { sql1 = "select * from medibv" + ammyy1 + ".v_tontamung"; } else { MessageBox.Show(lanque.Change_language_MessageText("Số liệu tháng " + ammyy1.Substring(0, 2) + " năm " + ammyy1.Substring(2, 2) + " chưa tạo số liệu")); return; } try { ds = m_v.get_data(sql1); } catch { ds = null; } if (!m_v.bMmyy(ammyy))//gam 12/09/2011 { MessageBox.Show(lanque.Change_language_MessageText("Số liệu tháng " + ammyy.Substring(0, 2) + " năm " + ammyy.Substring(2, 2) + " chưa tạo số liệu")); return; } if (ds.Tables[0].Rows.Count == 0) { // kiểm tra nếu tháng này không có bảng v_tontamung thì insert từ bảng v_tamung sql = "insert into medibv" + ammyy + ".v_tontamung (id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra) "; sql += "select id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra from medibv" + ammyy1 + ".v_tamung a where a.done=0 and a.id not in (select id from medibv" + ammyy + ".v_tontamung) "; } else { // nếu có bảng v_tontamung nhưng không có dữ liệu thì insert từ bảng v_tamung if (ds.Tables[0].Rows.Count == 0) { sql = "insert into medibv" + ammyy + ".v_tontamung (id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra) "; sql += "select id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra from medibv" + ammyy1 + ".v_tamung a where a.done=0 and a.id not in (select id from medibv" + ammyy + ".v_tontamung) "; } // bảng v_tontamung có data thì insert từ v_tontamung và v_tamung else { sql = "insert into medibv" + ammyy + ".v_tontamung (id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra) "; sql += "select id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra from medibv" + ammyy1 + ".v_tontamung a where a.done=0 and a.id not in (select id from medibv" + ammyy + ".v_tontamung) "; sql += "union all select id,mabn,mavaovien,maql,idkhoa,quyenso,sobienlai,ngay,loai,makp,madoituong,sotien,ketoan,done,lanin,loaibn,idttrv,datru,userid,ngayud,ngaytra from medibv" + ammyy1 + ".v_tamung a where a.done=0 and a.id not in (select id from medibv" + ammyy + ".v_tontamung) "; } } try { m_v.execute_data(sql); } catch { MessageBox.Show("Chuyển số liệu không thành công !"); } MessageBox.Show("Chuyển số liệu thành công !"); } else { //MessageBox.Show("Yeu cau khong chuyen da chap nhan"); } }// end if((txtTuMM.Value == txtDenMM.Value) && (txtDenYYYY.Value == txtTuYYYY.Value)) }