示例#1
0
        public ActionResult xrayreferral(RadiologyReportXrayReferral param)
        {
            //SP SP_Get_XrayfromER Report_Radiology.rpt
            var vm = param;

            if (Request.IsAjaxRequest())
            {
                var xrayreferral = radiologyDB.getXrayReferral(param.StartDate, param.EndDate.AddDays(1));


                ReportViewerVm reportVM      = new ReportViewerVm();
                ReportViewer   reportViewer  = new ReportViewer();
                string         reportDocPath = "";
                DataTable      reportData    = new DataTable();



                reportData = radiologyDB.getXrayReferral(vm.StartDate, vm.EndDate.AddDays(1));

                reportDocPath = @"\Areas\ManagementReports\Reports\RadiologyReports\XrayReferral.rdl";

                if (reportData.Rows.Count == 0)
                {
                    return(Content(Errors.ReportContent("NO RECORDS FOUND")));
                }

                reportViewer.ProcessingMode         = ProcessingMode.Local;
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + reportDocPath;
                ReportDataSource datasourceItem = new ReportDataSource("DataSet1", reportData);
                reportViewer.LocalReport.DataSources.Add(datasourceItem);

                //For Dynamic Report Header
                OtherReportsDB otherReprtDB = new OtherReportsDB();
                DataTable      reportHeader = new DataTable();
                reportHeader = otherReprtDB.getReportHeader2018();
                ReportDataSource datareportheaderitem = new ReportDataSource("ReportHeader2018", reportHeader);
                reportViewer.LocalReport.DataSources.Add(datareportheaderitem);


                reportViewer.LocalReport.SetParameters(new ReportParameter("stdate", param.StartDate.ToShortDateString()));
                reportViewer.LocalReport.SetParameters(new ReportParameter("endate", param.EndDate.ToShortDateString()));
                reportViewer.LocalReport.SetParameters(new ReportParameter("branch", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper()));
                reportViewer.SizeToReportContent = true;
                reportViewer.Height          = Unit.Percentage(100);
                reportViewer.Width           = Unit.Percentage(100);
                reportViewer.ShowPrintButton = true;
                reportVM.ReportViewer        = reportViewer;
                System.Web.HttpContext.Current.Session[Global.ReportViewerSessionName] = reportViewer;
                System.Web.HttpContext.Current.Session[Global.PdfUriSessionName]       = Common.Helper.getApplicationUri("Preview", "Print", null);
                return(PartialView("~/Views/Shared/_reportViewer.cshtml", reportVM));
            }
            return(View());
        }
        public ReportViewer DynamicReportHeader(ReportViewer reportViewer, string reportdataSetName)
        {
            //For Dynamic Report Header
            OtherReportsDB otherReprtDB = new OtherReportsDB();
            DataTable      reportHeader = new DataTable();

            reportHeader = otherReprtDB.getReportHeader2018();
            ReportDataSource datareportheaderitem = new ReportDataSource(reportdataSetName, reportHeader);

            reportViewer.LocalReport.DataSources.Add(datareportheaderitem);
            return(reportViewer);
        }