public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PrintBookSale rpt = new PrintBookSale(); rpt.Site = this.Site; return(rpt); }
private void PrintWareSale_Load(object sender, EventArgs e)//初始化 { if (ware.Trim() == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintBookSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", begindate); adapter.SelectCommand.Parameters.AddWithValue("@date2", enddate); data.Clear(); adapter.Fill(data.book_sale); PrintBookSale booksale = new PrintBookSale(); booksale.SetDataSource(data); this.crystalReportViewer1.ReportSource = booksale; } else { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintCdSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", begindate); adapter.SelectCommand.Parameters.AddWithValue("@date2", enddate); data.Clear(); adapter.Fill(data.cd_sale); PrintCdSale cdsale = new PrintCdSale(); cdsale.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdsale; } }