![Stress](http://static.forosdelweb.com/fdwtheme/images/smilies/stress.png)
![Confundido](http://static.forosdelweb.com/fdwtheme/images/smilies/confused.png)
OJALA ME PUEDAN AYUDAR
![sonrisota](http://static.forosdelweb.com/fdwtheme/images/smilies/xD.png)
....GRACIAS POR SU AYUDA...
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
.................................................. .................................................. .....................
<?php
require('/fpdf/fpdf.php');
class PDF extends FPDF
{
function Header(){
// Logo
$this->Image('udg.gif',30,10,20,23);
$this->Ln(10);
$this->SetFont('Arial','B',13);
$this->Cell(100);
// Título
$this->Cell(30,7,'Historial de Abonos Registrados',0,1,'C');
$this->Cell(100);
$this->Ln(10);
}
// Pie de página
function Footer(){
$week_days = array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");
$monts = array("","Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
$week_days_now = date("w");
$day_now = date("d");
$mont_now = date("n");
$year_now = date("Y");
$hora = date("H:i:s");
$date = $week_days[$week_days_now].", ".$day_now . " " ." de ".$monts[$mont_now]." de ".$year_now." - ".$hora;
$this->SetY(-12);
$this->SetFont('Arial','I',8);
// Número de página
$this->Cell(0,10,'Pagina '.$this->PageNo().' de {nb}'.' '.$date,0,0,'C');
}
//Tabla coloreada
function FancyTable($encabezados,$result)
{
//Colores, ancho de línea y fuente en negrita
$this->Cell(20);
$this->SetFillColor(62,102,60);
$this->SetTextColor(255);
$this->SetDrawColor(0,0,0);
$this->SetLineWidth(.3);
$this->SetFont('','I');
//Cabecera
$w=array(50,20,35,30,33,30);
for($i=0;$i<count($encabezados);$i++)
$this->Cell($w[$i],7,$encabezados[$i],1,0,'C',1);
$this->Ln();
//Restauración de colores y fuentes
$this->SetFillColor(244,244,244);
$this->SetTextColor(0);
$this->SetFont('');
//Datos
$fill=true;
$y=20;
while ($row = mysql_fetch_array($result)){
$this->Cell(20);
$this->Cell($w[0],10,$row[0],'LR',0,'C',$fill);
$this->Cell($w[1],10,$row[1],'LR',0,'C',$fill);
$this->Cell($w[2],10,$row[2],'LR',0,'C',$fill);
$this->Cell($w[3],10,$row[3],'LR',0,'C',$fill);
$this->Cell($w[4],10,$row[4],'LR',0,'C',$fill);
$this->Cell($w[5],10,$row[5],'LR',0,'C',$fill);
$this->Ln();
}
}
} //fin de la definicion de la clase extendida de fpdf
//----------------------------------------------------
$conexion=mysql_connect("localhost","root","");
mysql_select_db("zapateria",$conexion);;
$result = mysql_query("SELECT cliente.nombre,abonos.cliente,abonos.fecha,abonos. saldo_debe,abonos.cant_abono,abonos.saldo_actual FROM abonos, cliente where abonos.cliente=cliente.id_cliente order by abonos.cliente,abonos.fecha", $conexion);
if ($row = mysql_fetch_array($result))
{
$pdf=new PDF('L','mm','Letter');
$pdf->AliasNbPages();
//Titulos de las columnas
$encabezados=array('Nombre','Codigo','Fecha','Sald o Total','Saldo Abonado','Saldo Actual');
$pdf->SetFont('Arial','',12);
$pdf->AddPage();
$pdf->FancyTable($encabezados,$result); //dibuja la tabla con la funcion FancyTable
$pdf->Output();
}
else
{
echo "¡ La base de datos está vacia !";
}
?>