From ce796b36845a14111d7f8ae3d338d54914f87781 Mon Sep 17 00:00:00 2001 From: rmontanana Date: Thu, 24 Apr 2014 12:27:31 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Fix#34=20Corregido=20que=20salga=20una=20et?= =?UTF-8?q?iqueta=20por=20cada=20elemento=20reflejado=20en=20cantidad.=20F?= =?UTF-8?q?ix#33=20Hay=20que=20hacer=20doble=20click=20para=20editar=20aja?= =?UTF-8?q?x=20Fix#32=20A=C3=B1adido=20mensaje=20y=20enlace=20al=20tipo=20?= =?UTF-8?q?de=20etiquetas=20que=20utiliza=20y=20corregido=20mensaje=20de?= =?UTF-8?q?=20error=20de=20conexi=C3=B3n=20a=20base=20de=20datos=20de=20SQ?= =?UTF-8?q?L?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EtiquetasPDF.php | 91 ++++++++++++++++++++++--------------------- InformeInventario.php | 2 +- Instalar.php | 8 ++-- Mantenimiento.php | 2 +- Sql.php | 2 +- sql/setup.sql | 8 ++-- 6 files changed, 58 insertions(+), 55 deletions(-) diff --git a/EtiquetasPDF.php b/EtiquetasPDF.php index ae00d1e..e4713fd 100644 --- a/EtiquetasPDF.php +++ b/EtiquetasPDF.php @@ -83,52 +83,55 @@ class EtiquetasPDF { $aplicacion = $url[1]; $protocolo = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://"; $enlace = $protocolo . $_SERVER['SERVER_NAME'] . "/" . $aplicacion . "/index.php?elementos&opc=editar&id="; - while($tupla = $this->bdd->procesaResultado()) { - if ($i % 2) { - //Columna 2 - $etiq1 = 136; - $etiq2 = 105; - } else { - //Columna 1 - $etiq1 = 30; - $etiq2 = 1; - $fila++; - } - if ($i % 14 == 0) { - if (!$primero) { - $this->pdf->AddPage(); - $fila = 0; + while($tupla = $this->bdd->procesaResultado()) { + for ($j = 0; $j < $tupla['cantidad']; $j++) { + //Hay que generar tantas etiquetas como ponga la cantidad de cada elemento + if ($i % 2) { + //Columna 2 + $etiq1 = 136; + $etiq2 = 105; + } else { + //Columna 1 + $etiq1 = 30; + $etiq2 = 1; + $fila++; } - $primero = false; + if ($i % 14 == 0) { + if (!$primero) { + $this->pdf->AddPage(); + $fila = 0; + } + $primero = false; + } + $py = 6 + 41 * $fila; + $enlace2=$enlace.$tupla['idEl']; + $fichero = "tmp/etiq".rand(1000,9999).".png"; + QRcode::png($enlace2, $fichero); + $this->pdf->image($fichero, $etiq2, $py, 30, 30); + unlink($fichero); + $this->pdf->setxy($etiq1, $py); + $this->pdf->Cell(30, 10, utf8_decode($tupla['articulo'])); + $py+=$tamLinea; + $this->pdf->setxy($etiq1, $py); + $this->pdf->Cell(30, 10, utf8_decode($tupla['marca'])); + $py+=$tamLinea; + $this->pdf->setxy($etiq1, $py); + $this->pdf->Cell(30, 10, utf8_decode($tupla['modelo'])); + $py+=$tamLinea; + $this->pdf->setxy($etiq1, $py); + $this->pdf->Cell(30, 10, utf8_decode($tupla['numserie'])); + $py+=$tamLinea; + $this->pdf->setxy($etiq1, $py); + $this->pdf->Cell(30, 10, $tupla['fechaCompra']); + $py+=$tamLinea-1; + $this->pdf->setxy($etiq2, $py); + $this->pdf->Cell(30, 10, utf8_decode($tupla['ubicacion'])); + $py+=$tamLinea-1; + $this->pdf->setxy($etiq2, $py); + $cadena = "idElemento=" . $tupla['idEl'] . " / idArticulo=" . $tupla['idArt'] . " / idUbicacion=" . $tupla['idUbic']; + $this->pdf->Cell(30, 10, $cadena); + $i++; } - $py = 6 + 41 * $fila; - $enlace2=$enlace.$tupla['idEl']; - $fichero = "tmp/etiq".rand(1000,9999).".png"; - QRcode::png($enlace2, $fichero); - $this->pdf->image($fichero, $etiq2, $py, 30, 30); - unlink($fichero); - $this->pdf->setxy($etiq1, $py); - $this->pdf->Cell(30, 10, utf8_decode($tupla['articulo'])); - $py+=$tamLinea; - $this->pdf->setxy($etiq1, $py); - $this->pdf->Cell(30, 10, utf8_decode($tupla['marca'])); - $py+=$tamLinea; - $this->pdf->setxy($etiq1, $py); - $this->pdf->Cell(30, 10, utf8_decode($tupla['modelo'])); - $py+=$tamLinea; - $this->pdf->setxy($etiq1, $py); - $this->pdf->Cell(30, 10, utf8_decode($tupla['numserie'])); - $py+=$tamLinea; - $this->pdf->setxy($etiq1, $py); - $this->pdf->Cell(30, 10, $tupla['fechaCompra']); - $py+=$tamLinea-1; - $this->pdf->setxy($etiq2, $py); - $this->pdf->Cell(30, 10, utf8_decode($tupla['ubicacion'])); - $py+=$tamLinea-1; - $this->pdf->setxy($etiq2, $py); - $cadena = "idElemento=" . $tupla['idEl'] . " / idArticulo=" . $tupla['idArt'] . " / idUbicacion=" . $tupla['idUbic']; - $this->pdf->Cell(30, 10, $cadena); - $i++; } //$this->pdf->MultiCell(0,30,var_export($filas,true)); } diff --git a/InformeInventario.php b/InformeInventario.php index 47953a4..904fb95 100644 --- a/InformeInventario.php +++ b/InformeInventario.php @@ -204,7 +204,7 @@ class InformeInventario { "; $salida.='
'; $salida.='
'; - $salida.='
'; + $salida.='
'; $salida.="

