Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/09/2010, 12:30
geandisa
 
Fecha de Ingreso: septiembre-2010
Mensajes: 2
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: Impresion en pdf

Si ya descarge el archivo FPDF pero al imprimir solo me imprime el ultimo registro
este es el codigo

<?php
session_start();
?>
<?php
session_start();
?>
<?php
require('fpdf/fpdf.php');
require('conexion.php');
class PDF extends FPDF
{
var $widths;
var $aligns;
function SetWidths($w)
{
$this->widths=$w;
}
function SetAligns($a)
{
$this->aligns=$a;
}
function Row($data)
{
$nb=0;
for($i=0;$i<count($data);$i++)
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
$h=4*$nb;
$this->CheckPageBreak($h);
for($i=0;$i<count($data);$i++)
{
$w=$this->widths[$i];
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
$x=$this->GetX();
$y=$this->GetY();
$this->MultiCell($w,4,$data[$i],0,$a);
$this->SetXY($x+$w,$y);
}
$this->Ln($h);
}
function CheckPageBreak($h)
{
if($this->GetY()+$h>$this->PageBreakTrigger)
$this->AddPage($this->CurOrientation);
}
function NbLines($w,$txt)
{
$cw=&$this->CurrentFont['cw'];
if($w==0)
$w=$this->w-$this->rMargin-$this->x;
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
while($i<$nb)
{
$c=$s[$i];
if($c=="\n")
{
$i++;
$sep=-1;
$j=$i;
$l=0;
$nl++;
continue;
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1)
{
if($i==$j)
$i++;
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
function Header()
{
//$this->Image('ima_acedemi\LogoAunar.png',015,15,58);
//$this->Image('ima_acedemi\EscuAunar.png',240,15,20);
$this->Ln(05);
$this->SetFont('Arial','B',15);
$this->Cell(115);
$this->Cell(30,10,'AUNAR',0,2,'C');
$this->SetFont('Arial','B',10);
$this->Cell(30,10,'Extension Cali',0,1,'C');
$this->Cell(260,10,'MATRICULA ACADEMICA',1,1,'C');
$this->SetFont('Arial','B',7);
$this->Ln(01);
}
function Footer()
{
$this->SetY(-15);
$this->SetFont('Arial','B',8);
$this->Cell(50,10,'Registro y Control Academico',0,0,'R');
$this->Cell(180);
$this->Cell(20,10,'Page '.$this->PageNo().'',0,0,'L');
}
}
$cosed = $_GET['cosed'];
$copro = $_GET['copro'];
$cod_pl = $_GET['cod_pl'];
$per_mt = $_GET['per_mt'];
$jor_mt = $_GET['jor_mt'];
$ide_e = $_GET['ide_e'];

$pdf=new PDF('L','mm','Letter');
$pdf->Open();
$pdf->AddPage();
$pdf->Cell(30,9,$cosed,1,0,'C');
$pdf->Cell(30,9,$copro,1,0,'C');
$pdf->Cell(30,9,$cod_pl,1,0,'C');
$pdf->Cell(30,9,$per_mt,1,0,'C');
$pdf->Cell(30,9,$jor_mt,1,0,'C');
$pdf->Cell(30,9,$ide_e,1,1,'C');

$con = new DB;
$matricula = $con->conectar();
$strConsulta = "SELECT * from programa
where cod_pro = '$copro'";
$matricula = mysql_query($strConsulta);
$numfilas = mysql_num_rows($matricula);
$fila = mysql_fetch_array($matricula);
$nopro = $fila[1];
$tipro = $fila[2];
$pdf->Cell(30,9,$copro,1,0,'C');
$pdf->Cell(30,9,$nopro,1,0,'C');
$pdf->Cell(30,9,$tipro,1,0,'C');
$pdf->Cell(30,9,$numfilas,1,0,'C');

$pdf->SetMargins(10,10,10,20,10,10,10);
$pdf->SetFont('Arial','B',8);
$pdf->SetWidths(array(20, 20, 70, 20, 20, 20, 20));

for ($i=0; $i<$numfilas; $i++)
{
$busca ="select nom_mat,sem_mat,tip_mat,not_mat,cre_mat
from materia";
$eje1 = mysql_query($busca);
$nrow1 = mysql_num_rows($eje1);
$sem_m = $nrow1['sem_mat'];
$nom_m = $nrow1['nom_mat'];
$tip_m = $nrow1['tip_mat'];
$not_m = $nrow1['not_mat'];
$cre_m = $nrow1['cre_mat'];
$pdf->Cell(20,9,$sem_m,1,0,'C');
$pdf->Cell(20,9,$cod_m[$i],1,0,'C');
$pdf->Cell(20,9,$nom_m,1,0,'C');
$pdf->Cell(20,9,$jor_m[$i],1,0,'C');
$pdf->Cell(20,9,$tip_m,1,0,'C');
$pdf->Cell(20,9,$not_m,1,0,'C');
$pdf->Cell(20,9,$cre_m,1,0,'C');
$pdf->Ln();
}
$pdf->Output();
?>