public ActionResult CensusAndGraphs(SPCensusGraphs viewModel) { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { //var data = _clPolyClinicDB.getOPProcedureStatistics(viewModel.StartDate, viewModel.EndDate.AddDays(1)); var data = SalesPromoDB.getSPCensusGraph(viewModel.StartDate, viewModel.EndDate.AddDays(1), viewModel.CategoryId); if (data.Rows.Count > 0) { ReportViewerVm reportVM = new ReportViewerVm(); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; if (viewModel.ReportType == ReportType.BARGRAPH) { reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\SalesPromotion\SPCensusGraphs_BarGraph.rdl"; } else if (viewModel.ReportType == ReportType.LINEGRAPH) { reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\SalesPromotion\SPCensusGraphs_LineGraph.rdl"; } else { reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\SalesPromotion\SPCensusGraphs_Table.rdl"; } reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", data)); reportViewer.LocalReport.SetParameters(new ReportParameter("categoryname", viewModel.CategoryName)); reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); 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)); } else { return(Content(Errors.ReportContent("NO RECORDS FOUND"))); } } } return(View()); }
public ActionResult CensusAndGraphs() { var viewModel = new SPCensusGraphs() { StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), ReportTypeList = new List <KeyValuePair <ReportType, string> >() { new KeyValuePair <ReportType, string>(ReportType.DEFAULT, "Default"), new KeyValuePair <ReportType, string>(ReportType.BARGRAPH, "Bar Graph"), new KeyValuePair <ReportType, string>(ReportType.LINEGRAPH, "Line Graph") }, ReportType = ReportType.DEFAULT, CategoryList = MohDB.getMOHCategories() }; return(View(viewModel)); }
public ActionResult DailyCensus(SPCensusGraphs viewModel) { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { //var data = _clPolyClinicDB.getOPProcedureStatistics(viewModel.StartDate, viewModel.EndDate.AddDays(1)); var data = SalesPromoDB.getDailyCensus(viewModel.StartDate, viewModel.StartDate.AddDays(1)); if (data.Rows.Count > 0) { ReportViewerVm reportVM = new ReportViewerVm(); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\SalesPromotion\SPDailyCensus.rdl"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", data)); reportViewer.LocalReport.SetParameters(new ReportParameter("stDate", viewModel.StartDate.ToShortDateString())); reportViewer.LocalReport.SetParameters(new ReportParameter("enDate", viewModel.StartDate.AddDays(1).ToShortDateString())); reportViewer.LocalReport.SetParameters(new ReportParameter("branch", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper())); reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); 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)); } else { return(Content(Errors.ReportContent("NO RECORDS FOUND"))); } } } return(View()); }