public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { reportMonthSales rpt = new reportMonthSales(); rpt.Site = this.Site; return(rpt); }
private void button2_Click(object sender, EventArgs e) { DateTime dtYear = DateTime.Now; String query = "SELECT DATE_FORMAT(Date, '%Y') AS Year,DATE_FORMAT(Date, '%m. %b') AS Month, SUM(Ammount) AS 'Total Ammount' " + "FROM tbltransaction " + "GROUP BY YEAR(Date)"; Database db = new Database(); db.conn.Open(); MySqlDataAdapter da = new MySqlDataAdapter(query, db.conn); DataTable tb = new DataTable(); da.Fill(tb); db.conn.Close(); DataSet ds = new DataSet(); ds.Tables.Add(tb); ds.WriteXmlSchema("YearSummarySales.xml"); reportMonthSales ms = new reportMonthSales(); ms.SetDataSource(ds); FormViewerTesting frm = new FormViewerTesting(); frm.crystalReportViewer1.ReportSource = ms; frm.Show(); }