mirror of
https://github.com/rmontanana/inventario2.git
synced 2025-08-16 07:56:00 +00:00
ref #9 Crear etiquetas de un artículo. Cambiar el nombre del archivo por omisión del informe de etiquetas. Ajuste para cuadrar con etiquetas del centro.
This commit is contained in:
@@ -37,6 +37,7 @@ class EtiquetasPDF {
|
||||
private $docu;
|
||||
private $pdf;
|
||||
private $def;
|
||||
private $nombreFichero = "tmp/informeEtiquetas.pdf";
|
||||
|
||||
/**
|
||||
* El constructor recibe como argumento el nombre del archivo XML con la definición, encargándose de recuperarla y guardar toda la información localmente
|
||||
@@ -57,6 +58,7 @@ class EtiquetasPDF {
|
||||
$this->pdf = new FPDF();
|
||||
$this->pdf->SetMargins(0.2, 0.2, 0.2);
|
||||
$this->pdf->SetFont('Arial', '', 11);
|
||||
$this->pdf->setAutoPageBreak(false);
|
||||
//echo $def->Titulo.$def->Cabecera;
|
||||
$this->pdf->setAuthor(AUTOR, true);
|
||||
$creador = CENTRO . " " . PROGRAMA . VERSION;
|
||||
@@ -67,7 +69,6 @@ class EtiquetasPDF {
|
||||
|
||||
public function crea($definicion)
|
||||
{
|
||||
|
||||
//print_r($def);echo $bdd;die();
|
||||
// Iniciamos la creación del documento
|
||||
$this->def = simplexml_load_file($definicion);
|
||||
@@ -79,7 +80,7 @@ class EtiquetasPDF {
|
||||
$tamLinea = 5;
|
||||
$fila = -1;
|
||||
$primero = true; $i = 0;
|
||||
$url = split("/", $_SERVER['SCRIPT_NAME']);
|
||||
$url = explode("/", $_SERVER['SCRIPT_NAME']);
|
||||
$aplicacion = $url[1];
|
||||
$enlace = "http://".$_SERVER['SERVER_NAME']."/".$aplicacion."/index.php?elementos&opc=editar&id=";
|
||||
while($tupla = $this->bdd->procesaResultado()) {
|
||||
@@ -100,14 +101,14 @@ class EtiquetasPDF {
|
||||
}
|
||||
$primero = false;
|
||||
}
|
||||
$py = 6 + 39 * $fila;
|
||||
$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['descripcion']));
|
||||
$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']));
|
||||
@@ -120,7 +121,10 @@ class EtiquetasPDF {
|
||||
$py+=$tamLinea;
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, $tupla['fechaCompra']);
|
||||
$py+=$tamLinea;
|
||||
$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);
|
||||
@@ -144,7 +148,7 @@ class EtiquetasPDF {
|
||||
{
|
||||
$cabecera = "Content-type: application/pdf";
|
||||
$cabecera = $cabecera . "Content-length: " . strlen($this->docu);
|
||||
$cabecera = $cabecera . "Content-Disposition: inline; filename=tmp/Informe.pdf";
|
||||
$cabecera = $cabecera . "Content-Disposition: inline; filename=" . $this->nombreFichero;
|
||||
return $cabecera;
|
||||
}
|
||||
|
||||
@@ -153,6 +157,7 @@ class EtiquetasPDF {
|
||||
$fichero = fopen($nombre, "w");
|
||||
fwrite($fichero, $this->getCabecera());
|
||||
fwrite($fichero, $this->getContenido(), strlen($this->getContenido()));
|
||||
$this->nombreFichero = $nombre;
|
||||
fclose($fichero);
|
||||
}
|
||||
|
||||
@@ -161,7 +166,7 @@ class EtiquetasPDF {
|
||||
header("Content-type: application/pdf");
|
||||
$longitud = strlen($this->docu);
|
||||
header("Content-length: $longitud");
|
||||
header("Content-Disposition: inline; filename=tmp/Informe.pdf");
|
||||
header("Content-Disposition: inline; filename=" . $this->nombreFichero);
|
||||
}
|
||||
|
||||
public function imprimeInforme()
|
||||
@@ -169,7 +174,6 @@ class EtiquetasPDF {
|
||||
$this->enviaCabecera();
|
||||
echo $this->docu;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
26
xml/inventarioArticuloEtiquetas.xml
Normal file
26
xml/inventarioArticuloEtiquetas.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<Informe>
|
||||
<Titulo Texto="{Descripcion}" id="{id}"/>
|
||||
<Datos>
|
||||
<Consulta>
|
||||
select A.id as id, A.Descripcion as articulo, A.Marca as marca, A.Modelo as modelo, E.id as idEl, U.id as idUbic,U.Descripcion as ubicacion,E.numserie as numserie,
|
||||
E.fechaCompra as fechaCompra,E.Cantidad as cantidad, E.Cantidad as cantReal, 'N' as Baja
|
||||
from Elementos E, Articulos A, Ubicaciones U where A.id=E.id_Articulo and U.id=E.id_Ubicacion
|
||||
and A.id='{id}' order by U.Descripcion,numserie;
|
||||
</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="P" Formato="A4">
|
||||
<Cabecera>Articulo</Cabecera>
|
||||
<Cuerpo>
|
||||
<Col Nombre="Baja" Titulo="Baja"/>
|
||||
<Col Nombre="idEl" Titulo="idElem"/>
|
||||
<Col Nombre="idUbic" Titulo="idUbic"/>
|
||||
<Col Nombre="articulo" Titulo="Articulo"/>
|
||||
<Col Nombre="ubicacion" Titulo="Ubicación"/>
|
||||
<Col Nombre="numserie" Titulo="N Serie"/>
|
||||
<Col Nombre="fechaCompra" Titulo="Fecha C." />
|
||||
<Col Nombre="cantidad" Titulo="Cantidad"/>
|
||||
<Col Nombre="cantReal" Titulo="Cant. Real"/>
|
||||
</Cuerpo>
|
||||
</Pagina>
|
||||
</Informe>
|
@@ -3,8 +3,8 @@
|
||||
<Titulo Texto="{Descripcion}" id="{id}"/>
|
||||
<Datos>
|
||||
<Consulta>
|
||||
select A.id as idArt,E.id as idEl,U.id as idUbic,A.Marca as marca,A.Modelo as modelo,E.numSerie as numserie,
|
||||
E.fechaCompra as fechaCompra,A.Descripcion as descripcion,E.Cantidad as cantidad, E.Cantidad as cantReal, 'N' as Baja
|
||||
select A.id as idArt,E.id as idEl,U.id as idUbic,U.Descripcion as ubicacion,A.Marca as marca,A.Modelo as modelo,E.numSerie as numserie,
|
||||
E.fechaCompra as fechaCompra,A.Descripcion as articulo,E.Cantidad as cantidad, E.Cantidad as cantReal, 'N' as Baja
|
||||
from Elementos E, Articulos A, Ubicaciones U where A.id=E.id_Articulo and U.id=E.id_Ubicacion
|
||||
and U.id='{id}' order by A.descripcion;
|
||||
</Consulta>
|
||||
@@ -16,7 +16,8 @@
|
||||
<Col Nombre="idEl" Titulo="idElem"/>
|
||||
<Col Nombre="idArt" Titulo="idArt"/>
|
||||
<Col Nombre="idUbic" Titulo="idUbic"/>
|
||||
<Col Nombre="descripcion" Titulo="Artículo"/>
|
||||
<Col Nombre="ubicacion" Titulo="Ubicacion"/>
|
||||
<Col Nombre="articulo" Titulo="Artículo"/>
|
||||
<Col Nombre="marca" Titulo="Marca"/>
|
||||
<Col Nombre="modelo" Titulo="Modelo"/>
|
||||
<Col Nombre="numserie" Titulo="N Serie"/>
|
||||
|
Reference in New Issue
Block a user