Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/05/2004, 16:15
rogel
 
Fecha de Ingreso: noviembre-2003
Mensajes: 157
Antigüedad: 20 años, 6 meses
Puntos: 0
<?php
define('FPDF_FONTPATH','font/');
require('fpdf.php');
require("funciones/connect.php");
$numero=$_POST["boleta"];
class PDF extends FPDF
{
//Cabecera de página
function Header()
{
$this->setfont('arial','b',10);
$this->cell(0,10,'SEMINARIO PONTIFICIO DE SANTIAGO',0,0,'C');
$this->ln(5);
$this->cell(0,10,'LIBRERIA',0,0,'C');
$this->ln(20);
}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-15);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Número de página
$this->Cell(0,10,'Seminario Pontificio Mayor de Santiago - Libreria.',0,0,'C');
$this->ln(4);
$this->Cell(0,10,'Av. Walker Martínez 2020, La Florida, Santiago - Casilla 3-D - Teléfono: 4883800 - Fax: 4883811',0,0,'C');
}
}
//Creación del objeto de la clase heredada
$pdf=new PDF();
$pdf->Open();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->setfont('arial','',10);
$pdf->setx(25);
$pdf->Cell(30,10,'Comprador:',0,0,'R');
$string="select id,id_lib,cantidad,precio,rut,total,descuento,modo _pago,cheques,fecha,status from boletas where id='$numero'";
$resp=mysql_query($string,$link);
$rows=mysql_fetch_array($resp);
$nombre="select ap_paterno,ap_materno,nombres from clientes where rut='$rows[rut]'";
$resp_n=mysql_query($nombre,$link);
$r_n=mysql_fetch_array($resp_n);
$cliente=$r_n["nombres"]." ".$r_n["ap_paterno"]." ".$r_n["ap_materno"];
$pdf->setx(70);
$pdf->Cell(30,10,''.$cliente.'',0,0,'L');
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Fecha de Compra:',0,0,'R');
$cambio=explode("-",$rows["fecha"]);
$fecha=$cambio[2]."-".$cambio[1]."-".$cambio[0];
$pdf->setx(70);
$pdf->Cell(30,10,''.$fecha.'',0,0,'L');
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Descuento Aplicado:',0,0,'R');
$pdf->setx(70);
$pdf->Cell(20,10,''.$rows["descuento"].'',0,0,'L');
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Modo de Pago:',0,0,'R');
$pdf->setx(70);
$pdf->Cell(20,10,''.$rows["modo_pago"].'',0,0,'L');
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Cantidad de Cheques:',0,0,'R');
$pdf->setx(70);
$pdf->Cell(20,10,''.$rows["cheques"].'',0,0,'L');
if($rows["status"]=='cancelar'){
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Status Boleta:',0,0,'R');
$pdf->setx(70);
$pdf->Cell(20,10,'Cancelada',0,0,'L');
}else{
$pdf->ln(6);
$pdf->setx(25);
$pdf->Cell(30,10,'Status Boleta:',0,0,'R');
$pdf->setx(70);
$pdf->Cell(20,10,'Adeudada',0,0,'L');
}
$pdf->ln(20);
$pdf->setx(60);
$pdf->Cell(20,6,'Cantidad',1,0,'C');
$pdf->setx(80);
$pdf->Cell(50,6,'Código Producto',1,0,'C');
$pdf->setx(130);
$pdf->Cell(30,6,'Precio de Venta',1,0,'C');
$array="select id_lib,cantidad,precio from boletas where id='$numero'";
$resp_array=mysql_query($array,$link);
while($rows_array=mysql_fetch_array($resp_array)){
$pdf->ln(6);
$pdf->setx(60);
$pdf->Cell(20,6,''.$rows_array["cantidad"].'',1,0,'C');
$pdf->setx(80);
$pdf->Cell(50,6,''.$rows_array["id_lib"].'',1,0,'C');
$pdf->setx(130);
$pdf->Cell(30,6,''.$rows_array["precio"].'',1,0,'C');
}
$pdf->ln(6);
$pdf->setx(80);
$pdf->Cell(30,6,'Total Boleta:',1,0,'C');
$pdf->setx(110);
$pdf->Cell(50,6,''.$rows["total"].'',1,0,'C');
$pdf->Output();
?>

ok este es el código