Ejemplo n.º 1
0
        public ActionResult getRegistrationBill(int id)
        {
            try
            {
                var finacialYear = _financialYearAppService.GetActiveFinancialYear();
                var bill         = _billAppService.GetBillForRegistrationByFyr(id, finacialYear);

                ReportViewer reportViewer = new ReportViewer();
                reportViewer.Reset();
                reportViewer.ProcessingMode      = ProcessingMode.Local;
                reportViewer.SizeToReportContent = true;

                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\rptBill.rdlc";

                ReportParameter billId = new ReportParameter("BillId", bill.Id.ToString());
                reportViewer.LocalReport.SetParameters(new ReportParameter[] { billId });
                reportViewer.LocalReport.DataSources.Clear();

                reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DSBill", _billAppService.Print(bill.Id)));
                reportViewer.LocalReport.Refresh();


                reportViewer.ProcessingMode  = ProcessingMode.Local;
                reportViewer.Width           = 1200;
                reportViewer.Height          = 500;
                reportViewer.ShowPrintButton = false;
                reportViewer.ZoomMode        = ZoomMode.FullPage;


                DisableExportOption(reportViewer, "Excel");


                ViewBag.rptBill = reportViewer;
                ViewBag.BillId  = id;

                return(View());
            }
            catch
            {
                TempData["danger"] = string.Format(@"We have detected problems contact the authority!");
                return(RedirectToAction("Index", "Dashboard"));
            }
        }