public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DebitVoucherByDebitACCrystalReportSummary rpt = new DebitVoucherByDebitACCrystalReportSummary(); rpt.Site = this.Site; return rpt; }
public void ReadSummary(string srr) { this.reportQuary = dateTimePicker1.Text + " to " + dateTimePicker2.Text; string query = ""; query = "SELECT CompanyName, Income, SUM(Amount) AS Amount FROM TbDailyIncome Where IncomeDate BETWEEN '" + dateTimePicker1.Value.Date + "' AND '" + dateTimePicker2.Value.Date + "' AND Debit = @Debit GROUP BY CompanyName, Income"; if (query != "") { SqlConnection conn = new SqlConnection(this.connectionString); SqlCommand comm = new SqlCommand(query, conn); comm.Parameters.Add("@Debit", SqlDbType.VarChar, 50); comm.Parameters["@Debit"].Value = comboBox1.Text; SqlDataAdapter adap = new SqlDataAdapter(); DataSets.DebitVoucherDataSet dataset = new DataSets.DebitVoucherDataSet(); DebitVoucherByDebitACCrystalReportSummary crp = new DebitVoucherByDebitACCrystalReportSummary(); try { conn.Open(); adap.SelectCommand = comm; adap.Fill(dataset, "DataTable1"); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { conn.Close(); } crp.SetDataSource(dataset); ParameterValues v = new ParameterValues(); ParameterDiscreteValue dv = new ParameterDiscreteValue(); dv = new ParameterDiscreteValue(); dv.Value = this.reportQuary; v.Add(dv); crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v); crystalReportViewer2.ReportSource = crp; } }