// GET: PagoEmpleados public ActionResult Index() { List <PlanillaViewModel> lista = new List <PlanillaViewModel>(); List <sp_CalculoPlanilla_Result> listaSP; PlanillaViewModel planillaVM = new PlanillaViewModel(); using (BDContext context = new BDContext()) { listaSP = context.sp_CalculoPlanilla().ToList(); } foreach (var item in listaSP) { planillaVM = this.Convertir(item); lista.Add(planillaVM); } return(View(lista)); }
//Generador de reportes por medio del Stored procedure. public ActionResult ReportPlanilla() { var reportViewer = new ReportViewer { ProcessingMode = ProcessingMode.Local, ShowExportControls = true, ShowParameterPrompts = true, ShowPageNavigationControls = true, ShowRefreshButton = true, ShowPrintButton = true, SizeToReportContent = true, AsyncRendering = false, }; string rutaReporte = "~/Reports/CalculoPlanillaReport.rdlc"; ///construir la ruta física string rutaServidor = Server.MapPath(rutaReporte); reportViewer.LocalReport.ReportPath = rutaServidor; //reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\ReportCategories.rdlc"; var infoFuenteDatos = reportViewer.LocalReport.GetDataSourceNames(); reportViewer.LocalReport.DataSources.Clear(); List <sp_CalculoPlanilla_Result> datosReporte; using (BDContext context = new BDContext()) { datosReporte = context.sp_CalculoPlanilla().ToList(); } ReportDataSource fuenteDatos = new ReportDataSource(); fuenteDatos.Name = infoFuenteDatos[0]; fuenteDatos.Value = datosReporte; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("PlanillaDataSet", datosReporte)); reportViewer.LocalReport.Refresh(); ViewBag.ReportViewer = reportViewer; return(View("~/Views/Reporte/Report.cshtml")); }