private void btnShow_Click(object sender, EventArgs e) { ReportDocument reportDocument = new ReportDocument(); string filePath = String.Format("{0}\\SalesDetails.rpt", System.Configuration.ConfigurationManager.AppSettings["ReportFolderPath"]); reportDocument.Load(filePath); reportDocument.Refresh(); reportDocument.SetParameterValue("@startdate", dtpStartDate.Value.Date); reportDocument.SetParameterValue("@enddate", dtpEndDate.Value.Date); reportDocument.SetParameterValue("@startdate", dtpStartDate.Value.Date, reportDocument.Subreports[0].Name.ToString()); reportDocument.SetParameterValue("@enddate", dtpEndDate.Value.Date, reportDocument.Subreports[0].Name.ToString()); FormReport frm = new FormReport(); frm.Text = "Sales Report"; frm.crystalReportViewer1.ReportSource = reportDocument; frm.Visible = true; }
private void btnPrintInvoice_Click(object sender, EventArgs e) { if (_billId > 0) { BillInfo _billInfo = createBillInfoObject(); _billInfo.BillId = _billId; _billInfo.BillNo = "B" + _billId; new BllBillInfo().InsertOrUpdate(_billInfo); } /*ReportInvoice rpt = new ReportInvoice(); foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in rpt.Database.Tables) { SetTableLogin(tbCurrent); } rpt.SetParameterValue("@billid", _billId); FormReport frm = new FormReport(); frm.Text = "Invoice"; frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true;*/ ReportDocument reportDocument = new ReportDocument(); string filePath = String.Format("{0}\\Invoice.rpt", System.Configuration.ConfigurationManager.AppSettings["ReportFolderPath"]); reportDocument.Load(filePath); reportDocument.Refresh(); reportDocument.SetParameterValue("@billid", _billId); reportDocument.SetParameterValue("@billid", _billId, reportDocument.Subreports[0].Name.ToString()); FormReport frm = new FormReport(); frm.Text = "Invoice"; frm.crystalReportViewer1.ReportSource = reportDocument; frm.Visible = true; btnSave.Enabled = true; }