From c54f604b47f43fe9a43b49aa0a4e6a95c0df2b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Fri, 14 Feb 2014 00:18:47 +0100 Subject: [PATCH] =?UTF-8?q?-Cambiado=20el=20alineamiento=20del=20fuente=20?= =?UTF-8?q?en=20varios=20archivos=20-Cambiado=20el=20men=C3=BA=20para=20po?= =?UTF-8?q?der=20elegir=20si=20se=20abre=20en=20la=20misma=20hoja=20en=20u?= =?UTF-8?q?na=20diferente=20-Mantenimiento=20ahora=20el=20contenido=20se?= =?UTF-8?q?=20centra=20en=20la=20p=C3=A1gina.=20-El=20fichero=20pdf=20ahor?= =?UTF-8?q?a=20se=20puede=20grabar=20en=20disco=20y=20se=20puede=20visuali?= =?UTF-8?q?zar=20en=20una=20ventana=20nueva.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AportaContenido.php | 176 +++---- Informe.pdf | Bin 0 -> 4521 bytes InformeInventario.php | 297 ++++++----- InformePDF.php | 14 + Inventario.php | 151 +++--- Mantenimiento.php | 892 +++++++++++++++++----------------- Menu.php | 8 +- inc/inventario.menu | 18 +- plant/principal.html | 20 +- sql/inv2.sql | 168 +++++++ sql/setup.sql | 117 +++++ tmp/inventarioArticulo.xml | 4 +- tmp/prueba.pdf | Bin 4076 -> 0 bytes xml/mantenimientoUsuarios.xml | 27 +- 14 files changed, 1098 insertions(+), 794 deletions(-) create mode 100644 Informe.pdf create mode 100644 sql/inv2.sql create mode 100644 sql/setup.sql delete mode 100644 tmp/prueba.pdf diff --git a/AportaContenido.php b/AportaContenido.php index a71ceb0..34ff22e 100644 --- a/AportaContenido.php +++ b/AportaContenido.php @@ -1,64 +1,73 @@ . - * - */ - -define ('PIE','
GPL v3'. - 'Sitio web creado con Apache'. - 'Gestor de bases de datos mySQL'. - 'PHP Language
'); -define ('FORMULARIO_ACCESO','
'. - 'Usuario


Clave
'. - '

'); -define ('MENSAJE_DEMO','Puede Iniciar sesión con
usuario demo
contraseña demo
'); -define ('USUARIO_INCORRECTO','

'); + +/** + * @package Inventario + * @copyright Copyright (c) 2008, Ricardo Montañana Gómez + * @license http://www.gnu.org/licenses/gpl-3.0.txt + * This file is part of Inventario. + * Inventario is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Inventario is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Inventario. If not, see . + * + */ +define('PIE', '
GPL v3' . + 'Sitio web creado con Apache' . + 'Gestor de bases de datos mySQL' . + 'PHP Language
'); +define('FORMULARIO_ACCESO', '
' . + 'Usuario


Clave
' . + '

'); +define('MENSAJE_DEMO', 'Puede Iniciar sesión con
usuario demo
contraseña demo
'); +define('USUARIO_INCORRECTO', '

'); + // Esta clase aportará el contenido a la plantilla class AportaContenido { + /** * * @var boolean Aporta información sobre si el usuario está registrado o no. */ private $registrado; + /** * @var string Nombre del usuario */ - private $usuario=NULL; - /** + private $usuario = NULL; + + /** * @var Menu Menú de la página. */ private $miMenu; + /** * @var database Controlador de la base de datos */ private $bdd; + /** * @var string Opción elegida por el usuario */ private $opcionActual; - /** + + /** * @var boolean Usuario y clave incorrectos? */ - private $usuario_inc=false; + private $usuario_inc = false; + /** * @var array Permisos del usuario */ private $perfil; + // El constructor necesita saber cuál es la opción actual /** * Constructor de la clase. @@ -68,40 +77,36 @@ class AportaContenido { * @param array $perfil Permisos de acceso del usuario * @param String $opcion Opción elegida por el usuario */ - public function __construct($baseDatos,$registrado,$usuario,$perfil,$opcion) - { - $this->bdd=$baseDatos; - $this->miMenu=new Menu('inc/inventario.menu'); - $this->registrado=$registrado; - $this->usuario=$usuario; - $this->perfil=$perfil; - $this->opcionActual=$opcion; + public function __construct($baseDatos, $registrado, $usuario, $perfil, $opcion) { + $this->bdd = $baseDatos; + $this->miMenu = new Menu('inc/inventario.menu'); + $this->registrado = $registrado; + $this->usuario = $usuario; + $this->perfil = $perfil; + $this->opcionActual = $opcion; } + /** * Devuelve la fecha actual * @param string $formato formato de devolución de la fecha * @param string $idioma idioma para formatear la fecha, p.ej. es_ES * @return string */ - public function fechaActual($formato='',$idioma='es_ES') - { - if ($formato=='') - $formato="%d-%b-%Y %H:%M"; - setlocale(LC_TIME,$idioma); + public function fechaActual($formato = '', $idioma = 'es_ES') { + if ($formato == '') + $formato = "%d-%b-%Y %H:%M"; + setlocale(LC_TIME, $idioma); return strftime($formato); } + /** * * @return string Mensaje el usuario debe registrarse. */ - private function mensajeRegistro() - { - /** - * @todo: tarea de prueba - */ + private function mensajeRegistro() { return 'Debe registrarse para acceder a este apartado'; } - + // Procesaremos todas las invocaciones a métodos en // la función __call() /** @@ -110,9 +115,8 @@ class AportaContenido { * @param string $parametros Parámetros del método * @return string Contenido devuelto por el método */ - public function __call($metodo,$parametros) - { - switch($metodo) { // Dependiendo del método invocado + public function __call($metodo, $parametros) { + switch ($metodo) { // Dependiendo del método invocado case 'titulo': // devolvemos el título return APLICACION; case 'usuario': @@ -126,7 +130,7 @@ class AportaContenido { if ($this->registrado) { return $this->miMenu->insertaMenu(); } else { - $salida=FORMULARIO_ACCESO; + $salida = FORMULARIO_ACCESO; if ($this->usuario_inc) { $salida.=USUARIO_INCORRECTO; } @@ -134,8 +138,8 @@ class AportaContenido { return $salida; } case 'opcion': - list($opcion,$parametro)=explode("&",$this->opcionActual); - switch($opcion) { + list($opcion, $parametro) = explode("&", $this->opcionActual); + switch ($opcion) { case 'bienvenido': return "Menú Principal"; case 'principal': @@ -145,7 +149,7 @@ class AportaContenido { case 'ubicaciones': case 'usuarios': case 'test': - return "Mantenimiento de ".ucfirst($opcion)."."; + return "Mantenimiento de " . ucfirst($opcion) . "."; case 'configuracion': return 'Configuración y Preferencias.'; case 'informeInventario':return "Informe de Inventario"; @@ -160,70 +164,70 @@ class AportaContenido { // Para incluir el contenido central de la página case 'contenido': // tendremos en cuenta cuál es la opción actual - /*echo "opcActual=$this->opcActual
"; - echo "Metodo=$Metodo
"; - print_r($Parametros);*/ + /* echo "opcActual=$this->opcActual
"; + echo "Metodo=$Metodo
"; + print_r($Parametros); */ // if (!$this->registrado) { // return $this->mensajeRegistro(); // } - list($opcion,$parametro)=explode("&",$this->opcionActual); - switch($opcion) { + list($opcion, $parametro) = explode("&", $this->opcionActual); + switch ($opcion) { case 'principal': // contenido inicial - return '

'.PROGRAMA.''. - '


'.PIE; + return '

' . PROGRAMA . '' . + '


' . PIE; case 'articulos': case 'ubicaciones': case 'test': case 'elementos': if ($this->perfil['Consulta']) { - $ele=new Mantenimiento($this->bdd,$this->perfil,$opcion); + $ele = new Mantenimiento($this->bdd, $this->perfil, $opcion); return $ele->ejecuta(); } else { return $this->mensajePermisos(ucfirst($opcion)); } case 'usuarios': if ($this->perfil['Usuarios']) { - $ele=new Mantenimiento($this->bdd,$this->perfil,$opcion); + $ele = new Mantenimiento($this->bdd, $this->perfil, $opcion); return $ele->ejecuta(); } else { return $this->mensajePermisos('Usuarios'); } - + case 'bienvenido': // El usuario quiere iniciar sesión - return 'Bienvenido '.$this->usuario.'

'.PROGRAMA.''. - '


'.PIE; + return 'Bienvenido ' . $this->usuario . '

' . PROGRAMA . '' . + '


' . PIE; case 'configuracion': if ($this->perfil['Config']) { - $conf=new Configuracion(); + $conf = new Configuracion(); return $conf->ejecuta(); } else { return $this->mensajePermisos('Configuracion'); } case 'informeInventario': if ($this->perfil['Informe']) { - $info=new InformeInventario($this->bdd); + $info = new InformeInventario($this->bdd); return $info->ejecuta(); } else { return $this->mensajePermisos('Informes'); } case 'descuadres': if ($this->perfil['Informe']) { - $enlace='xml/informe'.ucfirst($opcion).'.xml'; - $informe=new InformePDF($this->bdd,$enlace,$this->registrado); - $informe->imprimeInforme(); - return; + $enlace = 'xml/informe' . ucfirst($opcion) . '.xml'; + $informe = new InformePDF($this->bdd, $enlace, $this->registrado); + $informe->imprimeInforme(); + return; } else { return $this->mensajePermisos('Informes'); } } // Fin del contenido case 'usuario_incorrecto': - $this->usuario_inc=true; - return; + $this->usuario_inc = true; + return; case 'registro': // Si está registrado mostrar bienvenida // si no, un enlace - if($this->bEstaRegistrado) { - return "Bienvenido $this->sUsuario
". - 'Cerrar sesión'; + if ($this->bEstaRegistrado) { + return "Bienvenido $this->sUsuario
" . + 'Cerrar sesión'; } else { return ''; } @@ -231,14 +235,16 @@ class AportaContenido { return "Marca {$metodo} queda sin procesar"; } } + /** * * @param string $tipo * @return string */ - public function mensajePermisos($tipo) - { - return "

No tiene permiso para acceder a ".$tipo."

"; + public function mensajePermisos($tipo) { + return "

No tiene permiso para acceder a " . $tipo . "

"; } + } + ?> diff --git a/Informe.pdf b/Informe.pdf new file mode 100644 index 0000000000000000000000000000000000000000..54361da73ec7cb47ff4ea3cc4ebb1e412abcb1a2 GIT binary patch literal 4521 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. - * - */ - class InformeInventario { - private $bdd; - public function __construct($baseDatos) - { - $this->bdd=$baseDatos; - } - public function ejecuta() - { - $opc=$_GET['opc']; - switch ($opc) { - case 'Ubicacion':return $this->formularioUbicacion(); - case 'listarUbicacion':return $this->listarUbicacion(); - case 'listarArticulo':return $this->listarArticulo(); - case 'Articulo':return $this->formularioArticulo(); - case 'Total':return $this->inventarioTotal(); - } - } - private function listarUbicacion() - { - $fichero="xml/inventarioUbicacion.xml"; - $salida="tmp/inventarioUbicacion.xml"; - $plantilla=file_get_contents($fichero) - or die('Fallo en la apertura de la plantilla '.$fichero); - $comando="select * from Ubicaciones where id='".$_POST['id']."';"; - $resultado=$this->bdd->ejecuta($comando); - if (!$resultado) { - return $this->bdd->mensajeError($comando); - } - $fila=$this->bdd->procesaResultado(); - $plantilla=str_replace("{id}",$_POST['id'],$plantilla); - $plantilla=str_replace("{Descripcion}",utf8_encode($fila['Descripcion']),$plantilla); - file_put_contents($salida,$plantilla) - or die('Fallo en la escritura de la plantilla '.$salida); - $informe=new InformePDF($this->bdd,$salida,true); - $informe->imprimeInforme(); - } - private function listarArticulo() - { - $fichero="xml/inventarioArticulo.xml"; - $salida="tmp/inventarioArticulo.xml"; - $plantilla=file_get_contents($fichero) - or die('Fallo en la apertura de la plantilla '.$fichero); - $comando="select * from Articulos where id='".$_POST['id']."';"; - $resultado=$this->bdd->ejecuta($comando); - if (!$resultado) { - return $this->bdd->mensajeError($comando); - } - $fila=$this->bdd->procesaResultado(); - $plantilla=str_replace("{id}",$_POST['id'],$plantilla); - $plantilla=str_replace("{Descripcion}",utf8_encode($fila['descripcion']),$plantilla); - $plantilla=str_replace("{Marca}",utf8_encode($fila['marca']),$plantilla); - $plantilla=str_replace("{Modelo}",utf8_encode($fila['modelo']),$plantilla); - file_put_contents($salida,$plantilla) - or die('Fallo en la escritura de la plantilla '.$salida); - $informe=new InformePDF($this->bdd,$salida,true); - $informe->imprimeInforme(); - } - private function listaUbicaciones() - { - $salida="\n"; - return $salida; - } - private function listaArticulos() - { - $salida="\n"; - return $salida; - } - private function formulario($accion,$etiqueta,$lista) - { - $salida='
'."\n"; - $salida.="

Elige $etiqueta\n"; - $salida.="

"; - $salida.=$lista; - $salida.="

"; - $salida.='


'."\n"; - return $salida; - } - private function formularioUbicacion() - { - //Genera un formulario con las ubicaciones disponibles. - $accion="index.php?informeInventario&opc=listarUbicacion"; - return $this->formulario($accion,'Ubicación',$this->listaUbicaciones()); - } - private function formularioArticulo() - { - $accion="index.php?informeInventario&opc=listarArticulo"; - return $this->formulario($accion,'Artículo',$this->listaArticulos()); - } - private function inventarioTotal() - { - $fichero="xml/inventarioUbicacion.xml"; - $salida="tmp/inventarioUbicacion.xml"; - $comando="select * from Ubicaciones ;"; - $resultado=$this->bdd->ejecuta($comando); - if (!$resultado) { - return $this->bdd->mensajeError($comando); - } - $salidaTotal=''; - while ($fila=$this->bdd->procesaResultado()) { - //$fila=$this->bdd->procesaResultado(); - $plantilla=file_get_contents($fichero) - or die('Fallo en la apertura de la plantilla '.$fichero); - $plantilla=str_replace("{id}",$fila['id'],$plantilla); - $plantilla=str_replace("{Descripcion}",utf8_encode($fila['Descripcion']),$plantilla); - file_put_contents($salida,$plantilla) - or die('Fallo en la escritura de la plantilla '.$salida); - $informe=new InformePDF($this->bdd,$salida,true); - $salidaTotal.=$informe->getContenido(); - } - file_put_contents("tmp/prueba.pdf",$salidaTotal); - $informe->enviaCabecera(); - echo $salidaTotal; +/** + * @package Inventario + * @copyright Copyright (c) 2008, Ricardo Montañana Gómez + * @license http://www.gnu.org/licenses/gpl-3.0.txt + * This file is part of Inventario. + * Inventario is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Inventario is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Inventario. If not, see . + * + */ +class InformeInventario { + + private $bdd; + + public function __construct($baseDatos) { + $this->bdd = $baseDatos; + } + + public function ejecuta() { + $opc = $_GET['opc']; + switch ($opc) { + case 'Ubicacion':return $this->formularioUbicacion(); + case 'listarUbicacion':return $this->listarUbicacion(); + case 'listarArticulo':return $this->listarArticulo(); + case 'Articulo':return $this->formularioArticulo(); + case 'Total':return $this->inventarioTotal(); } } + + private function listarUbicacion() { + $fichero = "xml/inventarioUbicacion.xml"; + $salida = "tmp/inventarioUbicacion.xml"; + $plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero); + $comando = "select * from Ubicaciones where id='" . $_POST['id'] . "';"; + $resultado = $this->bdd->ejecuta($comando); + if (!$resultado) { + return $this->bdd->mensajeError($comando); + } + $fila = $this->bdd->procesaResultado(); + $plantilla = str_replace("{id}", $_POST['id'], $plantilla); + $plantilla = str_replace("{Descripcion}", utf8_encode($fila['Descripcion']), $plantilla); + file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida); + $informe = new InformePDF($this->bdd, $salida, true); + $informe->guardaArchivo("Informe.pdf"); + echo ''; + } + + private function listarArticulo() { + $fichero = "xml/inventarioArticulo.xml"; + $salida = "tmp/inventarioArticulo.xml"; + $plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero); + $comando = "select * from Articulos where id='" . $_POST['id'] . "';"; + $resultado = $this->bdd->ejecuta($comando); + if (!$resultado) { + return $this->bdd->mensajeError($comando); + } + $fila = $this->bdd->procesaResultado(); + $plantilla = str_replace("{id}", $_POST['id'], $plantilla); + $plantilla = str_replace("{Descripcion}", utf8_encode($fila['descripcion']), $plantilla); + $plantilla = str_replace("{Marca}", utf8_encode($fila['marca']), $plantilla); + $plantilla = str_replace("{Modelo}", utf8_encode($fila['modelo']), $plantilla); + file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida); + $informe = new InformePDF($this->bdd, $salida, true); + $informe->guardaArchivo("Informe.pdf"); + echo ''; + } + + private function listaUbicaciones() { + $salida = "\n"; + return $salida; + } + + private function listaArticulos() { + $salida = "\n"; + return $salida; + } + + private function formulario($accion, $etiqueta, $lista) { + $salida = '' . "\n"; + $salida.="

Elige $etiqueta\n"; + $salida.="

"; + $salida.=$lista; + $salida.="

"; + $salida.='


' . "\n"; + return $salida; + } + + private function formularioUbicacion() { + //Genera un formulario con las ubicaciones disponibles. + $accion = "index.php?informeInventario&opc=listarUbicacion"; + return $this->formulario($accion, 'Ubicación', $this->listaUbicaciones()); + } + + private function formularioArticulo() { + $accion = "index.php?informeInventario&opc=listarArticulo"; + return $this->formulario($accion, 'Artículo', $this->listaArticulos()); + } + + private function inventarioTotal() { + $fichero = "xml/inventarioUbicacion.xml"; + $salida = "tmp/inventarioUbicacion.xml"; + $comando = "select * from Ubicaciones ;"; + $resultado = $this->bdd->ejecuta($comando); + if (!$resultado) { + return $this->bdd->mensajeError($comando); + } + $salidaTotal = ''; + while ($fila = $this->bdd->procesaResultado()) { + //$fila=$this->bdd->procesaResultado(); + $plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero); + $plantilla = str_replace("{id}", $fila['id'], $plantilla); + $plantilla = str_replace("{Descripcion}", utf8_encode($fila['Descripcion']), $plantilla); + file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida); + $informe = new InformePDF($this->bdd, $salida, true); + $salidaTotal.=$informe->getContenido(); + } + file_put_contents("tmp/prueba.pdf", $salidaTotal); + $informe->enviaCabecera(); + echo $salidaTotal; + } + +} + ?> diff --git a/InformePDF.php b/InformePDF.php index ac5b941..778705e 100644 --- a/InformePDF.php +++ b/InformePDF.php @@ -82,6 +82,20 @@ { return $this->docu; } + public function getCabecera() + { + $cabecera = "Content-type: application/pdf"; + $cabecera = $cabecera . "Content-length: " . strlen($this->docu); + $cabecera = $cabecera . "Content-Disposition: inline; filename=Informe.pdf"; + return $cabecera; + } + public function guardaArchivo($nombre = "Informe.pdf") + { + $fichero = fopen($nombre, "w"); + fwrite($fichero,$this->getCabecera()); + fwrite($fichero,$this->getContenido(), strlen($this->getContenido())); + fclose($fichero); + } public function enviaCabecera() { header("Content-type: application/pdf"); diff --git a/Inventario.php b/Inventario.php index 904d489..06b3b3c 100644 --- a/Inventario.php +++ b/Inventario.php @@ -1,4 +1,5 @@ @@ -21,62 +22,63 @@ * along with Inventario. If not, see . * */ - // Clase del objeto principal de la aplicación +// Clase del objeto principal de la aplicación class Inventario { + // Declaración de miembros private $bdd; // Enlace con el SGBD private $registrado; // Usuario registrado s/n - private $usuario=NULL; // Nombre del usuario + private $usuario = NULL; // Nombre del usuario private $clave; //contraseña del usuario private $opcActual; // Opción elegida por el usuario private $perfil; //Permisos del usuario. private $estado; //BD conectada o no - private $plant='plant/principal.html'; + private $plant = 'plant/principal.html'; + // Constructor - public function __construct() - { + public function __construct() { // Analizamos la cadena de solicitud para saber // qué opción es la actual - $this->opcActual=$_SERVER['QUERY_STRING']=='' ? 'principal' : $_SERVER['QUERY_STRING']; + $this->opcActual = $_SERVER['QUERY_STRING'] == '' ? 'principal' : $_SERVER['QUERY_STRING']; // Iniciamos una sesión session_start(); //Conexión con la base de datos. - $this->bdd=new Sql(SERVIDOR,USUARIO,CLAVE,BASEDATOS); + $this->bdd = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS); if ($this->bdd->error()) { echo '

Fallo al conectar con el servidor MySQL.

'; - echo SERVIDOR;echo "Servidor [ ". SERVIDOR ." ] usuario [".USUARIO."] clave [".CLAVE."] base [".BASEDATOS."]"; - $this->estado=false; + echo SERVIDOR; + echo "Servidor [ " . SERVIDOR . " ] usuario [" . USUARIO . "] clave [" . CLAVE . "] base [" . BASEDATOS . "]"; + $this->estado = false; return; } else { - $this->estado=true; + $this->estado = true; } // Comprobamos si el usuario ya está registrado en esta sesión - $this->registrado=isset($_SESSION['Registrado']); - if($this->registrado) {// si está... + $this->registrado = isset($_SESSION['Registrado']); + if ($this->registrado) {// si está... // recuperamos el nombre del usuario - $this->usuario=$_SESSION['Usuario']; - $this->perfil=$_SESSION['Perfil']; - // en caso contrario comprobamos si tiene la cookie que le identifica como usuario - } elseif(isset($_COOKIE['InventarioId'])) { + $this->usuario = $_SESSION['Usuario']; + $this->perfil = $_SESSION['Perfil']; + // en caso contrario comprobamos si tiene la cookie que le identifica como usuario + } elseif (isset($_COOKIE['InventarioId'])) { // y usamos el Id para recuperar el nombre de la base de ddtos $this->recuperaNombreConId($_COOKIE['InventarioId']); } else { // en caso contrario el usuario no está registrado - $this->usuario=''; + $this->usuario = ''; } } - public function estado() - { + + public function estado() { return $this->estado; } - + // Esta función pondrá en marcha la aplicación ocupándose // de las acciones que no generan contenido, esto es // iniciar sesión, cerrarla, etc. - public function Ejecuta() - { + public function Ejecuta() { // Dependiendo de la opción a procesar - switch($this->opcActual) { - // El usuario quiere cerrar la sesión actual + switch ($this->opcActual) { + // El usuario quiere cerrar la sesión actual case 'cerrarSesion': // Eliminamos los datos de sesión session_unset(); @@ -86,77 +88,77 @@ class Inventario { setcookie('InventarioId', ''); // y le redirigmos a la página inicial header('Location: index.php'); - exit; + exit; // El usuario quiere iniciar sessión case 'registrarse': // Se identifica como usuario de la aplicación - $resultado=$this->usuarioRegistrado(); + $resultado = $this->usuarioRegistrado(); // Si lo obtuvimos es que el usuario está registrado - if($resultado) { + if ($resultado) { // establecemos las variables de sesión $_SESSION['Registrado'] = true; $_SESSION['Usuario'] = $this->usuario; $_SESSION['Perfil'] = $this->perfil; // y enviamos la cookie para reconocerlo la próxima vez - setcookie('InventarioId', $resultado, time()+3600*24*365); + setcookie('InventarioId', $resultado, time() + 3600 * 24 * 365); // Lo enviamos a la página de bienvenida header('Location: index.php?bienvenido'); exit; - } + } //Usuario incorrecto header('location:index.php?usuario_incorrecto'); exit; - case 'usuario_incorrecto': - $this->opcActual="principal"; - $contenido=$this->creaContenido(); - $contenido->usuario_incorrecto(); - $salida=new Distribucion($this->plant,$contenido); - echo $salida->procesaPlantilla(); - break; + case 'usuario_incorrecto': + $this->opcActual = "principal"; + $contenido = $this->creaContenido(); + $contenido->usuario_incorrecto(); + $salida = new Distribucion($this->plant, $contenido); + echo $salida->procesaPlantilla(); + break; default: // Creamos un objeto Distribución facilitándole el // nombre del archivo plantilla y el objeto que aportará // el contenido - $opc=$_GET['opc']; - list($opcion,$parametro)=explode("&",$this->opcActual); + $opc = $_GET['opc']; + list($opcion, $parametro) = explode("&", $this->opcActual); switch ($opc) { case 'informe': - $enlace='xml/informe'.ucfirst($opcion).'.xml'; + $enlace = 'xml/informe' . ucfirst($opcion) . '.xml'; //$enlace="tmp/inventarioUbicacion.xml"; - $informe=new InformePDF($this->bdd,$enlace,$this->registrado); - $informe->imprimeInforme(); + $informe = new InformePDF($this->bdd, $enlace, $this->registrado); + $informe->imprimeInforme(); return; default: - $salida=new Distribucion($this->plant,$this->creaContenido()); + $salida = new Distribucion($this->plant, $this->creaContenido()); echo $salida->procesaPlantilla(); break; } - } + } } - private function creaContenido() - { - return new AportaContenido($this->bdd,$this->registrado,$this->usuario,$this->perfil,$this->opcActual); + + private function creaContenido() { + return new AportaContenido($this->bdd, $this->registrado, $this->usuario, $this->perfil, $this->opcActual); } + // Esta función comprueba si el usuario está o no registrado, // devolviendo su IdSesion en caso afirmativo o false // en caso contrario - private function usuarioRegistrado() - { - $this->usuario=$_POST['usuario']; - $this->clave=$_POST['clave']; + private function usuarioRegistrado() { + $this->usuario = $_POST['usuario']; + $this->clave = $_POST['clave']; // ejecuta la consulta para buscar el usuario - $res=$this->bdd->ejecuta("SELECT * FROM Usuarios WHERE nombre='$this->usuario'"); + $res = $this->bdd->ejecuta("SELECT * FROM Usuarios WHERE nombre='$this->usuario'"); // Si no hemos encontrado el usuario - if(!$res) { + if (!$res) { return false; // devolvemos FALSE } // En caso contrario obtenemos en una matriz // los datos de las columnas - $fila=$this->bdd->procesaResultado(); + $fila = $this->bdd->procesaResultado(); // Para comprobar si la clave coincide - if($fila['clave']==$this->clave) { - $this->perfil=$this->creaPerfil($fila); + if ($fila['clave'] == $this->clave) { + $this->perfil = $this->creaPerfil($fila); // caso en el que devolveremos un Id de sesión // único para este usuario return $fila['idSesion']; @@ -165,43 +167,44 @@ class Inventario { // la clave no es correcta return false; } - private function creaPerfil($fila) - { - return array("Consulta"=>$fila['consulta'],"Modificacion"=>$fila['modificacion'], - "Alta"=>$fila['alta'],"Borrado"=>$fila['borrado'],"Informe"=>$fila['informe'], - "Usuarios"=>$fila['usuarios'],"Config"=>$fila['config']); + + private function creaPerfil($fila) { + return array("Consulta" => $fila['consulta'], "Modificacion" => $fila['modificacion'], + "Alta" => $fila['alta'], "Borrado" => $fila['borrado'], "Informe" => $fila['informe'], + "Usuarios" => $fila['usuarios'], "Config" => $fila['config']); } + // Esta función intenta recuperar el nombre del usuario // a partir del Id de sesión almacenado en una cookie, // dejando las variables Registrado y Usuario con // los valores apropiados // @param String Identificador de sesión del usuario actual - private function recuperaNombreConId($idSesion) - { + private function recuperaNombreConId($idSesion) { // para ejecutar la consulta para buscar el Id de sesión - $res=$this->bdd->ejecuta("SELECT * FROM Usuarios WHERE idSesion='$idSesion'"); + $res = $this->bdd->ejecuta("SELECT * FROM Usuarios WHERE idSesion='$idSesion'"); // Si no hemos encontrado el ID - if(!$res) { - // el usuario no está registrado - $this->usuario=''; - $this->registrado=false; + if (!$res) { + // el usuario no está registrado + $this->usuario = ''; + $this->registrado = false; } else { // En caso contrario obtenemos en una matriz // los datos de las columnas - $fila=$this->bdd->procesaResultado(); + $fila = $this->bdd->procesaResultado(); // Asignamos el nombre - $this->usuario=$fila['nombre']; + $this->usuario = $fila['nombre']; // damos el valor TRUE a bRegistrado - $this->registrado=true; + $this->registrado = true; // y establecemos las variables de sessión para no tener // que efectuar todo este proceso de nuevo con cada // solicitud de página - $_SESSION['Registrado']=true; - $_SESSION['Usuario']=$this->usuario; - $this->perfil=$this->creaPerfil($fila); - $_SESSION['Perfil']=$this->perfil; + $_SESSION['Registrado'] = true; + $_SESSION['Usuario'] = $this->usuario; + $this->perfil = $this->creaPerfil($fila); + $_SESSION['Perfil'] = $this->perfil; } } + } ?> diff --git a/Mantenimiento.php b/Mantenimiento.php index 270bd57..0de2ffd 100644 --- a/Mantenimiento.php +++ b/Mantenimiento.php @@ -1,447 +1,457 @@ . - * - */ - //Clase que se encargará de manejar los elementos del modelo de datos. - define ('EDICION','Edición'); - define ('BORRADO','Borrado'); - define ('ANADIR','Inserción'); - class Mantenimiento { - private $descripcion; - protected $bdd; - protected $url; - protected $cabecera; - protected $tabla; - protected $cadenaBusqueda; - protected $campos=array(); - protected $foraneas=array(); - protected $campoBusca="Descripcion"; - protected $comandoConsulta=""; - protected $perfil; - public function __construct($baseDatos,$perfil,$nombre) - { - $this->bdd=$baseDatos; - $this->url="index.php?$nombre&opc=inicial"; - $this->cabecera='Location: '.$this->url; - $this->tabla=ucfirst($nombre); - $this->perfil=$perfil; - } - public function ejecuta() - { - $opc=$_GET['opc']; - $id=$_GET['id']; - $orden=isset($_GET['orden'])?$_GET['orden']:''; - $sentido=isset($_GET['sentido'])?$_GET['sentido']:'asc'; - //Sólo tiene sentido para las modificaciones. - //Es la página donde estaba el registro - $pag=isset($_GET['pag'])?$_GET['pag']:'0'; - $this->cadenaBusqueda=$_GET['buscar']; - $this->obtenerCampos(); - $this->obtieneClavesForaneas(); - switch ($opc) { - case 'inicial':return $this->consulta($id,$orden,$sentido); - case 'editar':return $this->muestra($id,EDICION,$pag,$orden,$sentido); - case 'eliminar':return $this->muestra($id,BORRADO); - case 'nuevo':return $this->muestra(null,ANADIR); - case 'insertar':return $this->insertar(); - case 'modificar':return $this->modificar($id,$pag,$orden,$sentido); - case 'borrar':return $this->borrar($id); - default:return 'La clase Mantenimiento No entiende lo solicitado.'; - } - } - protected function obtieneClavesForaneas() - { - $salida=null; - foreach($this->campos as $clave => $valor) { - $trozos=explode(",",$valor["Comment"]); - foreach($trozos as $trozo) { - if (strstr($trozo,"foreign")) { - $temp=substr($trozo,8,-1); - list($tabla,$atributos)=explode("->",$temp); - list($clave,$resto)=explode(";",$atributos); - //Quita el paréntesis final - $atributos=substr($atributos,0,-1); - $salida[$valor['Campo']]=$tabla.",".$resto; - } - } - } - $this->foraneas=$salida; - } - private function consulta($pagina,$orden,$sentido) - { - //Calcula los números de página anterior y siguiente. - $pagina=$pagina+0; - $pagSigte=$pagina<=0?1:$pagina+1; - $pagAnt=$pagSigte-2; - $pagFwd=$pagSigte+3; - $pagRew=$pagAnt-3<0?$pagAnt:$pagAnt-3; - //Trata con la cadena de búsqueda - $this->cadenaBusqueda=isset($_POST['buscar'])?$_POST['buscar']:$this->cadenaBusqueda; - if (isset($this->cadenaBusqueda) && strlen($this->cadenaBusqueda)) { - $sufijo=" where $this->campoBusca like '%".$this->bdd->filtra($this->cadenaBusqueda)."%'"; - $sufijoEnlace="&buscar=".$this->cadenaBusqueda; - $comando=str_replace('{buscar}',$sufijo,$this->comandoConsulta); - } else { - $comando=str_replace('{buscar}','',$this->comandoConsulta); - } - //Trata con el orden de mostrar los datos - if (strlen($orden)>0) { - $comando=str_replace('{orden}',"order by ".$orden." ".$sentido,$comando); - $sufijoOrden="&orden=".$orden."&sentido=".$sentido; - } else { - $comando=str_replace('{orden}',' ',$comando); - } - //Introduce un botón para hacer búsquedas - $salida=$this->enlaceBusqueda(); - $salida.=$this->cabeceraTabla(); - //Consulta paginada de todas las tuplas - $comando=str_replace('{inferior}',($pagAnt+1)*NUMFILAS,$comando); - $comando=str_replace('{superior}',NUMFILAS,$comando); - //$salida.=$comando; - $salida.='

Página '.$pagSigte.'

'; - $tabla=strtolower($this->tabla); - $this->bdd->ejecuta($comando); - if ($this->bdd->numeroTuplas()==0) { - if ($pagSigte>1) { - // Si no hay datos en la consulta y no es la primera página, - // carga la página inicial - header('Location: '.$this->url); - } else { - $salida="

No hay registros


"; - } - } - //$salida.=print_r($this->perfil); - while($fila=$this->bdd->procesaResultado()) { - $salida.=""; - foreach ($fila as $clave => $valor) { - if ($clave=="id") { - $id=$valor; - } - - $salida.="$valor\n"; - } - //Añade el icono de editar - if ($this->perfil['Modificacion']) { - $salida.='editar'; - } - //Añade el icono de eliminar - if ($this->perfil['Borrado']) { - $salida.='  eliminar'."\n"; - } - } - $salida.="

"; - //Añade botones de comandos - $enlace='\"anterior\"\n"; - $siguiente=$enlace.$pagSigte.$sufijoEnlace."\">\"siguiente\"\n"; - $fwd=$enlace.$pagFwd.$sufijoEnlace."\">\"siguiente\"\n"; - $rew=$enlace.$pagRew.$sufijoEnlace."\">\"siguiente\"\n"; - if (strlen($orden)>0) { - $az='asc'; - $za='desc'; - } else { - $az=$za=''; - } - if ($this->perfil['Informe']) { - $informe='informe'; - } else { - $informe=""; - } - } - if ($this->perfil['Alta']) { - $anadir=''. - 'nuevo'; - } else { - $anadir=""; - } - $salida.='

