예제 #1
0
        public ActionResult Reporte(ReporteViewModel rVM)
        {
            var sucursales    = _sucServicios.GetAll();
            var articulos     = new List <StockArticuloSucursal>();
            var cabecera      = "";
            var stockCabecera = "";

            if (rVM.StockCero)
            {
                stockCabecera = " (Incluidos art. sin stock.)";
            }
            else
            {
                stockCabecera = " (Sólo art. con stock disponible.)";
            }

            var suc = "";

            foreach (var s in rVM.Sucursales)
            {
                s.Sucursal = sucursales.Where(a => a.Id == s.Sucursal.Id).First();
                if (s.Checked)
                {
                    suc = suc + s.Sucursal.Nombre + " | ";
                    var artSucursal = new List <StockArticuloSucursal>();
                    artSucursal = _stockArticuloSucursalServicios.GetBySucursal(s.Sucursal.Id, rVM.StockCero);
                    articulos.AddRange(artSucursal);
                }
            }

            rVM.CabeceraReporte = cabecera + suc + stockCabecera;
            rVM.Articulos       = articulos;
            return(View("ReportePrint", rVM));
            //  return View(rVM);
        }
        public JsonResult ListarPeriodoCalendario(Int32 PlanOperativoId)
        {
            ReporteViewModel modelo = new ReporteViewModel();

            modelo.lsPeriodoCale = oReporteAD.ListarPeriodoCalexPlanOperativoId(PlanOperativoId);
            return(Json(JsonConvert.SerializeObject(modelo)));
        }
        public ActionResult ReporteGeneralContent(string fechaInicio, string fechaFin, int?idDocente)
        {
            ReporteViewModel model = new ReporteViewModel();

            model.ListaReporteGeneral = reporteDataAccess.GetReporteGeneral(Convert.ToDateTime(fechaInicio), Convert.ToDateTime(fechaFin), idDocente);
            return(PartialView(model));
        }
        public ActionResult ReporteAvanceFiscoCatePresu()
        {
            AvanceInformeAD  handlerAvance = new AvanceInformeAD();
            ReporteViewModel modelo        = new ReporteViewModel();

            modelo.lsPOIs = handlerAvance.ListaPOIVigentesCombo();
            return(View(modelo));
        }
        public ActionResult ReporteDesempenoIndividual()
        {
            AvanceInformeAD  handlerAvance = new AvanceInformeAD();
            ReporteViewModel modelo        = new ReporteViewModel();

            modelo.lsPOIs = handlerAvance.ListaPOIVigentesCombo();
            return(View(modelo));
        }
        public ActionResult ReporteActividadOperativa()
        {
            AvanceInformeAD  handlerAvance = new AvanceInformeAD();
            ReporteViewModel modelo        = new ReporteViewModel();

            //modelo.lsMetas = oReporteAD.ListarMetas();
            modelo.lsPOIs = handlerAvance.ListaPOIVigentesCombo();
            return(View(modelo));
        }
        public ActionResult ReporteAEAO()
        {
            //ReporteViewModel modelo = new ReporteViewModel();
            //modelo.lsAcEst = oReporteAD.ListarAE();

            AvanceInformeAD  handlerAvance = new AvanceInformeAD();
            ReporteViewModel modelo        = new ReporteViewModel();

            modelo.lsPOIs = handlerAvance.ListaPOIVigentesCombo();
            return(View(modelo));
        }
        public ActionResult ListaReporteGeneralPartial(string fechaInicio, string fechaFin, int?idDocente)
        {
            //string fi = DateTime.ParseExact(fechaInicio, "dd/MM/yyyy", CultureInfo.InvariantCulture)
            //            .ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);
            //string ff = DateTime.ParseExact(fechaFin, "dd/MM/yyyy", CultureInfo.InvariantCulture)
            //            .ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);

            ReporteViewModel model = new ReporteViewModel();

            model.ListaReporteGeneral = reporteDataAccess.GetReporteGeneral(Convert.ToDateTime(fechaInicio), Convert.ToDateTime(fechaFin), idDocente);
            return(PartialView(model));
        }