"; $salida.='


' . "\n"; $salida.=""; diff --git a/Instalar.php b/Instalar.php index 609b2a3..8b48bdc 100644 --- a/Instalar.php +++ b/Instalar.php @@ -332,8 +332,8 @@ class Instalar { $borra_database = "DROP DATABASE " . BASEDATOS . " ;"; $database = "CREATE DATABASE " . BASEDATOS . " DEFAULT CHARACTER SET utf8;"; $articulos = "CREATE TABLE `Articulos` ( - `id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable', - `descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo', + `id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable,link/Articulo', + `descripcion` varchar(60) NOT NULL COMMENT 'ordenable,ajax/text', `marca` varchar(20) default NULL COMMENT 'ordenable,ajax/text', `modelo` varchar(20) default NULL COMMENT 'ordenable,ajax/text', `cantidad` int(11) default NULL COMMENT 'ordenable,ajax/number', @@ -342,8 +342,8 @@ class Instalar { ) ENGINE=InnoDB AUTO_INCREMENT=769 DEFAULT CHARSET=utf8; "; $ubicaciones = "CREATE TABLE `Ubicaciones` ( - `id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable', - `Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion', + `id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable,link/Ubicacion', + `Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,ajax/text', `imagen` varchar(45) DEFAULT NULL COMMENT 'imagen', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=utf8; diff --git a/Mantenimiento.php b/Mantenimiento.php index 6f7d423..78493b8 100644 --- a/Mantenimiento.php +++ b/Mantenimiento.php @@ -843,7 +843,7 @@ class Mantenimiento { $valorSelect = 'data-value="'.$valorDato.'" '; $remoto = $valorSelect . ' data-sourceCache="true" data-sourceError="Error cargando datos" data-source="Ajax.php?opc=get&tabla='.$tabla2.'"'; } - $mensaje = '' . $valor . ' + $mensaje = '' . $valor . ' '; + //$salida .= ''; $salida .='
'; $salida .= '
' . "\n"; - $salida .= "

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

Elige Archivo

\n"; //$salida .= ''; //$salida .= ''; //$salida .= ''; @@ -74,12 +74,11 @@ class Importacion { Cambiar Eliminar
- '; + '; $salida .= '


' . "\n"; $salida .= ''; $mensaje = 'Sólo se permiten archivos con extensión CSV'; - $salida .= "