'. - "$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd

"; - return $salida; - } - private function enlaceBusqueda() - { - $salida='

'; - $salida.='

cadenaBusqueda.'" size="40" />
'; - $salida.='

'; - return $salida; - } - protected function borrar($id) - { - $comando="delete from ".$this->tabla." where id=\"$id\""; - if (!$this->bdd->ejecuta($comando)) { - return $this->errorBD($comando); - } - header('Location: '.$this->url); - return; - } - protected function insertar() - { - $comando="insert into ".$this->tabla." ("; - $lista=explode("&",$_POST['listacampos']); - $primero=true; - //Añade la lista de campos - foreach ($lista as $campo) { - if ($campo=="") { - continue; - } - if ($primero) { - $primero=false; - $coma=" "; - } else { - $coma=","; - } - $comando.="$coma $campo"; - } - $comando.=") values ("; - //Añade la lista de valores - $primero=true; - foreach ($lista as $campo) { - if ($campo=="") - continue; - if ($primero) { - $primero=false; - $coma=" "; - } else { - $coma=","; - } - $comando.="$coma \"$_POST[$campo]\""; - } - $comando.=")"; - if (!$this->bdd->ejecuta($comando)) { - return $this->errorBD($comando); - } - list($enlace,$resto)=explode("&",$this->url); - $enlace.="&opc=inicial"; - return "

Se ha insertado el registro con la clave ".$this->bdd->ultimoId()."

"; - } - protected function modificar($id,$pag,$orden,$sentido) - { - //Los datos a utilizar para actualizar la tupla vienen en $_POST. - //La lista de atributos de la tupla viene en el campo oculto listacampos - //print_r($_GET); - //echo "id=$id pag=$pag orden=$orden sentido=$sentido";die(); - $comando="update ".$this->tabla." set "; - $lista=explode("&",$_POST['listacampos']); - $primero=true; - foreach ($lista as $campo) { - if ($campo=="id" || $campo=="") - continue; - if ($primero) { - $primero=false; - $coma=" "; - } else - $coma=","; - if (strlen(trim($_POST[$campo]))==0) - $comando.="$coma $campo=null"; - else - $comando.=$coma.' '.$campo.'="'.$_POST[$campo].'"'; - } - $comando.=" where id=\"$id\""; - if (!$this->bdd->ejecuta($comando)) { - return $this->errorBD($comando); - } - - list($enlace,$resto)=explode("&",$this->url); - $enlace.="&opc=inicial&orden=".$orden."&sentido=".$sentido."&id=".$pag; - header('Location: '.$enlace); - return; - } - protected function muestra($id,$tipoAccion,$pag="",$orden="",$sentido="") - { - if (isset($id)) { - $comando="select * from ".$this->tabla." where id='$id'"; - $resultado=$this->bdd->ejecuta($comando); - if (!$resultado) { - return $this->errorBD("","No se han podido encontrar datos del identificador $id"); - } - $fila=$this->bdd->procesaResultado(); - } else { - $fila=null; - } - //list($tipo,$valor)=explode($columna["Type"]); - $accion="index.php?".strtolower($this->tabla)."&id=$id&opc="; - switch ($tipoAccion) { - case EDICION: - $accion.="modificar"; - $accion.=isset($pag)?"&pag=$pag":''; - $accion.=isset($orden)?"&orden=$orden":''; - $accion.=isset($sentido)?"&sentido=$sentido":''; - break; - case BORRADO: - $accion.="borrar"; - break; - case ANADIR: - $accion.="insertar"; - break; - } - //Genera un formulario con los datos de la tupla seleccionada. - return $this->formularioCampos($accion,$tipoAccion,$fila); - } - //Función que genera un campo de lista con los valores de descripción de la - //tabla a la cual pertenece la clave foránea. - protected function generaLista($datos,$campo,$valorInicial,$modo) - { - $salida="\n

"; - return $salida; - } - /** - * @todo Hay que hacer lo de las búsquedas automatizadas. Buscar el comment de buscar. - * @todo Hay que hacer lo de las ordenaciones automatizadas. Buscar el comment de ordenable. - */ - private function obtenerCampos() - { - //Si hay un fichero de descripción xml lo utiliza. - $nombre="xml/mantenimiento".$this->tabla.".xml"; - if (file_exists($nombre)) { - $def=simplexml_load_file($nombre); - foreach($def->Campos->Col as $columna) { - $this->campos[(string)$columna['Nombre']]=array("Field" => (string)$columna['Titulo'],"Comment" =>(string)$columna['Varios'], - "Type"=> (string) $columna['Tipo'],"Editable" => (string) $columna['Editable'],"Campo"=>(string) $columna['Campo']); - } - $this->comandoConsulta=$def->Consulta; - } else { - //Toma los datos de la tabla. - $datos=$this->bdd->estructura($this->tabla); - for ($i=0;$icampos[$datos[$i]["Field"]][]=$datos[$i]; - $this->campos[$datos[$i]["Field"]]=$this->campos[$datos[$i]["Field"]][0]; - $this->campos[$datos[$i]["Field"]]["Campo"]=$datos[$i]["Field"]; - $this->campos[$datos[$i]["Field"]]["Editable"]="si"; - } - $this->comandoConsulta="select * from ".$this->tabla." {buscar} {orden} limit {inferior},{superior}"; - } - } - private function cabeceraTabla() - { - $salida='

'; - foreach ($this->campos as $clave => $datos) { - $comen=explode(",",$datos["Comment"]); - $ordenable=false; - foreach ($comen as $co) { - if (strstr($co,"ordenable")) { - $ordenable=true; - break; - } - } - if ($ordenable) { - $salida.="\n"; - } else { - $salida.=''."\n"; - } - } +/** + * @package Inventario + * @copyright Copyright (c) 2008, Ricardo Montañana Gómez + * @license http://www.gnu.org/licenses/gpl-3.0.txt + * This file is part of Inventario. + * Inventario is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Inventario is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Inventario. If not, see . + * + */ +//Clase que se encargará de manejar los elementos del modelo de datos. +define('EDICION', 'Edición'); +define('BORRADO', 'Borrado'); +define('ANADIR', 'Inserción'); - $salida.="\n"; - return $salida; - } - /** - * - * @param string $accion URL de la acción del POST - * @param string $tipo ANADIR,EDITAR,BORRAR - * @param array $datos Vector con los datos del registro - * @return array lista de campos y formulario de entrada - */ - private function formularioCampos($accion,$tipo,$datos) - { - $modo=$tipo==BORRAR?"readonly":""; - $salida.=''."\n"; - $salida.="

$tipo\n"; - foreach ($this->campos as $clave => $valor) { - if ($valor["Editable"]=="no") { - //Se salta los campos que no deben aparecer - continue; - } - $campo=$valor['Campo']; - $salida.=" "; - //Se asegura que el id no se pueda modificar. - $modoEfectivo=$clave=='id' ? "readonly" : $modo; - $valorDato=$datos==null?"":$datos[$campo]; - if (!isset($this->foraneas[$valor['Campo']])) { - $tipoCampo=$valor['Type']; - //Si es un campo fecha u hora y está insertando pone la fecha actual o la hora actual - if ($tipo==ANADIR) { - if (stripos($tipoCampo,"echa") || stripos($tipoCampo,"ate")) { - $valorDato=strftime("%Y/%m/%d"); - } - } - // Calcula el tamaño - if (stripos($tipoCampo,"echa") || stripos($tipoCampo,"ate")) { - $tamano="19"; - } else { - list($resto,$tamano)=explode("(",$tipoCampo); - $tamano=substr($tamano,0,-1); - } - //Si no es una clave foránea añade un campo de texto normal - $salida.='

\n"; - } else { - $salida.=$this->generaLista($this->foraneas[$campo],$campo,$valorDato,$modoEfectivo); - } - //Genera una lista con los campos que intervienen en el formulario. - $campos.="$campo&"; - } - //genera un campo oculto con la lista de campos a modificar. - $salida.='\n"; - $salida.="

"; - $salida.="  
\n"; - return $salida; - } - protected function errorBD($comando,$mensaje="") - { - if (!$mensaje) { - return "

No pudo ejecutar correctamente el comando $comando error=".$this->bdd->mensajeError()."

"; - } else { - return "

$mensaje error=".$this->bdd->mensajeError()."

"; - } +class Mantenimiento { + + private $descripcion; + protected $bdd; + protected $url; + protected $cabecera; + protected $tabla; + protected $cadenaBusqueda; + protected $campos = array(); + protected $foraneas = array(); + protected $campoBusca = "Descripcion"; + protected $comandoConsulta = ""; + protected $perfil; + + public function __construct($baseDatos, $perfil, $nombre) { + $this->bdd = $baseDatos; + $this->url = "index.php?$nombre&opc=inicial"; + $this->cabecera = 'Location: ' . $this->url; + $this->tabla = ucfirst($nombre); + $this->perfil = $perfil; + } + + public function ejecuta() { + $opc = $_GET['opc']; + $id = $_GET['id']; + $orden = isset($_GET['orden']) ? $_GET['orden'] : ''; + $sentido = isset($_GET['sentido']) ? $_GET['sentido'] : 'asc'; + //Sólo tiene sentido para las modificaciones. + //Es la página donde estaba el registro + $pag = isset($_GET['pag']) ? $_GET['pag'] : '0'; + $this->cadenaBusqueda = $_GET['buscar']; + $this->obtenerCampos(); + $this->obtieneClavesForaneas(); + switch ($opc) { + case 'inicial':return $this->consulta($id, $orden, $sentido); + case 'editar':return $this->muestra($id, EDICION, $pag, $orden, $sentido); + case 'eliminar':return $this->muestra($id, BORRADO); + case 'nuevo':return $this->muestra(null, ANADIR); + case 'insertar':return $this->insertar(); + case 'modificar':return $this->modificar($id, $pag, $orden, $sentido); + case 'borrar':return $this->borrar($id); + default:return 'La clase Mantenimiento No entiende lo solicitado.'; } } + + protected function obtieneClavesForaneas() { + $salida = null; + foreach ($this->campos as $clave => $valor) { + $trozos = explode(",", $valor["Comment"]); + foreach ($trozos as $trozo) { + if (strstr($trozo, "foreign")) { + $temp = substr($trozo, 8, -1); + list($tabla, $atributos) = explode("->", $temp); + list($clave, $resto) = explode(";", $atributos); + //Quita el paréntesis final + $atributos = substr($atributos, 0, -1); + $salida[$valor['Campo']] = $tabla . "," . $resto; + } + } + } + $this->foraneas = $salida; + } + + private function consulta($pagina, $orden, $sentido) { + //Calcula los números de página anterior y siguiente. + $pagina = $pagina + 0; + $pagSigte = $pagina <= 0 ? 1 : $pagina + 1; + $pagAnt = $pagSigte - 2; + $pagFwd = $pagSigte + 3; + $pagRew = $pagAnt - 3 < 0 ? $pagAnt : $pagAnt - 3; + //Trata con la cadena de búsqueda + $this->cadenaBusqueda = isset($_POST['buscar']) ? $_POST['buscar'] : $this->cadenaBusqueda; + if (isset($this->cadenaBusqueda) && strlen($this->cadenaBusqueda)) { + $sufijo = " where $this->campoBusca like '%" . $this->bdd->filtra($this->cadenaBusqueda) . "%'"; + $sufijoEnlace = "&buscar=" . $this->cadenaBusqueda; + $comando = str_replace('{buscar}', $sufijo, $this->comandoConsulta); + } else { + $comando = str_replace('{buscar}', '', $this->comandoConsulta); + } + //Trata con el orden de mostrar los datos + if (strlen($orden) > 0) { + $comando = str_replace('{orden}', "order by " . $orden . " " . $sentido, $comando); + $sufijoOrden = "&orden=" . $orden . "&sentido=" . $sentido; + } else { + $comando = str_replace('{orden}', ' ', $comando); + } + //Introduce un botón para hacer búsquedas + $salida = $this->enlaceBusqueda(); + //Esta orden de centrado se cierra en el pie de la tabla + $salida.='

Página ' . $pagSigte . '

'; + $salida.=$this->cabeceraTabla(); + //Consulta paginada de todas las tuplas + $comando = str_replace('{inferior}', ($pagAnt + 1) * NUMFILAS, $comando); + $comando = str_replace('{superior}', NUMFILAS, $comando); + //$salida.=$comando; + $tabla = strtolower($this->tabla); + $this->bdd->ejecuta($comando); + if ($this->bdd->numeroTuplas() == 0) { + if ($pagSigte > 1) { + // Si no hay datos en la consulta y no es la primera página, + // carga la página inicial + header('Location: ' . $this->url); + } else { + $salida = "

No hay registros


"; + } + } + //$salida.=print_r($this->perfil); + while ($fila = $this->bdd->procesaResultado()) { + $salida.='
'; + foreach ($fila as $clave => $valor) { + if ($clave == "id") { + $id = $valor; + } + + $salida.="\n"; + } + //Añade el icono de editar + if ($this->perfil['Modificacion']) { + $salida.='' . "\n"; + } + } + $salida.="
url&orden=".strtolower($clave)."\"> $clave '.$clave.'Acción
$valoreditar'; + } + //Añade el icono de eliminar + if ($this->perfil['Borrado']) { + $salida.='  eliminar

"; + //Añade botones de comandos + $enlace = '\"anterior\"\n"; + $siguiente = $enlace . $pagSigte . $sufijoEnlace . "\">\"siguiente\"\n"; + $fwd = $enlace . $pagFwd . $sufijoEnlace . "\">\"siguiente\"\n"; + $rew = $enlace . $pagRew . $sufijoEnlace . "\">\"siguiente\"\n"; + if (strlen($orden) > 0) { + $az = 'asc'; + $za = 'desc'; + } else { + $az = $za = ''; + } + if ($this->perfil['Informe']) { + $informe = 'informe'; + } else { + $informe = ""; + } + } + if ($this->perfil['Alta']) { + $anadir = '' . + 'nuevo'; + } else { + $anadir = ""; + } + $salida.='

' . + "$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd

"; + return $salida; + } + + private function enlaceBusqueda() { + $salida = '

'; + $salida.='

cadenaBusqueda . '" size="40" />
'; + $salida.='

'; + return $salida; + } + + protected function borrar($id) { + $comando = "delete from " . $this->tabla . " where id=\"$id\""; + if (!$this->bdd->ejecuta($comando)) { + return $this->errorBD($comando); + } + header('Location: ' . $this->url); + return; + } + + protected function insertar() { + $comando = "insert into " . $this->tabla . " ("; + $lista = explode("&", $_POST['listacampos']); + $primero = true; + //Añade la lista de campos + foreach ($lista as $campo) { + if ($campo == "") { + continue; + } + if ($primero) { + $primero = false; + $coma = " "; + } else { + $coma = ","; + } + $comando.="$coma $campo"; + } + $comando.=") values ("; + //Añade la lista de valores + $primero = true; + foreach ($lista as $campo) { + if ($campo == "") + continue; + if ($primero) { + $primero = false; + $coma = " "; + } else { + $coma = ","; + } + $comando.="$coma \"$_POST[$campo]\""; + } + $comando.=")"; + if (!$this->bdd->ejecuta($comando)) { + return $this->errorBD($comando); + } + list($enlace, $resto) = explode("&", $this->url); + $enlace.="&opc=inicial"; + return "

Se ha insertado el registro con la clave " . $this->bdd->ultimoId() . "

"; + } + + protected function modificar($id, $pag, $orden, $sentido) { + //Los datos a utilizar para actualizar la tupla vienen en $_POST. + //La lista de atributos de la tupla viene en el campo oculto listacampos + //print_r($_GET); + //echo "id=$id pag=$pag orden=$orden sentido=$sentido";die(); + $comando = "update " . $this->tabla . " set "; + $lista = explode("&", $_POST['listacampos']); + $primero = true; + foreach ($lista as $campo) { + if ($campo == "id" || $campo == "") + continue; + if ($primero) { + $primero = false; + $coma = " "; + } + else + $coma = ","; + if (strlen(trim($_POST[$campo])) == 0) + $comando.="$coma $campo=null"; + else + $comando.=$coma . ' ' . $campo . '="' . $_POST[$campo] . '"'; + } + $comando.=" where id=\"$id\""; + if (!$this->bdd->ejecuta($comando)) { + return $this->errorBD($comando); + } + + list($enlace, $resto) = explode("&", $this->url); + $enlace.="&opc=inicial&orden=" . $orden . "&sentido=" . $sentido . "&id=" . $pag; + header('Location: ' . $enlace); + return; + } + + protected function muestra($id, $tipoAccion, $pag = "", $orden = "", $sentido = "") { + if (isset($id)) { + $comando = "select * from " . $this->tabla . " where id='$id'"; + $resultado = $this->bdd->ejecuta($comando); + if (!$resultado) { + return $this->errorBD("", "No se han podido encontrar datos del identificador $id"); + } + $fila = $this->bdd->procesaResultado(); + } else { + $fila = null; + } + //list($tipo,$valor)=explode($columna["Type"]); + $accion = "index.php?" . strtolower($this->tabla) . "&id=$id&opc="; + switch ($tipoAccion) { + case EDICION: + $accion.="modificar"; + $accion.=isset($pag) ? "&pag=$pag" : ''; + $accion.=isset($orden) ? "&orden=$orden" : ''; + $accion.=isset($sentido) ? "&sentido=$sentido" : ''; + break; + case BORRADO: + $accion.="borrar"; + break; + case ANADIR: + $accion.="insertar"; + break; + } + //Genera un formulario con los datos de la tupla seleccionada. + return $this->formularioCampos($accion, $tipoAccion, $fila); + } + + //Función que genera un campo de lista con los valores de descripción de la + //tabla a la cual pertenece la clave foránea. + protected function generaLista($datos, $campo, $valorInicial, $modo) { + $salida = "\n

"; + return $salida; + } + + /** + * @todo Hay que hacer lo de las búsquedas automatizadas. Buscar el comment de buscar. + * @todo Hay que hacer lo de las ordenaciones automatizadas. Buscar el comment de ordenable. + */ + private function obtenerCampos() { + //Si hay un fichero de descripción xml lo utiliza. + $nombre = "xml/mantenimiento" . $this->tabla . ".xml"; + if (file_exists($nombre)) { + $def = simplexml_load_file($nombre); + foreach ($def->Campos->Col as $columna) { + $this->campos[(string) $columna['Nombre']] = array("Field" => (string) $columna['Titulo'], "Comment" => (string) $columna['Varios'], + "Type" => (string) $columna['Tipo'], "Editable" => (string) $columna['Editable'], "Campo" => (string) $columna['Campo']); + } + $this->comandoConsulta = $def->Consulta; + } else { + //Toma los datos de la tabla. + $datos = $this->bdd->estructura($this->tabla); + for ($i = 0; $i < count($datos); $i++) { + $this->campos[$datos[$i]["Field"]][] = $datos[$i]; + $this->campos[$datos[$i]["Field"]] = $this->campos[$datos[$i]["Field"]][0]; + $this->campos[$datos[$i]["Field"]]["Campo"] = $datos[$i]["Field"]; + $this->campos[$datos[$i]["Field"]]["Editable"] = "si"; + } + $this->comandoConsulta = "select * from " . $this->tabla . " {buscar} {orden} limit {inferior},{superior}"; + } + } + + private function cabeceraTabla() { + $salida = '

'; + foreach ($this->campos as $clave => $datos) { + $comen = explode(",", $datos["Comment"]); + $ordenable = false; + foreach ($comen as $co) { + if (strstr($co, "ordenable")) { + $ordenable = true; + break; + } + } + if ($ordenable) { + $salida.="\n"; + } else { + $salida.='' . "\n"; + } + } + + $salida.="\n"; + return $salida; + } + + /** + * + * @param string $accion URL de la acción del POST + * @param string $tipo ANADIR,EDITAR,BORRAR + * @param array $datos Vector con los datos del registro + * @return array lista de campos y formulario de entrada + */ + private function formularioCampos($accion, $tipo, $datos) { + $modo = $tipo == BORRAR ? "readonly" : ""; + $salida.='' . "\n"; + $salida.="

$tipo\n"; + foreach ($this->campos as $clave => $valor) { + if ($valor["Editable"] == "no") { + //Se salta los campos que no deben aparecer + continue; + } + $campo = $valor['Campo']; + $salida.=" "; + //Se asegura que el id no se pueda modificar. + $modoEfectivo = $clave == 'id' ? "readonly" : $modo; + $valorDato = $datos == null ? "" : $datos[$campo]; + if (!isset($this->foraneas[$valor['Campo']])) { + $tipoCampo = $valor['Type']; + //Si es un campo fecha u hora y está insertando pone la fecha actual o la hora actual + if ($tipo == ANADIR) { + if (stripos($tipoCampo, "echa") || stripos($tipoCampo, "ate")) { + $valorDato = strftime("%Y/%m/%d"); + } + } + // Calcula el tamaño + if (stripos($tipoCampo, "echa") || stripos($tipoCampo, "ate")) { + $tamano = "19"; + } else { + list($resto, $tamano) = explode("(", $tipoCampo); + $tamano = substr($tamano, 0, -1); + } + if ($tipoCampo == "Password") + $tipo_campo = "password"; + else + $tipo_campo = "text"; + //Si no es una clave foránea añade un campo de texto normal + $salida.='

\n"; + } else { + $salida.=$this->generaLista($this->foraneas[$campo], $campo, $valorDato, $modoEfectivo); + } + //Genera una lista con los campos que intervienen en el formulario. + $campos.="$campo&"; + } + //genera un campo oculto con la lista de campos a modificar. + $salida.='\n"; + $salida.="

"; + $salida.="  
\n"; + return $salida; + } + + protected function errorBD($comando, $mensaje = "") { + if (!$mensaje) { + return "

No pudo ejecutar correctamente el comando $comando error=" . $this->bdd->mensajeError() . "

"; + } else { + return "

$mensaje error=" . $this->bdd->mensajeError() . "

"; + } + } + +} + ?> \ No newline at end of file diff --git a/Menu.php b/Menu.php index 1e4be5f..ee82a63 100644 --- a/Menu.php +++ b/Menu.php @@ -29,10 +29,10 @@ class Menu { // Obtenemos la lista de pares Opción|Enlace $elementos=explode("\n", $contenido); foreach($elementos as $elemento) { - list($tipo, $opcion, $enlace)=explode('|', $elemento); + list($tipo, $opcion, $enlace, $destino)=explode('|', $elemento); // Los guardamos en la matriz de opciones if ($tipo) - $this->opciones[]=$tipo.",".$opcion.",".$enlace; + $this->opciones[]=$tipo.",".$opcion.",".$enlace.",".$destino; } } public function insertaMenu() @@ -40,9 +40,9 @@ class Menu { $salida=""; reset($this->opciones); foreach($this->opciones as $opcion) { - list($tipo,$opcion,$enlace)=explode(",",$opcion); + list($tipo,$opcion,$enlace,$destino)=explode(",",$opcion); if ($tipo==2) - $salida.=''.$opcion.'
'; + $salida.=''.$opcion.'
'; else $salida.='
'; } diff --git a/inc/inventario.menu b/inc/inventario.menu index 33165d2..0c51600 100644 --- a/inc/inventario.menu +++ b/inc/inventario.menu @@ -1,12 +1,12 @@ 1|Maestros| -2|Ubicaciones|index.php?ubicaciones&opc=inicial -2|Artículos|index.php?articulos&opc=inicial -2|Elementos|index.php?elementos&opc=inicial&orden=ubicacion&sentido=asc -2|Usuarios|index.php?usuarios&opc=inicial +2|Ubicaciones|index.php?ubicaciones&opc=inicial|_self +2|Artículos|index.php?articulos&opc=inicial|_self +2|Elementos|index.php?elementos&opc=inicial&orden=ubicacion&sentido=asc|_self +2|Usuarios|index.php?usuarios&opc=inicial|_self 1|Inventario| -2|Ubicación|index.php?informeInventario&opc=Ubicacion -2|Artículo|index.php?informeInventario&opc=Articulo -2|Total|index.php?informeInventario&opc=Total -2|Descuadres|index.php?descuadres +2|Ubicación|index.php?informeInventario&opc=Ubicacion|_self +2|Artículo|index.php?informeInventario&opc=Articulo|_self +2|Total|index.php?informeInventario&opc=Total|_blank +2|Descuadres|index.php?descuadres|_blank 1|Varios| -2|Configuración|index.php?configuracion +2|Configuración|index.php?configuracion|_self diff --git a/plant/principal.html b/plant/principal.html index da6bd09..f8e2e54 100644 --- a/plant/principal.html +++ b/plant/principal.html @@ -1,11 +1,8 @@ - + - - + Gestión de Inventario - - @@ -51,17 +48,6 @@ {contenido}
- - - + diff --git a/sql/inv2.sql b/sql/inv2.sql new file mode 100644 index 0000000..da7bc07 --- /dev/null +++ b/sql/inv2.sql @@ -0,0 +1,168 @@ +-- MySQL dump 10.11 +-- +-- Host: localhost Database: Inventario2 +-- ------------------------------------------------------ +-- Server version 5.0.77 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `Articulos` +-- + +DROP TABLE IF EXISTS `Articulos`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Articulos` ( + `id` smallint(6) NOT NULL auto_increment, + `descripcion` varchar(60) NOT NULL COMMENT 'ordenable', + `marca` varchar(20) default NULL COMMENT 'ordenable', + `modelo` varchar(20) default NULL COMMENT 'ordenable', + `cantidad` int(11) default NULL COMMENT 'ordenable', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `Articulos` +-- + +LOCK TABLES `Articulos` WRITE; +/*!40000 ALTER TABLE `Articulos` DISABLE KEYS */; +INSERT INTO `Articulos` VALUES (589,'Armario con puertas y cajones','M. E. C.','Dotación Inicial',26),(590,'Armario vitrina con puertas de cristal','M. E. C.','Dotación Inicial',49),(591,'Retrato del Rey','M. E. C.','Dotación Inicial',6),(592,'Encerado para laboratorio','M. E. C.','Dotación Inicial',2),(593,'Estantería de madera con trasera','M. E. C.','Dotación Inicial',61),(594,'Percha de 8 ganchos','M. E. C.','Dotación Inicial',68),(595,'Pupitre M.19','M. E. C.','Dotación Inicial',271),(596,'Tablero de corcho 2,00x1,00','M. E. C.','Dotación Inicial',29),(597,'Estantería metálica','M. E. C.','Dotación Inicial',18),(598,'Encerado P-1','M. E. C.','Dotación Inicial',21),(599,'Mesa de profesor','M. E. C.','Dotación Inicial',19),(600,'Sillón de profesor','M. E. C.','Dotación Inicial',19),(601,'Silla pala plegable (diestros)','M. E. C.','Dotación Inicial',26),(602,'Silla plegable (zurdos)','M. E. C.','Dotación Inicial',4),(603,'Banqueta altura regulable sin respaldo','M. E. C.','Dotación Inicial',95),(604,'Mesa de aula de plástica','M. E. C.','Dotación Inicial',6),(605,'Armario archivador A-2','M. E. C.','Dotación Inicial',4),(606,'Armario metálico','M. E. C.','Dotación Inicial',6),(607,'Armario con puertas ciegas','M. E. C.','Dotación Inicial',9),(608,'Banco de trabajo','M. E. C.','Dotación Inicial',6),(609,'Botiquín','M. E. C.','Dotación Inicial',3),(610,'Mesa de dibujo con banqueta','M. E. C.','Dotación Inicial',2),(611,'Mesa Trabajos teóricos con 5 sillas','M. E. C.','Dotación Inicial',6),(612,'Mesa de reuniones con 6 sillas','M. E. C.','Dotación Inicial',11),(613,'Encuadernadora de canutillo','M. E. C.','Dotación Inicial',1),(614,'Guillotina manual','M. E. C.','Dotación Inicial',1),(615,'Caseta meteorológica','M. E. C.','Dotación Inicial',1),(616,'Carro con ruedas para laboratorio','M. E. C.','Dotación Inicial',1),(617,'Centrifugadora eléctrica','M. E. C.','Dotación Inicial',2),(618,'Colección de rocas y minerales','M. E. C.','Dotación Inicial',6),(619,'Equipo experimentación II M. Preparación','M. E. C.','Dotación Inicial',1),(620,'Equipo multimedia de microscopía','M. E. C.','Dotación Inicial',1),(621,'Equipo de campo','M. E. C.','Dotación Inicial',2),(622,'Equipo de experiencias de mecánica','M. E. C.','Dotación Inicial',7),(623,'Equipo de óptica para alumnos','M. E. C.','Dotación Inicial',6),(624,'Hombre clástico y modelos anatómicos','M. E. C.','Dotación Inicial',1),(625,'Mechero tipo Bunsen','M. E. C.','Dotación Inicial',6),(626,'Mesa de trabajo de alumnos','M. E. C.','Dotación Inicial',6),(627,'Microscopio biológico para profesor','M. E. C.','Dotación Inicial',1),(628,'Mesa de laboratorio tipo B','M. E. C.','Dotación Inicial',8),(629,'Mesa de laboratorio tipo C','M. E. C.','Dotación Inicial',4),(630,'Nevera','M. E. C.','Dotación Inicial',1),(631,'Reactivos para química','M. E. C.','Dotación Inicial',1),(632,'Tabla periódica mural','M. E. C.','Dotación Inicial',1),(633,'Cajón para transparencias','M. E. C.','Dotación Inicial',1),(634,'Clasificador cajones aula plástica','M. E. C.','Dotación Inicial',1),(635,'Colección diapositivas educación plástica y visual','M. E. C.','Dotación Inicial',1),(636,'Equipo de grabado y estampación','M. E. C.','Dotación Inicial',10),(637,'Encerado portatil con trama','M. E. C.','Dotación Inicial',2),(638,'Equipo plantillas y escalas','M. E. C.','Dotación Inicial',1),(639,'Equipo paralex de metacrilato','M. E. C.','Dotación Inicial',15),(640,'Juego de poliedros','M. E. C.','Dotación Inicial',1),(641,'Juesgo de piezas volumétricas seccionadas','M. E. C.','Dotación Inicial',1),(642,'Proyector de diapositivas','M. E. C.','Dotación Inicial',3),(643,'Retroproyector','M. E. C.','Dotación Inicial',3),(644,'Televisor','M. E. C.','Dotación Inicial',4),(645,'Tripode de modelado de mesa','M. E. C.','Dotación Inicial',10),(646,'Colección diapositivas arte España','M. E. C.','Dotación Inicial',1),(647,'Colección diapositivas arte mundial','M. E. C.','Dotación Inicial',1),(648,'Colección diapositivas geografía España','M. E. C.','Dotación Inicial',1),(649,'Mapas históricos murales','M. E. C.','Dotación Inicial',1),(650,'Sistema soporte almacenamiento mapas','M. E. C.','Dotación Inicial',1),(651,'Equipo de fotografía','M. E. C.','Dotación Inicial',1),(652,'Colección diapositivas geografía Mundial','M. E. C.','Dotación Inicial',1),(653,'Equipo didáctico de material cartográfico','M. E. C.','Dotación Inicial',1),(654,'Cassette grabadora','M. E. C.','Dotación Inicial',4),(655,'Calculadora Científica','M. E. C.','Dotación Inicial',33),(656,'Equipo de medidas de campo','M. E. C.','Dotación Inicial',1),(657,'Equipo probabilidad, proc. estocásticos','M. E. C.','Dotación Inicial',1),(658,'Equipo para la construcción de poliedros','M. E. C.','Dotación Inicial',1),(659,'Equipo de geometría del espacio','M. E. C.','Dotación Inicial',1),(660,'Equipo de geometría del plano','M. E. C.','Dotación Inicial',1),(661,'Juego para encerado','M. E. C.','Dotación Inicial',2),(662,'Atril plegable','M. E. C.','Dotación Inicial',10),(663,'Conjunto de instrumentos de percusión de laminas','M. E. C.','Dotación Inicial',2),(664,'Conjunto de instrumentos de pequeña percusión (S.O.)','M. E. C.','Dotación Inicial',1),(665,'Equipo audiovisual aula de música','M. E. C.','Dotación Inicial',1),(666,'Encerado pautado portatil','M. E. C.','Dotación Inicial',1),(667,'Guitarra española','M. E. C.','Dotación Inicial',2),(668,'Piano electrónico','M. E. C.','Dotación Inicial',1),(669,'Clasificador de cajones aula de tecnología','M. E. C.','Dotación Inicial',2),(670,'Conjunto de elementos de contrucción y montaje','M. E. C.','Dotación Inicial',2),(671,'Equipo de dibujo técnico aula de tecnología','M. E. C.','Dotación Inicial',1),(672,'Electroesmeriladora portatil','M. E. C.','Dotación Inicial',1),(673,'Equipo de herramientas con armario (S.O.)','M. E. C.','Dotación Inicial',1),(674,'Equipo de herramientas para alumno','M. E. C.','Dotación Inicial',6),(675,'Equipo de herramientas para madera','M. E. C.','Dotación Inicial',1),(676,'Equipo de operadores tecnológicos-mecánicos','M. E. C.','Dotación Inicial',1),(677,'Equipo de operadores tecnológicos-neumáticos','M. E. C.','Dotación Inicial',1),(678,'Equipo de soldadura eléctrica portatil (S.O.)','M. E. C.','Dotación Inicial',1),(679,'Fuente de alimentación S.O.','M. E. C.','Dotación Inicial',6),(680,'Polímetro analógico didáctico','M. E. C.','Dotación Inicial',6),(681,'Polímetro digital','M. E. C.','Dotación Inicial',1),(682,'Sierra de calar','M. E. C.','Dotación Inicial',3),(683,'Taladradora de sobremesa','M. E. C.','Dotación Inicial',1),(684,'Tornillo de banco de 100 mm.','M. E. C.','Dotación Inicial',6),(685,'Torno de sobremesa','M. E. C.','Dotación Inicial',1),(686,'Mesa de director con sillón','M. E. C.','Dotación Inicial',3),(687,'Silla tapizada','M. E. C.','Dotación Inicial',8),(688,'Fichero F-2','M. E. C.','Dotación Inicial',5),(689,'Banco de pasillo','M. E. C.','Dotación Inicial',6),(690,'Pupitre M.03','M. E. C.','Dotación Inicial',16),(691,'Juego postes y red de voleibol','M. E. C.','Dotación Inicial',1),(692,'Juego de porterías de balonmano','M. E. C.','Dotación Inicial',1),(693,'Cámara de video','M. E. C.','Dotación Inicial',1),(694,'Cassette estero portatil con reproductor de CD','M. E. C.','Dotación Inicial',3),(695,'Mini cadena musical','M. E. C.','Dotación Inicial',1),(696,'Mesa soporte de proyector de diapositivas','M. E. C.','Dotación Inicial',2),(697,'Proyector de cuerpos opacos','M. E. C.','Dotación Inicial',1),(698,'Silla giratoria auxiliar','M. E. C.','Dotación Inicial',1),(699,'Mesa lectura 1,40x75x70 con 6 sillas','M. E. C.','Dotación Inicial',12),(700,'Agitador magnético','M. E. C.','Dotación Inicial',6),(701,'Balanza granatorio electrónica','M. E. C.','Dotación Inicial',2),(702,'Baño maría','M. E. C.','Dotación Inicial',1),(703,'Colección de fósiles','M. E. C.','Dotación Inicial',1),(704,'Equipo de análisis de agua','M. E. C.','Dotación Inicial',1),(705,'Esqueleto humano','M. E. C.','Dotación Inicial',1),(706,'Mapa de fondos oceánicos','M. E. C.','Dotación Inicial',1),(707,'Modelos de organización animal y vegetal','M. E. C.','Dotación Inicial',1),(708,'Modelos geológicos','M. E. C.','Dotación Inicial',1),(709,'Video estacionario','M. E. C.','Dotación Inicial',3),(710,'Planisferio de Peters','M. E. C.','Dotación Inicial',1),(711,'Cizalla-plegadora-punzonadora','M. E. C.','Dotación Inicial',1),(712,'Equipo de operadores tecnológicos electrico-electrónicos','M. E. C.','Dotación Inicial',2),(713,'Pistola decapante','M. E. C.','Dotación Inicial',2),(714,'Mesa auxiliar administrativo','M. E. C.','Dotación Inicial',1),(715,'Equipo básico de alumnos para experimentos de electricidad','M. E. C.','Dotación Inicial',6),(716,'Equipo de ilumniación aula plástica y visual','M. E. C.','Dotación Inicial',1),(717,'Pantalla','M. E. C.','Dotación Inicial',4),(718,'Tórculo pequeño con mesa','M. E. C.','Dotación Inicial',1),(719,'Banco sueco','M. E. C.','Dotación Inicial',8),(720,'Plinto','M. E. C.','Dotación Inicial',1),(721,'Juego Butacas modulares','M. E. C.','Dotación Inicial',2),(722,'Trampolín de tres alturas','M. E. C.','Dotación Inicial',1),(723,'Saltómetro','M. E. C.','Dotación Inicial',1),(724,'Material de gimnasia vario','M. E. C.','Dotación Inicial',1),(725,'Juego esterillas suelo','M. E. C.','Dotación Inicial',1),(726,'Colchonetade 2x1x0,05','M. E. C.','Dotación Inicial',8),(727,'Taladro portatil con soporte y accesorio','M. E. C.','Dotación Inicial',3),(728,'Material de vidrio para laboratorio','M. E. C.','Dotación Inicial',1),(729,'Lupa binocular para profesor','M. E. C.','Dotación Inicial',1),(730,'Lupa binocular para alumnos','M. E. C.','Dotación Inicial',15),(731,'Equipo termología alumnos','M. E. C.','Dotación Inicial',6),(732,'Equipo de Análisis de suelo','M. E. C.','Dotación Inicial',1),(733,'Equipo de Experimentación I.M. Disección','M. E. C.','Dotación Inicial',15),(734,'Juego de banderas','M. E. C.','Dotación Inicial',1),(735,'PC Notes','STI','PCNT_USB',1),(736,'Switch','Hewlett Packard','J4813A',1),(737,'Altavoces Sistema sobwoofer-satélites','','2106',1),(738,'Auriculares con micrófono','Creative','HS300',31),(739,'Impresora multifunción HP Officejet','Hewlett Packard','7205',1),(740,'Teclado','Inves','K366',16),(741,'Teclado y ratón','Toshiba','HCA32602690',1),(742,'Ratón','Inves','MS23',16),(743,'Equipo para el estudio del relieve','M. E. C.','Dotación Inicial',1),(744,'Material General de Física','M. E. C.','Dotación Inicial',1),(745,'Material de Laboratorio','M. E. C.','Dotación Inicial',1),(746,'Microscopio para Alumnos','M. E. C.','Dotación Inicial',15),(747,'Caballete de Pintura','M. E. C.','Dotación Inicial',10),(748,'Juego de Intrumentos para Rotular','M. E. C.','Dotación Inicial',1),(749,'Material General de Dibujo','M. E. C.','Dotación Inicial',1),(750,'Sierra Térmica de Porexpan','M. E. C.','Dotación Inicial',1),(751,'Equipo para la elaboración de circuitos impresos','M. E. C.','Dotación Inicial',1),(752,'Plegadora de plásticos con accesorios','M. E. C.','Dotación Inicial',1),(753,'Servidor Externo','Toshiba','Magnia Z415',1),(754,'Cámara flexo','Avermedia','POB106',1),(755,'Sintonizador externo','Avermedia','Aver TV Box',1),(756,'Monitor CRT 17\"','Inves','C708 Negro CCMM 3P',16),(757,'Ordenador de sobremesa aula Althia','Inves','SIERRA-DMT1400 2.66P',15),(758,'Ordenador de profesor aula Althia','Inves','Sierra DMT 1800 2.66',1),(759,'Balanza Granatorio','M. E. C.','Dotación Inicial',1),(760,'Reproductor DVD','MX-Onda','MX-DVD855NZ',1),(761,'Reproductor DVD con Divx','LG','DVX9743',1),(762,'Ordenador','Airis','dotación inicial',7),(763,'Monitor 17','AOC','FT720',7),(764,'Ordenador Santillana','Regalo Ed.Santillana','',3),(765,'Ordenador Dptos.','Monitor Philips','AMD2800/512/80/17\"',5),(766,'Estufa climatizadora','Ufesa','Climacontrol',3),(767,'Estufa 2000W','Ufesa','TV2610',6),(768,'Switch 8 puertos','Conceptronic','C100S8',2),(769,'Cañón proyector','NEC','VT480G',2),(770,'Protection Center 500 USB DIN','MGE','ProtectionCenter 500',2),(771,'Pantalla COMM-TEC (conectividad)','COMM-TEC','',2),(772,'Monitor CRT 17\" (conectividad)','APD','NH-778',4),(773,'Ordenador fijo conectividad','APD','ALDA CE 915GV',4),(774,'Ordenador portatil conectividad','Toshiba','Tecra S3-290',5),(775,'Bolsa de transporte de portatil','Toshiba','',5),(776,'Cámara de fotos digital','Nikon','Coolpix P2',1),(777,'Conmutador teclado-pantalla-usb','D-Link','DKVM-2KU',1),(778,'Punto de Acceso US-Robotics MAXg','US-Robotics','USR5451',1),(779,'Altavoces estereo','Genius','SP-G06',1),(780,'HP iPAQ rx4240 SP','HP','FA782AA#ABE',20),(781,'Ordenador Proyecto Hermes','Hewlett Packard','Hermes',1),(782,'Monitor 17','Hewlett Packard','Hermes',1),(783,'Ordenador Core2Quad','Packard Bell','Imedia X1610',1),(784,'Monitor 20','LG','Flatron Wide',1); +/*!40000 ALTER TABLE `Articulos` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Elementos` +-- + +DROP TABLE IF EXISTS `Elementos`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Elementos` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable', + `id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable', + `numserie` varchar(30) default NULL COMMENT 'ordenable', + `cantidad` int(10) unsigned default NULL COMMENT 'ordenable', + `fechaCompra` datetime NOT NULL COMMENT 'ordenable', + PRIMARY KEY (`id`), + KEY `id` (`id`), + KEY `id_Articulo` (`id_Articulo`), + KEY `id_Ubicacion` (`id_Ubicacion`), + CONSTRAINT `Elementos_ibfk_1` FOREIGN KEY (`id_Articulo`) REFERENCES `Articulos` (`id`) ON DELETE CASCADE, + CONSTRAINT `Elementos_ibfk_2` FOREIGN KEY (`id_Ubicacion`) REFERENCES `Ubicaciones` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1884 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `Elementos` +-- + +LOCK TABLES `Elementos` WRITE; +/*!40000 ALTER TABLE `Elementos` DISABLE KEYS */; +INSERT INTO `Elementos` VALUES (1414,589,140,'',1,'2004-12-07 00:00:00'),(1415,590,140,'',2,'2004-12-07 00:00:00'),(1416,591,140,'',1,'2004-12-07 00:00:00'),(1417,589,141,'',1,'2004-12-07 00:00:00'),(1418,590,141,'',4,'2004-12-07 00:00:00'),(1419,592,141,'',1,'2004-12-07 00:00:00'),(1420,593,141,'',4,'2004-12-07 00:00:00'),(1421,594,141,'',4,'2004-12-07 00:00:00'),(1422,595,141,'',1,'2004-12-07 00:00:00'),(1423,596,141,'',1,'2004-12-07 00:00:00'),(1424,597,142,'',5,'2004-12-07 00:00:00'),(1425,589,143,'',1,'2004-12-08 00:00:00'),(1426,590,143,'',1,'2004-12-08 00:00:00'),(1427,598,143,'',1,'2004-12-08 00:00:00'),(1428,597,143,'',1,'2004-12-08 00:00:00'),(1429,599,143,'',1,'2004-12-08 00:00:00'),(1430,594,143,'',4,'2004-12-08 00:00:00'),(1431,600,143,'',1,'2004-12-08 00:00:00'),(1432,601,143,'',26,'2004-12-08 00:00:00'),(1433,602,143,'',4,'2004-12-08 00:00:00'),(1434,596,143,'',1,'2004-12-08 00:00:00'),(1435,589,144,'',1,'2004-12-08 00:00:00'),(1436,590,144,'',2,'2004-12-08 00:00:00'),(1437,603,144,'',30,'2004-12-08 00:00:00'),(1438,598,144,'',1,'2004-12-08 00:00:00'),(1439,597,144,'',2,'2004-12-08 00:00:00'),(1440,593,144,'',2,'2004-12-08 00:00:00'),(1441,604,144,'',6,'2004-12-08 00:00:00'),(1442,599,144,'',1,'2004-12-08 00:00:00'),(1443,594,144,'',4,'2004-12-08 00:00:00'),(1444,600,144,'',1,'2004-12-08 00:00:00'),(1445,596,144,'',1,'2004-12-08 00:00:00'),(1446,605,145,'',1,'2004-12-08 00:00:00'),(1447,606,145,'',3,'2004-12-08 00:00:00'),(1448,607,145,'',4,'2004-12-08 00:00:00'),(1449,590,145,'',4,'2004-12-08 00:00:00'),(1450,608,145,'',6,'2004-12-08 00:00:00'),(1451,609,145,'',1,'2004-12-08 00:00:00'),(1452,603,145,'',30,'2004-12-08 00:00:00'),(1453,598,145,'',1,'2004-12-08 00:00:00'),(1454,597,145,'',6,'2004-12-08 00:00:00'),(1455,610,145,'',2,'2004-12-08 00:00:00'),(1456,599,145,'',1,'2004-12-08 00:00:00'),(1457,611,145,'',6,'2004-12-08 00:00:00'),(1458,594,145,'',4,'2004-12-08 00:00:00'),(1459,600,145,'',1,'2004-12-08 00:00:00'),(1460,596,145,'',1,'2004-12-08 00:00:00'),(1461,589,146,'',1,'2004-12-08 00:00:00'),(1462,598,146,'',1,'2004-12-08 00:00:00'),(1463,593,146,'',1,'2004-12-08 00:00:00'),(1464,599,146,'',1,'2004-12-08 00:00:00'),(1465,594,146,'',2,'2004-12-08 00:00:00'),(1466,595,146,'',15,'2004-12-08 00:00:00'),(1467,600,146,'',1,'2004-12-08 00:00:00'),(1468,596,146,'',1,'2004-12-08 00:00:00'),(1469,598,142,'',1,'2004-12-08 00:00:00'),(1470,593,142,'',1,'2004-12-08 00:00:00'),(1471,599,142,'',1,'2004-12-08 00:00:00'),(1472,594,140,'',2,'2004-12-08 00:00:00'),(1473,595,142,'',15,'2004-12-08 00:00:00'),(1474,600,142,'',1,'2004-12-08 00:00:00'),(1475,596,142,'',1,'2004-12-08 00:00:00'),(1476,589,147,'',1,'2004-12-08 00:00:00'),(1477,598,147,'',1,'2004-12-08 00:00:00'),(1478,593,147,'',1,'2004-12-08 00:00:00'),(1479,599,147,'',1,'2004-12-08 00:00:00'),(1480,594,147,'',4,'2004-12-08 00:00:00'),(1481,595,147,'',30,'2004-12-08 00:00:00'),(1482,600,147,'',1,'2004-12-08 00:00:00'),(1483,596,147,'',1,'2004-12-08 00:00:00'),(1484,589,148,'',1,'2004-12-08 00:00:00'),(1485,598,148,'',1,'2004-12-08 00:00:00'),(1486,593,148,'',1,'2004-12-08 00:00:00'),(1487,599,148,'',1,'2004-12-08 00:00:00'),(1488,594,148,'',4,'2004-12-08 00:00:00'),(1489,595,148,'',30,'2004-12-08 00:00:00'),(1490,600,148,'',1,'2004-12-08 00:00:00'),(1491,596,148,'',1,'2004-12-08 00:00:00'),(1492,589,149,'',1,'2004-12-08 00:00:00'),(1493,598,149,'',1,'2004-12-08 00:00:00'),(1494,593,149,'',1,'2004-12-08 00:00:00'),(1495,599,149,'',1,'2004-12-08 00:00:00'),(1496,594,149,'',4,'2004-12-08 00:00:00'),(1497,595,149,'',30,'2004-12-08 00:00:00'),(1498,600,149,'',1,'2004-12-08 00:00:00'),(1499,596,149,'',1,'2004-12-08 00:00:00'),(1500,589,150,'',1,'2004-12-08 00:00:00'),(1501,598,150,'',1,'2004-12-08 00:00:00'),(1502,593,150,'',1,'2004-12-08 00:00:00'),(1503,594,150,'',4,'2004-12-08 00:00:00'),(1504,595,150,'',30,'2004-12-08 00:00:00'),(1505,600,150,'',1,'2004-12-08 00:00:00'),(1506,596,150,'',1,'2004-12-08 00:00:00'),(1507,599,150,'',1,'2004-12-08 00:00:00'),(1508,589,151,'',1,'2004-12-08 00:00:00'),(1509,598,151,'',1,'2004-12-08 00:00:00'),(1510,593,151,'',1,'2004-12-08 00:00:00'),(1511,599,151,'',1,'2004-12-08 00:00:00'),(1512,594,151,'',4,'2004-12-08 00:00:00'),(1513,595,151,'',30,'2004-12-08 00:00:00'),(1514,600,151,'',1,'2004-12-08 00:00:00'),(1515,596,151,'',1,'2004-12-08 00:00:00'),(1516,589,152,'',1,'2004-12-08 00:00:00'),(1517,598,152,'',1,'2004-12-08 00:00:00'),(1518,593,152,'',1,'2004-12-08 00:00:00'),(1519,599,152,'',1,'2004-12-08 00:00:00'),(1520,594,152,'',4,'2004-12-08 00:00:00'),(1521,595,152,'',30,'2004-12-08 00:00:00'),(1522,600,152,'',1,'2004-12-08 00:00:00'),(1523,596,152,'',1,'2004-12-08 00:00:00'),(1524,589,153,'',1,'2004-12-08 00:00:00'),(1525,598,153,'',1,'2004-12-08 00:00:00'),(1526,593,153,'',1,'2004-12-08 00:00:00'),(1527,594,153,'',4,'2004-12-08 00:00:00'),(1528,595,153,'',30,'2004-12-08 00:00:00'),(1529,600,153,'',1,'2004-12-08 00:00:00'),(1530,596,153,'',1,'2004-12-08 00:00:00'),(1531,599,153,'',1,'2004-12-08 00:00:00'),(1532,589,154,'',1,'2004-12-08 00:00:00'),(1533,598,154,'',1,'2004-12-08 00:00:00'),(1534,593,154,'',1,'2004-12-08 00:00:00'),(1535,599,154,'',1,'2004-12-08 00:00:00'),(1536,594,154,'',4,'2004-12-08 00:00:00'),(1537,595,154,'',30,'2004-12-08 00:00:00'),(1538,600,154,'',1,'2004-12-08 00:00:00'),(1539,596,154,'',1,'2004-12-08 00:00:00'),(1540,590,155,'',19,'2004-12-08 00:00:00'),(1541,593,155,'',20,'2004-12-08 00:00:00'),(1542,599,155,'',1,'2004-12-08 00:00:00'),(1543,594,155,'',4,'2004-12-08 00:00:00'),(1544,591,155,'',1,'2004-12-08 00:00:00'),(1545,600,155,'',1,'2004-12-08 00:00:00'),(1546,590,156,'',2,'2004-12-08 00:00:00'),(1547,598,156,'',1,'2004-12-08 00:00:00'),(1548,593,156,'',2,'2004-12-08 00:00:00'),(1549,612,156,'',1,'2004-12-08 00:00:00'),(1550,594,156,'',1,'2004-12-08 00:00:00'),(1551,596,156,'',1,'2004-12-08 00:00:00'),(1552,590,157,'',2,'2004-12-08 00:00:00'),(1553,598,157,'',1,'2004-12-08 00:00:00'),(1554,593,157,'',2,'2004-12-08 00:00:00'),(1555,612,157,'',1,'2004-12-08 00:00:00'),(1556,594,157,'',1,'2004-12-08 00:00:00'),(1557,596,157,'',1,'2004-12-08 00:00:00'),(1558,590,158,'',2,'2004-12-08 00:00:00'),(1559,598,158,'',1,'2004-12-08 00:00:00'),(1560,593,158,'',2,'2004-12-08 00:00:00'),(1561,612,158,'',1,'2004-12-08 00:00:00'),(1562,594,158,'',1,'2004-12-08 00:00:00'),(1563,596,158,'',1,'2004-12-08 00:00:00'),(1564,590,159,'',2,'2004-12-08 00:00:00'),(1565,598,159,'',1,'2004-12-08 00:00:00'),(1566,593,159,'',2,'2004-12-08 00:00:00'),(1567,612,159,'',1,'2004-12-08 00:00:00'),(1568,594,159,'',1,'2004-12-08 00:00:00'),(1569,596,159,'',1,'2004-12-08 00:00:00'),(1570,590,160,'',2,'2004-12-08 00:00:00'),(1571,598,160,'',1,'2004-12-08 00:00:00'),(1572,593,160,'',2,'2004-12-08 00:00:00'),(1573,612,160,'',1,'2004-12-08 00:00:00'),(1574,594,160,'',1,'2004-12-08 00:00:00'),(1575,596,160,'',1,'2004-12-08 00:00:00'),(1576,606,161,'',1,'2004-12-08 00:00:00'),(1577,609,161,'',1,'2004-12-08 00:00:00'),(1578,613,161,'',1,'2004-12-08 00:00:00'),(1579,597,161,'',2,'2004-12-08 00:00:00'),(1580,614,161,'',1,'2004-12-08 00:00:00'),(1581,599,161,'',1,'2004-12-08 00:00:00'),(1582,600,161,'',1,'2004-12-08 00:00:00'),(1583,589,162,'',1,'2004-12-08 00:00:00'),(1584,607,162,'',5,'2004-12-08 00:00:00'),(1585,590,162,'',3,'2004-12-08 00:00:00'),(1586,609,162,'',1,'2004-12-08 00:00:00'),(1587,603,162,'',35,'2004-12-08 00:00:00'),(1588,615,162,'',1,'2004-12-08 00:00:00'),(1589,616,162,'',1,'2004-12-08 00:00:00'),(1590,617,162,'',2,'2004-12-08 00:00:00'),(1591,618,162,'',6,'2004-12-08 00:00:00'),(1592,619,162,'',1,'2004-12-08 00:00:00'),(1593,620,162,'',1,'2004-12-08 00:00:00'),(1594,592,162,'',1,'2004-12-08 00:00:00'),(1595,598,162,'',1,'2004-12-08 00:00:00'),(1596,621,162,'',2,'2004-12-08 00:00:00'),(1597,622,162,'',6,'2004-12-08 00:00:00'),(1598,623,162,'',6,'2004-12-08 00:00:00'),(1599,597,162,'',2,'2004-12-08 00:00:00'),(1600,593,162,'',4,'2004-12-08 00:00:00'),(1601,624,162,'',1,'2004-12-08 00:00:00'),(1602,625,162,'',6,'2004-12-08 00:00:00'),(1603,599,162,'',1,'2004-12-08 00:00:00'),(1604,626,162,'',6,'2004-12-08 00:00:00'),(1605,627,162,'',1,'2004-12-08 00:00:00'),(1606,628,162,'',8,'2004-12-08 00:00:00'),(1607,629,162,'',4,'2004-12-08 00:00:00'),(1608,630,162,'',1,'2004-12-08 00:00:00'),(1609,594,162,'',4,'2004-12-08 00:00:00'),(1610,631,162,'',1,'2004-12-08 00:00:00'),(1611,600,162,'',1,'2004-12-08 00:00:00'),(1612,632,162,'',1,'2004-12-08 00:00:00'),(1613,606,144,'',1,'2004-12-08 00:00:00'),(1614,633,144,'',1,'2004-12-08 00:00:00'),(1615,634,144,'',1,'2004-12-08 00:00:00'),(1616,635,144,'',1,'2004-12-08 00:00:00'),(1617,636,144,'',10,'2004-12-08 00:00:00'),(1618,637,144,'',2,'2004-12-08 00:00:00'),(1619,638,144,'',1,'2004-12-08 00:00:00'),(1620,639,144,'',15,'2004-12-08 00:00:00'),(1621,640,144,'',1,'2004-12-08 00:00:00'),(1622,641,144,'',1,'2004-12-08 00:00:00'),(1623,642,144,'',1,'2004-12-08 00:00:00'),(1624,643,144,'',1,'2004-12-08 00:00:00'),(1625,644,144,'',1,'2004-12-08 00:00:00'),(1626,645,144,'',10,'2004-12-08 00:00:00'),(1627,646,159,'',1,'2004-12-08 00:00:00'),(1628,647,159,'',1,'2004-12-08 00:00:00'),(1629,648,159,'',1,'2004-12-08 00:00:00'),(1630,649,159,'',1,'2004-12-08 00:00:00'),(1631,650,159,'',1,'2004-12-08 00:00:00'),(1632,651,144,'',1,'2004-12-08 00:00:00'),(1633,652,159,'',1,'2004-12-08 00:00:00'),(1634,653,159,'',1,'2004-12-08 00:00:00'),(1635,606,157,'',1,'2004-12-08 00:00:00'),(1636,654,157,'',4,'2004-12-08 00:00:00'),(1637,644,157,'',1,'2004-12-08 00:00:00'),(1638,655,156,'',32,'2004-12-08 00:00:00'),(1639,656,156,'',1,'2004-12-08 00:00:00'),(1640,657,156,'',1,'2004-12-08 00:00:00'),(1641,658,156,'',1,'2004-12-08 00:00:00'),(1642,659,156,'',1,'2004-12-08 00:00:00'),(1643,660,156,'',1,'2004-12-08 00:00:00'),(1644,661,156,'',1,'2004-12-08 00:00:00'),(1645,662,143,'',10,'2004-12-08 00:00:00'),(1646,663,143,'',2,'2004-12-08 00:00:00'),(1647,664,143,'',1,'2004-12-08 00:00:00'),(1648,665,143,'',1,'2004-12-08 00:00:00'),(1649,666,143,'',1,'2004-12-08 00:00:00'),(1650,667,143,'',2,'2004-12-08 00:00:00'),(1651,668,143,'',1,'2004-12-08 00:00:00'),(1652,669,145,'',2,'2004-12-08 00:00:00'),(1653,670,145,'',2,'2004-12-08 00:00:00'),(1654,671,145,'',1,'2004-12-08 00:00:00'),(1655,672,145,'',1,'2004-12-08 00:00:00'),(1656,622,145,'',1,'2004-12-08 00:00:00'),(1657,673,145,'',1,'2004-12-08 00:00:00'),(1658,674,145,'',6,'2004-12-08 00:00:00'),(1659,675,145,'',1,'2004-12-08 00:00:00'),(1660,676,145,'',1,'2004-12-08 00:00:00'),(1661,677,145,'',1,'2004-12-08 00:00:00'),(1662,678,145,'',1,'2004-12-08 00:00:00'),(1663,679,145,'',6,'2004-12-08 00:00:00'),(1664,661,145,'',1,'2004-12-08 00:00:00'),(1665,680,145,'',6,'2004-12-08 00:00:00'),(1666,681,145,'',1,'2004-12-08 00:00:00'),(1667,682,145,'',3,'2004-12-08 00:00:00'),(1668,683,145,'',1,'2004-12-08 00:00:00'),(1669,684,145,'',6,'2004-12-08 00:00:00'),(1670,685,145,'',1,'2004-12-08 00:00:00'),(1671,590,163,'',1,'2004-12-08 00:00:00'),(1672,598,163,'',1,'2004-12-08 00:00:00'),(1673,599,163,'',1,'2004-12-08 00:00:00'),(1674,594,163,'',1,'2004-12-08 00:00:00'),(1675,600,163,'',1,'2004-12-08 00:00:00'),(1676,596,140,'',1,'2004-12-08 00:00:00'),(1677,590,164,'',1,'2004-12-08 00:00:00'),(1678,598,164,'',1,'2004-12-08 00:00:00'),(1679,599,164,'',1,'2004-12-08 00:00:00'),(1680,594,164,'',1,'2004-12-08 00:00:00'),(1681,600,164,'',1,'2004-12-08 00:00:00'),(1682,596,164,'',1,'2004-12-08 00:00:00'),(1683,686,165,'',1,'2004-12-08 00:00:00'),(1684,612,165,'',1,'2004-12-08 00:00:00'),(1685,591,165,'',1,'2004-12-08 00:00:00'),(1686,687,165,'',2,'2004-12-08 00:00:00'),(1687,688,166,'',1,'2004-12-08 00:00:00'),(1688,686,166,'',1,'2004-12-08 00:00:00'),(1689,612,166,'',1,'2004-12-08 00:00:00'),(1690,591,166,'',1,'2004-12-08 00:00:00'),(1691,687,166,'',2,'2004-12-08 00:00:00'),(1692,596,166,'',1,'2004-12-08 00:00:00'),(1693,589,167,'',1,'2004-12-08 00:00:00'),(1694,590,167,'',2,'2004-12-08 00:00:00'),(1695,593,167,'',1,'2004-12-08 00:00:00'),(1696,688,167,'',1,'2004-12-08 00:00:00'),(1697,599,167,'',1,'2004-12-08 00:00:00'),(1698,612,167,'',1,'2004-12-08 00:00:00'),(1699,594,167,'',1,'2004-12-08 00:00:00'),(1700,600,167,'',1,'2004-12-08 00:00:00'),(1701,687,167,'',2,'2004-12-08 00:00:00'),(1702,596,167,'',1,'2004-12-08 00:00:00'),(1703,686,140,'',1,'2004-12-08 00:00:00'),(1704,687,140,'',2,'2004-12-08 00:00:00'),(1705,689,168,'',6,'2004-12-08 00:00:00'),(1706,690,168,'',16,'2004-12-08 00:00:00'),(1707,596,168,'',5,'2004-12-08 00:00:00'),(1708,691,169,'',1,'2004-12-08 00:00:00'),(1709,692,169,'',1,'2004-12-08 00:00:00'),(1710,693,165,'',1,'2004-12-08 00:00:00'),(1711,694,146,'',3,'2004-12-08 00:00:00'),(1712,695,146,'',1,'2004-12-08 00:00:00'),(1713,696,146,'',2,'2004-12-08 00:00:00'),(1714,697,146,'',1,'2004-12-08 00:00:00'),(1715,642,146,'',2,'2004-12-08 00:00:00'),(1716,643,146,'',2,'2004-12-08 00:00:00'),(1717,644,146,'',1,'2004-12-08 00:00:00'),(1718,589,170,'',11,'2004-12-08 00:00:00'),(1719,593,170,'',10,'2004-12-08 00:00:00'),(1720,612,170,'',3,'2004-12-08 00:00:00'),(1721,591,170,'',1,'2004-12-08 00:00:00'),(1722,605,171,'',3,'2004-12-08 00:00:00'),(1723,655,140,'',1,'2004-12-08 00:00:00'),(1724,688,171,'',3,'2004-12-08 00:00:00'),(1725,591,171,'',1,'2004-12-08 00:00:00'),(1726,698,171,'',1,'2004-12-08 00:00:00'),(1727,699,155,'',10,'2004-12-08 00:00:00'),(1728,700,162,'',6,'2004-12-08 00:00:00'),(1729,701,162,'',2,'2004-12-08 00:00:00'),(1730,702,162,'',1,'2004-12-08 00:00:00'),(1731,703,162,'',1,'2004-12-08 00:00:00'),(1732,704,162,'',1,'2004-12-08 00:00:00'),(1733,705,162,'',1,'2004-12-08 00:00:00'),(1734,706,162,'',1,'2004-12-08 00:00:00'),(1735,707,162,'',1,'2004-12-08 00:00:00'),(1736,708,162,'',1,'2004-12-08 00:00:00'),(1737,709,160,'',1,'2004-12-08 00:00:00'),(1738,710,156,'',1,'2004-12-08 00:00:00'),(1739,709,157,'',1,'2004-12-08 00:00:00'),(1740,711,145,'',1,'2004-12-08 00:00:00'),(1741,712,145,'',2,'2004-12-08 00:00:00'),(1742,713,145,'',2,'2004-12-08 00:00:00'),(1743,699,163,'',1,'2004-12-08 00:00:00'),(1744,699,164,'',1,'2004-12-08 00:00:00'),(1745,709,146,'',1,'2004-12-08 00:00:00'),(1746,714,171,'',1,'2004-12-08 00:00:00'),(1747,715,162,'',6,'2004-12-08 00:00:00'),(1748,716,144,'',1,'2004-12-08 00:00:00'),(1749,717,144,'',1,'2004-12-08 00:00:00'),(1750,718,144,'',1,'2004-12-08 00:00:00'),(1751,719,169,'',8,'2004-12-08 00:00:00'),(1752,720,169,'',1,'2004-12-08 00:00:00'),(1753,717,146,'',3,'2004-12-08 00:00:00'),(1754,721,170,'',1,'2004-12-08 00:00:00'),(1755,722,169,'',1,'2004-12-08 00:00:00'),(1756,723,169,'',1,'2004-12-08 00:00:00'),(1757,724,169,'',1,'2004-12-08 00:00:00'),(1758,725,169,'',1,'2004-12-08 00:00:00'),(1759,726,169,'',8,'2004-12-08 00:00:00'),(1760,721,165,'',1,'2004-12-08 00:00:00'),(1761,727,145,'',3,'2004-12-08 00:00:00'),(1762,728,162,'',1,'2004-12-08 00:00:00'),(1763,729,162,'',1,'2004-12-08 00:00:00'),(1764,730,162,'',15,'2004-12-08 00:00:00'),(1765,731,162,'',6,'2004-12-08 00:00:00'),(1766,732,162,'',1,'2004-12-08 00:00:00'),(1767,733,162,'',15,'2004-12-08 00:00:00'),(1768,734,168,'',1,'2004-12-09 00:00:00'),(1769,735,141,'USA311D0950485',1,'2004-12-20 00:00:00'),(1770,736,141,'SG411NV1DD',1,'2004-12-20 00:00:00'),(1771,737,141,'',1,'2004-12-20 00:00:00'),(1772,738,141,'',31,'2004-12-20 00:00:00'),(1773,739,141,'HU3A1FM0NW',1,'2004-12-20 00:00:00'),(1774,740,141,'',16,'2004-12-20 00:00:00'),(1775,741,141,'',1,'2004-12-20 00:00:00'),(1776,742,141,'',16,'2004-12-20 00:00:00'),(1777,743,156,'',1,'2005-02-02 00:00:00'),(1778,744,156,'',1,'2005-02-02 00:00:00'),(1779,745,162,'',1,'2005-02-02 00:00:00'),(1780,746,162,'',15,'2005-02-02 00:00:00'),(1781,747,144,'',10,'2005-02-02 00:00:00'),(1782,748,160,'',1,'2005-02-02 00:00:00'),(1783,749,160,'',1,'2005-02-02 00:00:00'),(1784,750,160,'',1,'2005-02-02 00:00:00'),(1785,751,160,'',1,'2005-02-02 00:00:00'),(1786,752,160,'',1,'2005-02-02 00:00:00'),(1787,753,141,'34029255G',1,'2005-09-29 00:00:00'),(1788,754,141,'402072800098',1,'2005-09-29 00:00:00'),(1789,755,141,'60984020',1,'2005-09-29 00:00:00'),(1790,756,141,'',16,'2005-09-29 00:00:00'),(1791,757,141,'8313252',1,'2005-09-29 00:00:00'),(1792,758,141,'8312296',1,'2005-09-29 00:00:00'),(1793,757,141,'8313295',1,'2005-09-29 00:00:00'),(1794,757,141,'8313255',1,'2005-09-29 00:00:00'),(1795,757,141,'8313262',1,'2005-09-29 00:00:00'),(1796,757,141,'8313289',1,'2005-09-29 00:00:00'),(1797,757,141,'8313287',1,'2005-09-29 00:00:00'),(1798,757,141,'8313259',1,'2005-09-29 00:00:00'),(1799,757,141,'8313283',1,'2005-09-29 00:00:00'),(1800,757,141,'8313280',1,'2005-09-29 00:00:00'),(1801,757,141,'8313278',1,'2005-09-29 00:00:00'),(1802,757,141,'8313281',1,'2005-09-29 00:00:00'),(1803,757,141,'8313274',1,'2005-09-29 00:00:00'),(1804,757,141,'8313242',1,'2005-09-29 00:00:00'),(1805,757,141,'8313290',1,'2005-09-29 00:00:00'),(1806,757,141,'8313258',1,'2005-09-29 00:00:00'),(1807,759,162,'',1,'2004-12-07 00:00:00'),(1808,596,163,'',1,'2005-10-17 00:00:00'),(1809,760,141,'L306777EM',1,'2005-10-19 00:00:00'),(1810,761,146,'5045HSE00126',1,'2005-10-19 00:00:00'),(1811,762,170,'110678317',1,'2005-10-21 00:00:00'),(1812,762,155,'110674918',1,'2005-10-21 00:00:00'),(1813,762,155,'110678354',1,'2005-10-21 00:00:00'),(1814,762,166,'110678347',1,'2005-10-21 00:00:00'),(1815,762,159,'110678315',1,'2005-10-21 00:00:00'),(1816,762,172,'110678344',1,'2005-10-21 00:00:00'),(1817,763,159,'I9CG43A141091',1,'2005-10-21 00:00:00'),(1818,763,165,'I9CG43A141042',1,'2005-10-21 00:00:00'),(1819,763,166,'I9CG43A141023',1,'2005-10-21 00:00:00'),(1820,763,159,'I9CG43A140836',1,'2005-10-21 00:00:00'),(1821,763,155,'I9CG43A140785',1,'2005-10-21 00:00:00'),(1822,763,170,'I9CG43A140824',1,'2005-10-21 00:00:00'),(1823,762,167,'110678310',1,'2005-10-21 00:00:00'),(1824,763,167,'I9CG43A140818',1,'2005-10-21 00:00:00'),(1825,764,170,'1',1,'2005-11-14 00:00:00'),(1826,764,163,'2',1,'2005-11-14 00:00:00'),(1827,764,161,'3',1,'2005-11-14 00:00:00'),(1828,765,160,'2',1,'2005-11-14 00:00:00'),(1829,765,159,'3',1,'2005-11-14 00:00:00'),(1830,765,157,'4',1,'2005-11-14 00:00:00'),(1831,765,158,'5',1,'2005-11-14 00:00:00'),(1832,765,156,'1',1,'2005-12-05 00:00:00'),(1833,766,166,'',1,'2005-12-06 00:00:00'),(1834,766,170,'',1,'2005-12-06 00:00:00'),(1835,766,161,'',1,'2005-12-06 00:00:00'),(1836,767,156,'',1,'2005-12-06 00:00:00'),(1837,767,157,'',1,'2005-12-06 00:00:00'),(1838,767,158,'',1,'2005-12-06 00:00:00'),(1839,767,140,'',1,'2005-12-06 00:00:00'),(1840,767,159,'',1,'2005-12-06 00:00:00'),(1841,767,160,'',1,'2005-12-06 00:00:00'),(1842,768,165,'C100S8 56C0700659',1,'2005-12-07 00:00:00'),(1843,769,146,'01150295 6440784FG',1,'2006-07-07 00:00:00'),(1844,769,161,'01150295 6341033FF',1,'2006-07-07 00:00:00'),(1845,770,165,'1HHG1702R',1,'2006-07-07 00:00:00'),(1846,770,141,'1HHG17034',1,'2006-07-07 00:00:00'),(1847,771,142,'',2,'2006-07-07 00:00:00'),(1848,772,144,'MM73E051137400',1,'2006-07-07 00:00:00'),(1849,772,155,'MM73E051136721',1,'2006-07-07 00:00:00'),(1850,772,155,'MM73E051136716',1,'2006-07-07 00:00:00'),(1851,772,145,'MM73E051137324',1,'2006-07-07 00:00:00'),(1852,773,144,'3260127AG07653',1,'2006-07-07 00:00:00'),(1853,773,155,'3260127AG07691',1,'2006-07-07 00:00:00'),(1854,773,155,'3260127AG07660',1,'2006-07-07 00:00:00'),(1855,773,145,'3260127AG07646',1,'2006-07-07 00:00:00'),(1856,774,146,'S46055407H',1,'2006-07-07 00:00:00'),(1857,774,142,'S46055793H',1,'2006-07-07 00:00:00'),(1858,774,140,'S46063627H',1,'2006-07-07 00:00:00'),(1859,774,165,'S46058827H',1,'2006-07-07 00:00:00'),(1860,775,142,'',5,'2006-07-07 00:00:00'),(1861,774,161,'S46055673H',1,'2006-07-07 00:00:00'),(1862,768,171,'C10058 56C0700218',1,'2006-07-07 00:00:00'),(1863,776,165,'40130911',1,'2006-05-17 00:00:00'),(1864,777,165,'DL17165002775',1,'2006-11-16 00:00:00'),(1865,778,165,'1WBK195F002N',1,'2006-11-16 00:00:00'),(1866,779,165,'JB10211015',1,'2006-11-16 00:00:00'),(1867,780,165,'2CK7190965',1,'2007-11-19 00:00:00'),(1868,780,173,'2CK7190991',1,'2007-11-27 00:00:00'),(1869,780,174,'2CK71909N5',1,'2007-11-27 00:00:00'),(1870,780,175,'2CK7190985',1,'2007-11-27 00:00:00'),(1871,780,176,'2CK71908ZL',1,'2007-11-27 00:00:00'),(1872,780,166,'2CK71908SK',1,'2007-11-27 00:00:00'),(1873,780,177,'2CK71909XN',1,'2007-11-27 00:00:00'),(1874,780,178,'2CK7190983',1,'2007-11-27 00:00:00'),(1875,780,179,'2CK71906FM',1,'2007-12-11 00:00:00'),(1876,780,180,'2CK71908MF',1,'2007-12-11 00:00:00'),(1877,780,181,'2CK71908V5',1,'2007-12-11 00:00:00'),(1878,780,182,'2CK71908N4',1,'2007-12-11 00:00:00'),(1879,780,183,'2CK71906RM',1,'2007-12-11 00:00:00'),(1880,781,140,'CZC7101BCT',1,'2008-02-29 00:00:00'),(1881,782,140,'CNT70205WS',1,'2008-02-29 00:00:00'),(1882,783,165,'100620380374',1,'2008-02-29 00:00:00'),(1883,784,165,'702TEAU3P080',1,'2008-02-29 00:00:00'); +/*!40000 ALTER TABLE `Elementos` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Ubicaciones` +-- + +DROP TABLE IF EXISTS `Ubicaciones`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Ubicaciones` ( + `id` smallint(5) unsigned NOT NULL auto_increment, + `Descripcion` varchar(30) NOT NULL COMMENT 'ordenable', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `Ubicaciones` +-- + +LOCK TABLES `Ubicaciones` WRITE; +/*!40000 ALTER TABLE `Ubicaciones` DISABLE KEYS */; +INSERT INTO `Ubicaciones` VALUES (140,'Secretario'),(141,'Aula Althia'),(142,'Almacén'),(143,'Aula de Música'),(144,'Aula de Plástica'),(145,'Aula Tecnología'),(146,'Aula Polivalente'),(147,'Aula 01'),(148,'Aula 02'),(149,'Aula 03'),(150,'Aula 04'),(151,'Aula 11'),(152,'Aula 12'),(153,'Aula 13'),(154,'Aula 14'),(155,'Biblioteca'),(156,'Departamento Ciencias'),(157,'Departamento Lenguas Extranjer'),(158,'Departamento Música y E.F.'),(159,'Departamento Socio-Lingüístico'),(160,'Departamento Tecnología-Plást.'),(161,'Conserjería'),(162,'Laboratorio'),(163,'Aula PT'),(164,'AMPA'),(165,'Director'),(166,'Jefa Estudios'),(167,'Orientadora'),(168,'Pasillos y hall'),(169,'Pista deportiva'),(170,'Sala de profesores'),(171,'Secretaría'),(172,'Averías'),(173,'Nicolás Moyano'),(174,'Salvador Pons'),(175,'Loli'),(176,'Noelia'),(177,'Joaquín'),(178,'Dolores'),(179,'José Miguel'),(180,'José García Serrano'),(181,'Eva Sánchez Muñoz'),(182,'Rafael Picazo'),(183,'Celia Martínez'); +/*!40000 ALTER TABLE `Ubicaciones` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Usuarios` +-- + +DROP TABLE IF EXISTS `Usuarios`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Usuarios` ( + `id` int(10) unsigned NOT NULL auto_increment, + `nombre` varchar(8) NOT NULL default '', + `clave` varchar(32) NOT NULL default '', + `idSesion` varchar(20) NOT NULL default '', + `alta` tinyint(1) NOT NULL default '0', + `modificacion` tinyint(1) NOT NULL default '0', + `borrado` tinyint(1) NOT NULL default '0', + `consulta` tinyint(1) NOT NULL default '1', + `informe` tinyint(1) NOT NULL default '1', + `usuarios` tinyint(1) NOT NULL default '0', + `config` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `nombre` (`nombre`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `Usuarios` +-- + +LOCK TABLES `Usuarios` WRITE; +/*!40000 ALTER TABLE `Usuarios` DISABLE KEYS */; +INSERT INTO `Usuarios` VALUES (2,'admin','galeote','s3LUSqxg{s',1,1,1,1,1,1,1),(3,'demo','demo','NogP_U0Byi',0,0,0,1,1,0,0); +/*!40000 ALTER TABLE `Usuarios` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `test` +-- + +DROP TABLE IF EXISTS `test`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `test` ( + `id` smallint(6) NOT NULL auto_increment, + `Descripcion` varchar(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `test` +-- + +LOCK TABLES `test` WRITE; +/*!40000 ALTER TABLE `test` DISABLE KEYS */; +/*!40000 ALTER TABLE `test` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2013-02-11 17:44:44 diff --git a/sql/setup.sql b/sql/setup.sql new file mode 100644 index 0000000..a33e01f --- /dev/null +++ b/sql/setup.sql @@ -0,0 +1,117 @@ +-- Creación de tablas +-- +-- Host: localhost Database: Inventario2 +-- ------------------------------------------------------ + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `Articulos` +-- + +DROP TABLE IF EXISTS `Articulos`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Articulos` ( + `id` smallint(6) NOT NULL auto_increment, + `descripcion` varchar(60) NOT NULL COMMENT 'ordenable', + `marca` varchar(20) default NULL COMMENT 'ordenable', + `modelo` varchar(20) default NULL COMMENT 'ordenable', + `cantidad` int(11) default NULL COMMENT 'ordenable', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + + +-- +-- Table structure for table `Elementos` +-- + +DROP TABLE IF EXISTS `Elementos`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Elementos` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable', + `id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable', + `numserie` varchar(30) default NULL COMMENT 'ordenable', + `cantidad` int(10) unsigned default NULL COMMENT 'ordenable', + `fechaCompra` datetime NOT NULL COMMENT 'ordenable', + PRIMARY KEY (`id`), + KEY `id` (`id`), + KEY `id_Articulo` (`id_Articulo`), + KEY `id_Ubicacion` (`id_Ubicacion`), + CONSTRAINT `Elementos_ibfk_1` FOREIGN KEY (`id_Articulo`) REFERENCES `Articulos` (`id`) ON DELETE CASCADE, + CONSTRAINT `Elementos_ibfk_2` FOREIGN KEY (`id_Ubicacion`) REFERENCES `Ubicaciones` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1884 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + + +-- +-- Table structure for table `Ubicaciones` +-- + +DROP TABLE IF EXISTS `Ubicaciones`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Ubicaciones` ( + `id` smallint(5) unsigned NOT NULL auto_increment, + `Descripcion` varchar(30) NOT NULL COMMENT 'ordenable', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + + +-- +-- Table structure for table `Usuarios` +-- + +DROP TABLE IF EXISTS `Usuarios`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `Usuarios` ( + `id` int(10) unsigned NOT NULL auto_increment, + `nombre` varchar(16) NOT NULL default '', + `clave` varchar(32) NOT NULL default '', + `idSesion` varchar(20) NOT NULL default '', + `alta` tinyint(1) NOT NULL default '0', + `modificacion` tinyint(1) NOT NULL default '0', + `borrado` tinyint(1) NOT NULL default '0', + `consulta` tinyint(1) NOT NULL default '1', + `informe` tinyint(1) NOT NULL default '1', + `usuarios` tinyint(1) NOT NULL default '0', + `config` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `nombre` (`nombre`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +-- +-- Usuarios iniciales +-- + +LOCK TABLES `Usuarios` WRITE; +/*!40000 ALTER TABLE `Usuarios` DISABLE KEYS */; +INSERT INTO `Usuarios` VALUES (1,'admin','galeote','s3LUSqxg{s',1,1,1,1,1,1,1),(2,'demo','demo','NogP_U0Byi',0,0,0,1,1,0,0); +/*!40000 ALTER TABLE `Usuarios` ENABLE KEYS */; +UNLOCK TABLES; + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + diff --git a/tmp/inventarioArticulo.xml b/tmp/inventarioArticulo.xml index 9a72223..3cc8a39 100644 --- a/tmp/inventarioArticulo.xml +++ b/tmp/inventarioArticulo.xml @@ -1,12 +1,12 @@ - + select A.id as id,U.Descripcion as ubicacion,E.fechaCompra as fechaCompra, E.numSerie as numserie,E.Cantidad as cantidad from Elementos E, Articulos A, Ubicaciones U where A.id=E.id_Articulo and U.id=E.id_Ubicacion - and A.id='593' order by U.Descripcion,numserie; + and A.id='700' order by U.Descripcion,numserie; diff --git a/tmp/prueba.pdf b/tmp/prueba.pdf deleted file mode 100644 index 0ab38caf9557f46b3a8a9bc509a223ed9f3bd8f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4076 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 E3p6YOdH?_b diff --git a/xml/mantenimientoUsuarios.xml b/xml/mantenimientoUsuarios.xml index 2f09e55..a4de3b9 100644 --- a/xml/mantenimientoUsuarios.xml +++ b/xml/mantenimientoUsuarios.xml @@ -1,20 +1,21 @@ - Mantenimiento de Elementos + Mantenimiento de Usuarios - SELECT E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie, - DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad - FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join - Ubicaciones U on E.id_ubicacion=U.id {buscar} {orden} limit {inferior},{superior}; + SELECT id, nombre, clave, idSesion, alta, modificacion, borrado, consulta, informe, usuarios, config + FROM Usuarios {buscar} {orden} limit {inferior}, {superior}; - - - - - - - - + + + + + + + + + + +
url&orden=" . strtolower($clave) . "\"> $clave ' . $clave . 'Acción