예제 #9
0
        public IActionResult ObtenerReporteAdministradorPorId(int id)
        {
            using (var db = new smafacpyaContext())
            {
                var reporte = db.Reporte.Include(x => x.IdMotivoNavigation)
                              .Include(x => x.IdProyectoNavigation)
                              .Include(x => x.IdEstatusReporteNavigation).AsNoTracking().FirstOrDefault(x => x.Id == id);

                if (reporte == null)
                {
                    return(BadRequest(constantes.reporte.mensajes.reporteNoEncontrado));
                }

                var resultado = new ReporteViewModel
                {
                    Id                     = reporte.Id,
                    Folio                  = reporte.Folio,
                    IdMotivo               = reporte.IdMotivo,
                    IdProyecto             = reporte.IdProyecto,
                    FechaReporte           = reporte.FechaReporte,
                    ComentarioReporte      = reporte.ComentarioReporte,
                    IdEstatusReporte       = reporte.IdEstatusReporte,
                    IdUsuarioAsignacion    = reporte.IdUsuarioAsignacion,
                    FechaAsignacion        = reporte.FechaAsignacion,
                    ComentarioAsignacion   = reporte.ComentarioAsignacion,
                    FechaFinalizacion      = reporte.FechaFinalizacion,
                    ComentarioFinalizacion = reporte.ComentarioFinalizacion,
                    Motivo                 = reporte.IdMotivoNavigation == null ? null : new MotivoViewModel
                    {
                        Id     = reporte.IdMotivoNavigation.Id,
                        Motivo = reporte.IdMotivoNavigation.Motivo1
                    },
                    Proyecto = reporte.IdProyecto == null ? null : new ProyectoViewModel
                    {
                        Id     = reporte.IdProyectoNavigation.Id,
                        Nombre = reporte.IdProyectoNavigation.Nombre
                    },
                    Estatus = reporte.IdEstatusReporteNavigation == null ? null : new EstatusViewModel
                    {
                        Id     = reporte.IdEstatusReporteNavigation.Id,
                        Nombre = reporte.IdEstatusReporteNavigation.Nombre
                    },
                    Usuario = reporte.IdUsuarioAsignacionNavigation == null ? null : new UsuarioViewModel
                    {
                        Id     = reporte.IdUsuarioAsignacionNavigation.Id,
                        Nombre = reporte.IdUsuarioAsignacionNavigation.Nombre
                    }
                };

                return(Ok(resultado));
            }
        }
        private async void GetDataReporteFechas(string url)
        {
            var client   = new HttpClient();
            var response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();
            var jsonResult = await response.Content.ReadAsStringAsync();

            var result = JsonConvert.DeserializeObject <List <ResponseReporteFecha> >(jsonResult);

            reportes = result;

            BindingContext = new ReporteViewModel(result);//para obtener la fuente de datos
        }
