private void frmDanhsachchoBHYT_Load(object sender, EventArgs e) { tmn_huy38.Enabled = false; bDain = false; f_Load_DG(); m_frmprinthd = new frmPrintHD(m_v, m_userid); }
private void f_Load_DG() { try { string sql = "", asqlnt = ""; sql = "select to_number(0,'9') as chon, b1.ma,b.idtra,b1.ten,b1.dvt,b.soluong,b.dongia,b.soluong*b.dongia-b.mien-b.thieu as sotien,b.tra, b.id,b.stt,b.mavp, a.mabn,a.hoten,a.mavaovien,a.maql,a.loai,a.loaibn,a.makp,a.quyenso,a.sobienlai,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.idchidinh from medibvmmyy.v_vienphill a left join medibvmmyy.v_vienphict b on a.id=b.id left join medibvmmyy.v_trongoi c on a.id=c.id left join (select id,ma,ten,dvt from medibv.v_giavp union all select id,ma,ten,dang as dvt from medibv.d_dmbd) b1 on b.mavp=b1.id where c.id is null and a.id=" + m_id; asqlnt = "select to_number(0,'9') as chon, b1.ma,c.idtra,case when c.phuthu = 1 then 'Phụ thu '||b1.ten else b1.ten end as ten,b1.dvt,c.soluong,c.dongia,c.soluong*c.dongia as sotien,c.tra, c.id,c.stt,c.mavp, a.mabn,bn.hoten,a.mavaovien,a.maql,b.loai,b.loaibn,b.makp,b.quyenso,b.sobienlai,to_char(b.ngay,'dd/mm/yyyy') as ngay, c.idtonghop as idchidinh from medibv.btdbn bn inner join medibvmmyy.v_ttrvds a on bn.mabn=a.mabn inner join medibvmmyy.v_ttrvll b on a.id=b.id inner join medibvmmyy.v_ttrvct c on a.id=c.id inner join (select id,ma,ten,dvt from medibv.v_giavp union all select id,ma,ten,dang as dvt from medibv.d_dmbd) b1 on c.mavp=b1.id where a.id=" + m_id; if (v_loai == "1") { m_ds = m_v.get_data_mmyy(m_mmyy, sql); } else { m_ds = m_v.get_data_mmyy(m_mmyy, asqlnt); } dataGridView1.DataSource = m_ds.Tables[0]; tmn_Tong.Text = lan.Change_language_MessageText("Tổng số:") + " " + dataGridView1.RowCount.ToString() + " mục"; dataGridView1.Update(); butHoan.Enabled = (m_ds.Tables[0].Select("chon = 1 and tra=0").Length > 0 && m_id != "" && m_id != "0"); frmInhoantra = new frmPrintHD(m_v, m_userid); } catch { butHoan.Enabled = false; tmn_Tong.Text = ""; } }