public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { todayreport rpt = new todayreport(); rpt.Site = this.Site; return(rpt); }
private void rbtn7_Click(object sender, EventArgs e) { rpnl4.Visible = true; rpnl3.Visible = false; DateTime x = DateTime.Now; String date = x.ToString("yyyy-MM-dd"); //String date = "2014-11-02"; String cm = ""; if (type.CompareTo("all") == 0) { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "'; "; } else if (type.CompareTo("takeaway") == 0) { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and ordtype = '" + type + "'; "; } else if (type.CompareTo("dine") == 0) { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and ordtype = '" + type + "'; "; } else if (type.CompareTo("delivery") == 0) { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and ordtype = '" + type + "'; "; } else if (type.CompareTo("category") == 0) { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and itemcateg = '" + rcmb1.SelectedItem.ToString() + "'; "; } else if (type == "item") { String selitem = rcmb1.SelectedItem.ToString(); int siz = 0; if (selitem.Contains(" 8")) { siz = 8; selitem = selitem.Replace(" 8", ""); cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and itemname = '" + selitem + "' and itemsize = " + siz + "; "; } else if (selitem.Contains(" 12")) { siz = 12; selitem = selitem.Replace(" 12", ""); cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and itemname = '" + selitem + "' and itemsize = " + siz + "; "; } else { cm = "SELECT * FROM [pizza].[dbo].[order] where date = '" + date + "' and itemname = '" + selitem + "'; "; } } SqlCommand cmd = new SqlCommand(cm, con); con.Open(); //MessageBox.Show(cm); SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); todayreport obj = new todayreport(); obj.SetDataSource(dt); crystalReportViewer1.ReportSource = obj; crystalReportViewer1.Size = new Size(2000, 2000); crystalReportViewer1.Refresh(); rpnl4.Controls.Add(crystalReportViewer1); con.Close(); }