예제 #11
0
        public IActionResult AsignarReporte(ReporteViewModel modelo)
        {
            var hoy = DateTime.Now;

            using (var db = new smafacpyaContext())
            {
                var valido = ValidarLogin();
                if (valido != HttpStatusCode.OK)
                {
                    if (valido == HttpStatusCode.Unauthorized)
                    {
                        return(Unauthorized(constantes.mensajes.sesionExpirada));
                    }
                    else
                    {
                        return(BadRequest(constantes.mensajes.error));
                    }
                }
                try
                {
                    var idUsuario = ObtenerUsuarioId();
                    db.Database.BeginTransaction();

                    if (modelo.Id > 0)
                    {
                        var reporte = db.Reporte.FirstOrDefault(x => x.Id == modelo.Id);

                        reporte.IdEstatusReporte = 2;
                        reporte.UsuarioEdicion   = idUsuario;
                        reporte.FechaEdicion     = hoy;
                        //checar esto lo puse setiado por el momento
                        reporte.IdUsuarioAsignacion  = 2;
                        reporte.FechaAsignacion      = modelo.FechaAsignacion;
                        reporte.ComentarioAsignacion = modelo.ComentarioAsignacion;
                    }
                    db.SaveChanges();
                    db.Database.CommitTransaction();
                    return(Ok(constantes.mensajes.registroGuardado));
                }
                catch (Exception ex)
                {
                    db.Database.RollbackTransaction();
                    return(BadRequest(ex.InnerException == null ? ex.Message : ex.InnerException.Message));

                    throw;
                }
            }
        }
 public ActionResult General()
 {
     if (SecurityHelper.GetAdministradorID() > 0 && (SecurityHelper.GetAdministradorRol() == "Administrador General" || SecurityHelper.GetAdministradorRol() == "Técnico"))
     {
         ReporteViewModel model = new ReporteViewModel();
         ViewBag.dateInicio  = this.dateInicio;
         ViewBag.dateFin     = this.dateFin;
         model.FlgConsulta   = 0;
         model.ListaDocentes = docenteDataAccess.GetListaDocentes();
         return(View(model));
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
예제 #13
0
        public List <ReporteViewModel> MostrarVentas()
        {
            var queryLinqJoin = from person in _context.Cliente
                                join sales in _context.Venta on person.Id equals sales.IdCliente
                                select new { name = person.Nombre, lastname = person.Apellidos, code = sales.Id, date = sales.Fecha, amount = sales.MontoTotal };

            _context.SaveChanges();
            List <ReporteViewModel> listSales = new List <ReporteViewModel>();

            foreach (var item in queryLinqJoin)
            {
                ReporteViewModel r = new ReporteViewModel(item.name, item.lastname, item.code, item.date, item.amount);
                listSales.Add(r);
            }

            return(listSales);
        }
예제 #14
0
        public ActionResult Reporte()
        {
            var sucursales       = _sucServicios.GetAll();
            ReporteViewModel rVM = new ReporteViewModel();
            List <SucursalReporteViewModel> lista = new List <SucursalReporteViewModel>();

            foreach (var s in sucursales)
            {
                SucursalReporteViewModel srVM = new SucursalReporteViewModel();
                srVM.Sucursal = s;
                srVM.Checked  = false;
                lista.Add(srVM);
            }
            rVM.Sucursales = lista;
            rVM.StockCero  = false;
            return(View(rVM));
        }
예제 #15
0
        //Generador de reportes por medio del Stored procedure.
        public ActionResult ReportePlanillaFecha(ReporteViewModel reporteVM)
        {
            try
            {
                var reportViewer = new ReportViewer
                {
                    ProcessingMode             = ProcessingMode.Local,
                    ShowExportControls         = true,
                    ShowParameterPrompts       = true,
                    ShowPageNavigationControls = true,
                    ShowRefreshButton          = true,
                    ShowPrintButton            = true,
                    SizeToReportContent        = true,
                    AsyncRendering             = false,
                };
                string rutaReporte = "~/Reports/DatosPlanilla.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_getDatosPlanillaFecha_Result> datosReporte;
                using (BDContext context = new BDContext())
                {
                    datosReporte = context.sp_getDatosPlanillaFecha(reporteVM.fechaPago).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"));
            }
            catch (Exception)
            {
                return(View());
            }
        }
예제 #16
0
        public ActionResult ExportarReporte(ReporteViewModel rVM)
        {
            var sucursales    = _sucServicios.GetAll();
            var articulos     = new List <StockArticuloSucursal>();
            var cabecera      = "";
            var stockCabecera = "";

            if (rVM.StockCero)
            {
                stockCabecera = " (Incluidos art. sin stock.)";
            }
            else
            {
                stockCabecera = " (Sólo art. con stock disponible.)";
            }

            var suc = "";

            foreach (var s in rVM.Sucursales)
            {
                s.Sucursal = sucursales.Where(a => a.Id == s.Sucursal.Id).First();
                if (s.Checked)
                {
                    suc = suc + s.Sucursal.Nombre + " | ";
                    var artSucursal = new List <StockArticuloSucursal>();
                    artSucursal = _stockArticuloSucursalServicios.GetBySucursal(s.Sucursal.Id, rVM.StockCero);
                    articulos.AddRange(artSucursal);
                }
            }

            rVM.CabeceraReporte = cabecera + suc + stockCabecera;
            rVM.Articulos       = articulos;

            var pathFile = FuncionesComunes.GenerateExcelReporteArticulos(FuncionesComunes.ListToDataTable <StockArticuloSucursal>(rVM.Articulos), "StockArticulos", rVM.CabeceraReporte);

            if (!string.IsNullOrEmpty(pathFile))
            {
                HttpResponse response = System.Web.HttpContext.Current.Response;
                FuncionesComunes.ShowFile(pathFile, response);
            }

            return(View("Reporte", rVM));
            //  return View(rVM);
        }
예제 #17
0
        public async Task <IActionResult> Crear([FromBody] ReporteViewModel model)
        {
            try
            {
                foreach (var det in model.registros)
                {
                    var imp = _context.ReportesMes
                              .Include(i => i.impresora)
                              .FirstOrDefault(i => i.impresoraidimpresora == det.impresora.idimpresora && i.month == (det.month - 1) && i.year == det.year);

                    if (imp == null)
                    {
                        return(NotFound());
                    }

                    ReporteMes reporte = new ReporteMes
                    {
                        idreporte            = det.idreporte,
                        contador109          = det.contador109,
                        contador124          = det.contador124,
                        contador102          = det.contador102,
                        vpbyn                = det.contador109 - imp.contador109,
                        vpcolor              = det.contador124 - imp.contador124,
                        year                 = det.year,
                        month                = det.month,
                        impresoraidimpresora = det.impresora.idimpresora
                    };
                    _context.ReportesMes.Add(reporte);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok());
        }
예제 #18
0
        // GET: Reporte
        public ActionResult Generar()
        {
            if (Request.Files.Count == 0)
            {
                return(HttpNotFound());
            }

            var path = GrabarAnexo(Request.Files[0]);

            var socios = new List <Socio>();

            socios = LeerArchivo(path);

            var reporte = new ReporteViewModel();

            reporte.CantidadSocios         = socios.Count();
            reporte.PromedioEdadRacing     = GetEdadPromedioRacing(socios);
            reporte.NombresFrecuentesRiver = GetNombreFrecuentesRiver(socios);
            reporte.SociosCasados          = GetSociosCasados(socios);
            reporte.Equipos = GetEquipos(socios);

            return(View("Reporte", reporte));
        }
예제 #19
0
        public IActionResult GuardarReporte(ReporteViewModel modelo)
        {
            var hoy = DateTime.Now;

            using (var db = new smafacpyaContext())
            {
                var valido = ValidarLogin();
                if (valido != HttpStatusCode.OK)
                {
                    if (valido == HttpStatusCode.Unauthorized)
                    {
                        return(Unauthorized(constantes.mensajes.sesionExpirada));
                    }
                    else
                    {
                        return(BadRequest(constantes.mensajes.error));
                    }
                }
                try
                {
                    var idUsuario = ObtenerUsuarioId();
                    db.Database.BeginTransaction();
                    if (modelo.Id > 0)
                    {
                        var reporte = db.Reporte.FirstOrDefault(x => x.Id == modelo.Id);

                        reporte.IdMotivo               = modelo.IdMotivo;
                        reporte.IdProyecto             = modelo.IdProyecto;
                        reporte.FechaReporte           = modelo.FechaReporte;
                        reporte.ComentarioReporte      = modelo.ComentarioReporte;
                        reporte.UsuarioEdicion         = idUsuario;
                        reporte.FechaEdicion           = hoy;
                        reporte.IdUsuarioAsignacion    = idUsuario;
                        reporte.FechaAsignacion        = modelo.FechaAsignacion;
                        reporte.ComentarioAsignacion   = modelo.ComentarioAsignacion;
                        reporte.FechaFinalizacion      = modelo.FechaFinalizacion;
                        reporte.ComentarioFinalizacion = modelo.ComentarioFinalizacion;
                    }
                    else
                    {
                        var reporte = new Reporte
                        {
                            IdMotivo          = modelo.IdMotivo,
                            IdProyecto        = modelo.IdProyecto,
                            FechaReporte      = modelo.FechaReporte,
                            ComentarioReporte = modelo.ComentarioReporte,
                            IdEstatusReporte  = 1,
                            UsuarioCreacion   = idUsuario,
                            FechaCreacion     = hoy
                        };
                        db.Reporte.Add(reporte);
                        db.SaveChanges();
                        string formato = "RP00";
                        reporte.Folio = string.Concat(formato + reporte.Id.ToString());
                    }
                    db.SaveChanges();
                    db.Database.CommitTransaction();
                    return(Ok(constantes.mensajes.registroGuardado));
                }
                catch (Exception ex)
                {
                    db.Database.RollbackTransaction();
                    return(BadRequest(ex.InnerException == null ? ex.Message : ex.InnerException.Message));

                    throw;
                }
            }
        }
예제 #20
0
 public ActionResult ReportePrint(ReporteViewModel rVM)
 {
     return(View(rVM));
 }