public ActionResult TransferenciasPorProducto(ReporteTransferenciasPorProductosFiltrosModel filtros)
 {
     return PartialOrView(filtros);
 }
        public ActionResult GenerarTransferenciasPorProducto(ReporteTransferenciasPorProductosFiltrosModel filtros)
        {
            var reporteFactory = new ReporteFactory();

            var rubro = Uow.Rubros.Obtener(r => r.RubroId == filtros.RubroId);
            var rubroDescripcion = rubro != null ? rubro.Descripcion : TodosText;

            var rubroId = filtros.RubroId.HasValue
                ? filtros.RubroId.Value.ToString()
                : null;

            reporteFactory
                .SetParametro("Desde", filtros.Desde.ToShortDateString(null))
                .SetParametro("Hasta", filtros.Hasta.ToShortDateString(null))
                .SetParametro("CuentaId", UsuarioActual.CuentaId.ToString())
                .SetParametro("RubroId", rubroId)
                .SetParametro("RubroDescripcion", rubroDescripcion);

            if (filtros.MostrarTotalGeneral)
            {
                var transferenciasPorProductoTotalGeneralDataSource =
                    Uow.Reportes.TransferenciasPorProductoTotalGeneral(filtros.Desde,
                        filtros.HastaDiaSiguiente,
                        filtros.RubroId,
                        UsuarioActual.CuentaId);

                reporteFactory.SetPathCompleto(Server.MapPath("~/Reportes/TransferenciaPorProductoTotalGeneral.rdl"))
                    .SetDataSource("TransferenciasPorProductoTotalGeneralDataSet", transferenciasPorProductoTotalGeneralDataSource);
            }
            else
            {
                var transferenciasPorProductoDataSource = Uow.Reportes.TransferenciasPorProducto(filtros.Desde,
                    filtros.HastaDiaSiguiente,
                    filtros.RubroId,
                    filtros.MaxiKioscoOrigenId,
                    filtros.MaxiKioscoDestinoId,
                    UsuarioActual.CuentaId);

                var maxikioscoOrigen = Uow.MaxiKioscos.Obtener(m => m.MaxiKioscoId == filtros.MaxiKioscoOrigenId);
                var maxikioscoOrigenNombre = maxikioscoOrigen != null ? maxikioscoOrigen.Nombre : TodosText;

                var maxikioscoDestino = Uow.MaxiKioscos.Obtener(m => m.MaxiKioscoId == filtros.MaxiKioscoDestinoId);
                var maxikioscoDestinoNombre = maxikioscoDestino != null ? maxikioscoDestino.Nombre : TodosText;

                reporteFactory
                    .SetParametro("MaxikioscoOrigenNombre", maxikioscoOrigenNombre)
                    .SetParametro("MaxikisocoDestinoNombre", maxikioscoDestinoNombre);

                reporteFactory.SetPathCompleto(Server.MapPath("~/Reportes/TransferenciaPorProducto.rdl"))
                    .SetDataSource("TransferenciasPorProductoDataSet", transferenciasPorProductoDataSource);

            }

            byte[] archivo = reporteFactory.Renderizar(filtros.ReporteTipo);

            return File(archivo, reporteFactory.MimeType);
        }