elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


  Mostrar Temas
Páginas: [1]
1  Programación / PHP / ayuda con fpdf en: 14 Enero 2011, 00:29 am
tengo el siguiente problema... estoy elaborando un reporte en pdf.... para lo cual ya lo hace pero tengo un problema debido a que se indica en el codigo que solo me ponga hasta 20 registros maximo por pagina si me lo hace pro en la primera pagina, ya que pasa a la segunda tambien me pone los datos pero el problema es que me los empieza a pponer desde abajo y no me los pone al inicial la pagina.... aki les dejo el codigo e imagenes....
Citar
<?php

require('fpdf/fpdf.php');

//Connect to your database
include("conexion/conexion.php");

//Create new pdf file
$pdf=new FPDF('P','mm','Letter');

//Disable automatic page break
$pdf->SetAutoPageBreak(false);

//Add first page
$pdf->AddPage();

$pdf->Image('imagenes/xxx/xxx.png',170,5,35,20);
$pdf->Image('imagenes/xxx/xxx.png',10,5,35,20);
//Ensure table header is output
$pdf->SetFont('Arial','B',7);
$pdf->Cell(80);
$pdf->Cell(32,5,'ORDEN DE SALIDA',0,1,'C');
$pdf->Cell(80);
$pdf->Cell(32,2,'ASIGNACION EQUIPO DE COMPUTO',0,1,'C');
$pdf->Cell(80);
$pdf->Cell(32,5,'HERRAMIENTAS Y MATERIALES',0,1,'C');
//parte de la asignacion
$pdf->SetFont('Arial','B',15);
$pdf->Cell(95,4,'',0,1,'C');
$pdf->setfillcolor(116,219,253);
$pdf->Rect(10,26,195.8,7,"FD");
$pdf->Cell(97.9,7,'ORIGEN',1,0,'C');
$pdf->Cell(97.9,7,'DESTINO',1,1,'C');


//datos de la asignacion
$pdf->Cell(97.9,50,'',1,0);
$pdf->Cell(97.9,50,'',1,1);

//dtos asignacvion2
$pdf->SetFont('Arial','B',10);
$pdf->Text(11,38,'DIRECCION:');
$pdf->Text(11,45,'DIRECCION DE AREA:');
$pdf->Text(11,52,'SUBDIRECCION:');
$pdf->Text(11,59,'DEPARTAMENTO:');
$pdf->Text(11,66,'AUTORIZADO POR:');
$pdf->Text(11,73,'UBICACION:');
$pdf->Text(11,80,'TELEFONO:');
$pdf->Text(65,80,'EXT:');

$pdf->Text(108.5,38,'DIRECCION:');
$pdf->Text(108.5,45,'DIRECCION DE AREA:');
$pdf->Text(108.5,52,'SUBDIRECCION:');
$pdf->Text(108.5,59,'DEPARTAMENTO:');
$pdf->Text(108.5,66,'AUTORIZADO POR:');
$pdf->Text(108.5,73,'UBICACION:');
$pdf->Text(108.5,80,'TELEFONO:');
$pdf->Text(167.5,80,'EXT:');

//OBSERVACIONES Y FECHA
$pdf->SetFont('Arial','B',14);
$pdf->setfillcolor(116,219,253);
$pdf->Rect(10,83,195.8,7,"FD");
$pdf->Cell(97.9,7,'O B S E R V A C I O N E S',1,0,'C');
$pdf->Cell(97.9,7,'F E C H A',1,1,'C');
$pdf->Cell(97.9,7,'',1,0,'C');
$pdf->Cell(97.9,7,'',1,1,'C');

//descripcion
$pdf->SetFont('Arial','B',12);
$pdf->Cell(195.8,7,'DESCRIPCIÓN: ',1,1,'L');

//lineas (X1, Y1, X2, Y2)
$pdf->Line(80,102.5,43,102.5);//descripcion

//$pdf->Line(200,252,10,252);

$pdf->Line(104,38.5,32.5,38.5);//ORIGEN
$pdf->Line(104,45.5,49,45.5);
$pdf->Line(104,52.5,40,52.5);
$pdf->Line(104,59.5,42.5,59.5);
$pdf->Line(104,66.5,44.5,66.5);
$pdf->Line(104,73.5,32.5,73.5);
$pdf->Line(64,80.5,31.8,80.5);
$pdf->Line(104,80.5,73.5,80.5);

