This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
generacion_de_inventarios [11/09/2009 00:00] |
generacion_de_inventarios [11/09/2009 10:41] clauboe |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Generación automática de números de inventario ====== | ||
+ | <note>Documento creado el 18 de agosto de 2007, motivado por una inquietud de la Biblioteca Rivadavia. Es solamente un **esbozo** de cómo podría implementarse esta funcionalidad. ¿Alguien interesado en completar el trabajo?</note> | ||
+ | |||
+ | Cambios a realizar en Catalis 2005.06.09 para poder generar automáticamente el número de inventario. | ||
+ | |||
+ | * En el archivo **catalis.conf** agregar un parámetro para activar o desactivar esta funcionalidad. | ||
+ | |||
+ | * Crear un archivo **inventario.txt**, que inicialmente tendrá el último número de inventario asignado. | ||
+ | |||
+ | **Sugerencia:** sería útil también que se pudieran generar diferentes formatos de inventario. Las colecciones de materiales especiales o no librarios suelen tener asociado el tipo de material al número de inventario. | ||
+ | Ej.: CD0001. --- //[[clauboe@gmail.com|Claudia]] 2009/09/11 10:40// | ||
+ | |||
+ | |||
+ | |||
+ | === editEjemplares.htm === | ||
+ | |||
+ | Agregamos un botón que permita solicitar un nuevo número de inventario. El botón sólo debe estar disponible cuando se crea un nuevo ejemplar, y sólo si la funcionalidad está habilitada en **catalis.conf**. | ||
+ | |||
+ | <code> | ||
+ | <tr> | ||
+ | <td class="ejLabel">Inventario</td> | ||
+ | <td> | ||
+ | <input id="inventario" type="text" size="10" style="background: #FF9;"> | ||
+ | <button id="obtenerInventario">Obtener inventario</button> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </code> | ||
+ | |||
+ | Creamos un manejador para el evento click del botón: | ||
+ | |||
+ | <code> | ||
+ | document.getElementById("obtenerInventario").onclick = function() { | ||
+ | // llama a catalis.xis para solicitar un nro. de inventario | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | === catalis.xis === | ||
+ | |||
+ | Agregar al cipar: | ||
+ | |||
+ | <code> | ||
+ | 'INVENTARIO.TXT=',v6003^b,'/catalis/',v2104,'/inventario.txt'/ | ||
+ | 'INVENTARIO.HTM=',... | ||
+ | </code> | ||
+ | |||
+ | Agregar tarea: | ||
+ | |||
+ | <code> | ||
+ | <!-- ----------------------------------------------------------------- --> | ||
+ | <label>DISPATCH</label> | ||
+ | <!-- ----------------------------------------------------------------- --> | ||
+ | <!-- Tareas a realizar por el script --> | ||
+ | <field action="replace" tag="2101"><pft> | ||
+ | ... | ||
+ | '~NEW_INVENTARIO' /* genera un nuevo nro. de inventario */ | ||
+ | '~', | ||
+ | </pft></field> | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | <!-- ----------------------------------------------------------------- --> | ||
+ | <label>NEW_INVENTARIO</label> | ||
+ | <!-- ----------------------------------------------------------------- --> | ||
+ | <include>catalis/xis/generar-inventario.xis</include> | ||
+ | <flow action="jump">END</flow> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | === generar-inventario.xis === | ||
+ | |||
+ | <code> | ||
+ | |||
+ | <!-- Generamos numero de inventario --> | ||
+ | <!-- ATENCION: definir correctamente la regla a utilizar --> | ||
+ | <field action="replace" tag="1"><pft> | ||
+ | replace(s(f(val(cat('INVENTARIO.TXT'))+1,6,0)),' ','0') | ||
+ | </pft></field> | ||
+ | |||
+ | <!-- Guardamos el nuevo numero en el archivo inventario.txt --> | ||
+ | <file action="create" type="output">INVENTARIO.TXT</file> | ||
+ | <display><pft>v1</pft></display> | ||
+ | <file action="close" type="output">INVENTARIO.TXT</file> | ||
+ | |||
+ | <!-- Enviamos el nuevo numero al cliente --> | ||
+ | <display><htmlpft><pft>cat('INVENTARIO.HTM')</pft></htmlpft></display> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | === inventario.htm === | ||
+ | |||
+ | <code> | ||
+ | |||
+ | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | ||
+ | <!-- | ||
+ | =========================================================================== | ||
+ | inventario.htm | ||
+ | |||
+ | Esta pagina va al IFRAME oculto. | ||
+ | Trae desde el servidor un numero de inventario. | ||
+ | Al cargarse, invoca a la funcion que presentara los datos en la pantalla. | ||
+ | | ||
+ | (c) 2007 Fernando J. Gomez - INMABB - CONICET | ||
+ | =========================================================================== | ||
+ | --> | ||
+ | |||
+ | <html> | ||
+ | <head> | ||
+ | <title></title> | ||
+ | <script type="text/javascript"> | ||
+ | function init() { | ||
+ | parent.showInventario(inventario); | ||
+ | } | ||
+ | | ||
+ | window.onload = init; | ||
+ | </script> | ||
+ | </head> | ||
+ | <body><!-- empty body --></body> | ||
+ | </html> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||
+ | === catalis.js === | ||
+ | |||
+ | Agregamos una función que presenta el nro. de inventario en el formulario de existencias: | ||
+ | |||
+ | <code> | ||
+ | // ----------------------------------------------------------------------------- | ||
+ | function showInventario(inventario) | ||
+ | // | ||
+ | // ----------------------------------------------------------------------------- | ||
+ | { | ||
+ | // coloca el valor en el input | ||
+ | document.getElementById("inventario").value = inventario; | ||
+ | // readonly? | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | {{tag>catalis desarrollo inventario}} |