private void frminhoadon_Load(object sender, EventArgs e) { DataTable ds = hdbus.getHoaDon(KHAIBAO.mabenhnhan, KHAIBAO.ngaykham); ds.TableName = "HoaDon"; DataTable dt2 = ctkbus.getDonThuoc(KHAIBAO.mabenhnhan + KHAIBAO.ngaykham); dt2.TableName = "DonThuoc"; DataTable dt3 = cdbus.getCachDung(); dt3.TableName = "CachDung"; DataTable dt4 = ltbus.getLoaiThuoc(); dt4.TableName = "LoaiThuoc"; DataTable dt5 = dvbus.getDonVi(); dt5.TableName = "DonVi"; DataSet dts = new DataSet(); dts.Tables.Add(ds); dts.Tables.Add(dt2); dts.Tables.Add(dt3); dts.Tables.Add(dt4); dts.Tables.Add(dt5); if (float.Parse(ds.Rows[0]["TienThuoc"].ToString()) == 0) { ReportDocument report = new ReportDocument(); report.Load("..\\..\\inhoadon1.rpt"); report.SetDataSource(dts); crystalReportViewer.ReportSource = report; inhoadon1 dt = new inhoadon1(); } else { ReportDocument report = new ReportDocument(); report.Load("..\\..\\inhoadon.rpt"); report.SetDataSource(dts); crystalReportViewer.ReportSource = report; inhoadon dt = new inhoadon(); } }
private void bt_in_Click(object sender, EventArgs e) { dr.Close(); dr = cl.laymakh(maphong, lb_ten.Text, Convert.ToInt32(lb_tongtien.Text)); while (dr.Read()) { //MessageBox.Show(dr.GetInt32(0).ToString()); inhoadon.makh = dr.GetInt32(0); inhoadon i = new inhoadon(); i.ShowDialog(); } }