void IReport.Preview() { DataTable dt_X = ((DataView)gridViewCT.DataSource).ToTable(); string strReport = "\\Report\\RptBaoCaoThuocCanDate.repx"; XtraReport xtra_report = new XtraReport(); xtra_report.Parameters.Clear(); string file = Application.StartupPath + strReport; xtra_report.LoadLayout(file); xtra_report.DataSource = dt_X; GPP_DungChung_HL.Form.FrmXtraReportViewer rpt = new GPP_DungChung_HL.Form.FrmXtraReportViewer(xtra_report); rpt.ShowDialog(); }
private void btnIn_Click(object sender, EventArgs e) { DataTable dt_X = ((DataView)gridView_CT.DataSource).ToTable(); string strReport = "\\Report\\baocaonhansu.repx"; XtraReport xtra_report = new XtraReport(); xtra_report.Parameters.Clear(); string file = Application.StartupPath + strReport; xtra_report.LoadLayout(file); xtra_report.DataSource = dt_X; GPP_DungChung_HL.Form.FrmXtraReportViewer rpt = new GPP_DungChung_HL.Form.FrmXtraReportViewer(xtra_report); rpt.ShowDialog(); }
private void btnIn_Click(object sender, EventArgs e) { DataTable dt = ((DataView)gridViewCT.DataSource).ToTable(); dt.Columns.Add("tenthuoc", typeof(string)); foreach (DataRow rw in dt.Rows) { string str = string.Empty; dt_Thuoc.DefaultView.RowFilter = string.Format("IDTHUOC ={0}", rw["IDTHUOC"]); if (dt_Thuoc.DefaultView.ToTable() != null) { str = (dt_Thuoc.DefaultView.ToTable()).Rows[0]["TENTHUOC"].ToString(); rw["tenthuoc"] = str; } dt_Thuoc.DefaultView.RowFilter = ""; } DataRow rowNew_g = ((DataRowView)m_CmG.Current).Row; string strReport = "\\Report\\RptHoaDonXuat.repx"; string ma_kh = string.Empty, ten_kh = string.Empty, diachi = string.Empty; dt_KH.DefaultView.RowFilter = string.Format("IDKHACHHANG = {0}", rowNew_g["IDKHACHHANG"]); if (dt_KH.DefaultView.ToTable() != null) { ma_kh = dt_KH.DefaultView.ToTable().Rows[0]["MAKHACHHANG"].ToString(); ten_kh = dt_KH.DefaultView.ToTable().Rows[0]["TENKH"].ToString(); diachi = dt_KH.DefaultView.ToTable().Rows[0]["DIACHIKH"].ToString(); } XtraReport xtra_report = new XtraReport(); xtra_report.Parameters.Clear(); string file = Application.StartupPath + strReport; xtra_report.LoadLayout(file); GPP_DungChung_HL.Function.CreateXtraReportParameters(xtra_report, "m_kh", typeof(string), ma_kh, "khachhang", typeof(string), ten_kh, "diachi", typeof(string), diachi, "tieude", typeof(string), "PHIẾU XUẤT THUỐC", "ngayxuat", typeof(string), Convert.ToDateTime(rowNew_g["ngayxuat"]).ToString("dd/MM/yyyy") ); xtra_report.DataSource = dt; GPP_DungChung_HL.Form.FrmXtraReportViewer rpt = new GPP_DungChung_HL.Form.FrmXtraReportViewer(xtra_report); rpt.ShowDialog(); }