Exemplo n.º 1
0
        public JsonResult GeneraReporte1(int puerto, string fecha_inicio, string fecha_fin, int tipo_ingreso, int empresa)
        {
            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));
            }
            string locacion_html = "";

            try
            {
                locacion_html = Reportes.GetReporte1(puerto, DateTime.Parse(fecha_inicio), DateTime.Parse(fecha_fin), tipo_ingreso, empresa);
                // ls_perfiles = UsuarioPerfiles.GetUsuarioPerfil1(id);
                if (locacion_html == "")
                {
                    respuesta = new { mensaje = "Sin Resultados", html = locacion_html };
                }
                else
                {
                    respuesta = new { mensaje = "", html = locacion_html };
                }

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