$pdf->Line(202,38.5,130,38.5);//DESTINO
$pdf->Line(202,45.5,147.5,45.5);
$pdf->Line(202,52.5,138,52.5);
$pdf->Line(202,59.5,140.2,59.5);
$pdf->Line(202,66.5,143,66.5);
$pdf->Line(202,73.5,130.5,73.5);
$pdf->Line(164.5,80.5,130,80.5);
$pdf->Line(202,80.5,176.5,80.5);

$pdf->Ln(1);
//$pdf->SetLineWidth(0.4);
$pdf->Cell(195.8,126.2,'',1,0);

//RESPONSABIILIDAD
$pdf->Rect(10,232.5,195.8,7,"FD");
$pdf->SetFont('Arial','B',8);
$pdf->Text(16.5,235.5,'El servidor publico es responsable de los bienes bajo su resguardo temporal, en caso de perdida, robo, extravio o daño por negligencia,');
$pdf->Text(40,238.5,'lo restituira con otro bien de similares caracteristicas, debiendo levantar el acta correspondiente.');

$pdf->setfillcolor(255,255,255);
$pdf->Rect(10,240,195.5,30,"DF");
$pdf->SetFont('Arial','B',10);
$pdf->Text(32,245,'ENTREGA BIEN');
$pdf->Text(94,245,'AUTORIZA SALIDA');
$pdf->Text(159,245,'RECIBE BIEN');
$pdf->SetFont('Arial','B',8);
$pdf->SetLineWidth(0.3);
$pdf->Line(70,261,17,261);
$pdf->Text(35,264,'Nombre y Firma');
$pdf->Line(137,261,82,261);
$pdf->Text(99,264,'Nombre y Firma');
$pdf->Line(145,261,199,261);
$pdf->Text(161,264,'Nombre y Firma');

//set initial y axis position per page
$y_axis_initial = 25;

//print column titles
$pdf->SetFillColor(116,219,253);
$pdf->SetFont('Arial','B',12);
$pdf->SetY($y_axis_initial);
$pdf->SetX(25);
$pdf->Ln(80);
$pdf->Cell(49,6,'INVENTARIO',1,0,'C',1);
$pdf->Cell(49,6,'MARCA',1,0,'C',1);
$pdf->Cell(49,6,'MODELO',1,0,'C',1);
$pdf->Cell(49,6,'SERIE',1,0,'C',1);

$y_axis = $y_axis + $row_height;

//Select the Products you want to show in your PDF file
$result=mysql_query('select inventario,marca,modelo,serie from inv_total ORDER BY inventario');

//initialize counter
$i = 0;

//Set maximum rows per page
$max = 20;

//Set Row Height
$row_height = 6;

while($row = mysql_fetch_array($result))
{
//If the current row is the last one, create new page and print column title
if ($i == $max)
{
$pdf->AddPage();

//print column titles for the current page
$pdf->SetY($y_axis_initial);
$pdf->SetX(25);
$pdf->Ln(10);
$pdf->SetFillColor(116,219,253);
$pdf->Cell(49,6,'INVENTARIO',1,0,'C',1);
$pdf->Cell(49,6,'MARCA',1,0,'C',1);
$pdf->Cell(49,6,'MODELO',1,0,'C',1);
$pdf->Cell(49,6,'SERIE',1,0,'C',1);

//Go to next row
$y_axis = $y_axis + $row_height;

//Set $i variable to 0 (first row)
$i = 0;

}

$pdf->SetFillColor(255,255,255);

$in = $row['inventario'];
$ma = $row['marca'];
$mo = $row['modelo'];
$sr = $row['serie'];

$pdf->SetFont('Arial','',12);
$pdf->SetY($y_axis);
$pdf->SetX(25);
$pdf->Ln(112);
$pdf->Cell(49,5,$in,1,0,'L',1);
$pdf->Cell(49,5,$ma,1,0,'C',1);
$pdf->Cell(49,5,$mo,1,0,'C',1);
$pdf->Cell(49,5,$sr,1,0,'C',1);
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
}

mysql_close;

//Send file
$pdf->Output();
?>

Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines