Exemplo n.º 1
0
        public JsonResult GeneraReporteMov(int puerto, string fecha_inicio, string fecha_fin)
        {
            var respuesta = new { mensaje = "", html = "" };

            if (fecha_inicio == null || fecha_inicio == "")
            {
                respuesta = new { mensaje = "Problema con Fecha Inicio - Revisar", html = "" };
                return(Json(respuesta));
            }
            if (fecha_fin == null || fecha_fin == "")
            {
                respuesta = new { mensaje = "Problema con Fecha Fin - Revisar", html = "" };
                return(Json(respuesta));
            }

            if (DateTime.Parse(fecha_inicio) > DateTime.Parse(fecha_fin))
            {
                respuesta = new { mensaje = "Fecha Inicio no puede ser mayor a Fecha Fin", html = "" };
                return(Json(respuesta));
            }
            if (puerto == 0)
            {
                respuesta = new { mensaje = "debe seleccionar un puerto", html = "" };
                return(Json(respuesta));
            }
            string reporte2 = "";
            string resp     = "";

            try
            {
                reporte2 = Reportes.Getmovimientos(puerto, DateTime.Parse(fecha_inicio), DateTime.Parse(fecha_fin));
                // ls_perfiles = UsuarioPerfiles.GetUsuarioPerfil1(id);
                if (reporte2 == "")
                {
                    resp = "Sin Resultados";
                }

                respuesta = new { mensaje = resp, html = reporte2 };
                return(Json(respuesta));
            }
            catch (Exception ex)
            {
                respuesta = new { mensaje = ex.Message.ToString(), html = "" };
                return(Json(respuesta));
            }
        }