<?php
$conexion = pg_connect("host=localhost port=5432 dbname=administra user=postgres password=/*parW");
//define('./PDF/font/');
require('WriteTag.php');
$recibos = "SELECT * FROM vrecibos";
class PDF extends PDF_WriteTag
{
//Cabecera de página
function Header()
{
$this->Cell(20, 5, 'Listado de Ingresos por Meses', 0, 0, 'L');
$this->Ln(6);
$this->Cell(20, 5, 'Fecha: '.date('d/m/Y'), 0, 1, 'L');
//Logo
/*$this->Image('archivo',x,y,w,h);*/
//$this->Image('imagenes/dibujo.JPG',55,10,100,20);
$this->Ln(20);
$this->Cell(20,4,'RECIBO',0,0,'C');
$this->SetFont('Arial','B',8);
$this->Ln(8);
}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-12);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Número de página
$this->Cell(0,10,'Pag '.$this->PageNo(),0,0,'C');
}
}
//--Fin de la Clase
//Creación del objeto de la clase heredada
$pdf=new PDF('P','mm','Letter');
$nroapto = '';
$seleccionados = @pg_query($conexion,$recibos);
while($select2 = @pg_fetch_array($seleccionados)):
$nombres = $select2['nombres'];
if ($select2['nroapto']!=$nroapto)
{
$pdf->AddPage();
$pdf->SetFont('Arial','B',8);
$pdf->Cell(16,4,$nombres,0,0,'R');
$pdf->Ln(4);
}
$nroapto = $select2['nroapto'];
$totalmonto +=$monto;
$pdf->SetFont('Arial','I',8);
$pdf->Cell(47,4,$select2['descripcion'],0,0,'L');
$pdf->Cell(90,4,$select2['monto'],0,1,'R');
$pdf->ln();
$pdf->SetFont('Arial','I',8);
endwhile;
$pdf->Output();
$pdf->Close();
?>