private void FilLReport() { var result = BillReportBusinessLogic.GetBillPartyWiseReport(int.Parse(cbPartyWise.SelectedValue.ToString()), ddlStartDate.Value, ddlEndDate.Value); BRCTransport.Window.ReportFiles.BillReport myDataReport = new BRCTransport.Window.ReportFiles.BillReport(); BillReportDTO bill = new BillReportDTO(); myDataReport.SetDataSource(result); crystalReportViewer.ReportSource = myDataReport; }
private void FilLReport() { int billNo; int.TryParse(txtBillNo.Text, out billNo); var result = BillReportBusinessLogic.GetMRReport(int.Parse(cbPartyWise.SelectedValue.ToString()), ddlStartDate.Value, ddlEndDate.Value, billNo); BRCTransport.Window.ReportFiles.MRNoteReport myDataReport = new BRCTransport.Window.ReportFiles.MRNoteReport(); myDataReport.SetDataSource(result); crystalReportViewer.ReportSource = myDataReport; }
public ActionResult DownloadReport(int countryId, string startDate, string endDate, string format) { LocalReport localReport = new LocalReport(); localReport.ReportPath = Server.MapPath("~/Content/Report/ReportBillPartyWiseReport.rdlc"); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; DateTime sDate; DateTime.TryParse(startDate, out sDate); DateTime eDate; DateTime.TryParse(endDate, out eDate); reportDataSource.Value = BillReportBusinessLogic.GetBillPartyWiseReport(countryId, sDate, eDate); localReport.DataSources.Add(reportDataSource); string reportType = "Image"; string mimeType; string encoding; string fileNameExtension; //The DeviceInfo settings should be changed based on the reportType //http://msdn2.microsoft.com/en-us/library/ms155397.aspx string deviceInfo = "<DeviceInfo>" + " <OutputFormat>jpeg</OutputFormat>" + " <PageWidth>11.5in</PageWidth>" + " <PageHeight>8.5in</PageHeight>" + " <MarginTop>0in</MarginTop>" + " <MarginLeft>0in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); if (format.ToUpper() == "PDF") { return(File(renderedBytes, mimeType)); } else { return(File(renderedBytes, mimeType)); } }
public FileContentResult GenerateAndDisplayReport(int countryId, string startDate, string endDate, string format) { LocalReport localReport = new LocalReport(); localReport.ReportPath = Server.MapPath("~/Content/Report/ReportBillPartyWiseReport.rdlc"); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; DateTime sDate; DateTime.TryParse(startDate, out sDate); DateTime eDate; DateTime.TryParse(endDate, out eDate); reportDataSource.Value = BillReportBusinessLogic.GetBillPartyWiseReport(countryId, sDate, eDate); localReport.DataSources.Add(reportDataSource); string reportType = "Image"; string mimeType; string encoding; string fileNameExtension; string deviceInfo = "<DeviceInfo>" + " <OutputFormat>jpeg</OutputFormat>" + " <PageWidth>11.5in</PageWidth>" + " <PageHeight>8.5in</PageHeight>" + " <MarginTop>0in</MarginTop>" + " <MarginLeft>0in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); //return File(renderedBytes, "image/jpeg"); return(File(renderedBytes, "pdf")); }