Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   PHP (https://www.clubdelphi.com/foros/forumdisplay.php?f=15)
-   -   mostrar datos en pdf (https://www.clubdelphi.com/foros/showthread.php?t=56017)

lakers 05-05-2008 15:37:25

mostrar datos en pdf
 
hola muy buenas
gracias a toda la gente que dedica parte de su tiempo para ayudarnos
estoy intentando hacer una factura en pdf usando la libreria (fpdf).
el problema que tengo es la hora de mostrar los datos de factura con el siguiente orden:
ref descr cantidad precio %desc importe



al final tengo que mostrar en el siguiente orden:
neto cuota(iva) iva total

no consigo que los datos se muestran en su sitio correspondiente.sobre todo tienes que ir simpre con las coordenadas (Cell,etc......).
si alguien ha utilizado esta libreria para generar facturas o algo parecido estaré agradecido a quién me puede ayudar.
aqui os dejo parte del script que hice:
Código PHP:

define('FPDF_FONTPATH','font/');
require(
'table.php');
class 
PDF extends PDF_MySQL_Table
{
function 
Header()
{
    
//Titre
   
$this->Image('aval.jpg',90,10,45);
     
//$this->Cell(0,6,'Eje de factura',0,1,'C');
  
$this->SetFont('Arial','',20);
  
$this->Cell(40,10,'luisito ',0,1,'C');
    
// $this->Ln(1);
  
$this->SetFont('Arial','',8);
  
$this->Ln(8);
    
//Imprime l'en-tête du tableau si nécessaire
    
parent::Header();
}
}
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->Ln(20); //salto de linea
$c=mysql_connect("localhost","","host") or die ("problemas al establecer la conexion");
mysql_select_db("prof") or die ("problemas al seleccionar la base de datos ");
$query="select * from facturas where codfactura=1";
$res=mysql_query($query,$c); 
$fila=mysql_fetch_array($res);   
   
//Títulos de las columnas
 
    
$pdf->SetFillColor(200,200,200);
    
$pdf->SetTextColor(0);
    
$pdf->SetDrawColor(0,0,0);
    
$pdf->SetLineWidth(.2);
    
$pdf->SetFont('Arial','B',10);
 
    
$pdf->Cell(80);
    
$pdf->Cell(20,4,"DNI/CIF",1,0,'C',1);
    
$pdf->Cell(30,4,"Nombre",1,0,'C',1);
    
$pdf->Cell(30,4,"Fecha",1,0,'C',1); 
    
$pdf->Cell(30,4,"Nº Fact.",1,0,'C',1);
    
$pdf->Ln();
 
    
$pdf->Cell(80);
    
$pdf->SetFillColor(255,255,255);
    
$pdf->SetTextColor(0);
    
$pdf->SetDrawColor(0,0,0);
    
$pdf->SetLineWidth(.2);
    
$pdf->SetFont('Arial','B',10); 
    
$pdf->SetX(10);
    
$pdf->Cell(80);
    
$pdf->Cell(20,4,$fila["nif"],1,0,'C',1);
    
$pdf->Cell(30,4,$fila["nombre"],1,0,'C',1);
    
$pdf->Cell(30,4,$fila["fecha"],1,0,'C',1); 
    
$pdf->Cell(30,4,$fila["numfact"],1,0,'C',1); 
    
//Restauración de colores y fuentes
    /*$pdf->SetFillColor(224,235,255);
    $pdf->SetTextColor(0);
    $pdf->SetFont('Arial','B',7);
    $pdf->Ln(10);  
    $pdf->Cell(66);*/
 
 
 
$pdf->Ln(10);  
 
$pdf->Cell(1);
 
$pdf->SetFillColor(200,200,200);
 
$pdf->SetTextColor(0);
 
$pdf->SetDrawColor(0,0,0);
 
$pdf->SetLineWidth(.2);
 
$pdf->SetFont('Arial','B',10);
 
 
$pdf->Cell(15,4,"Ref",1,0,'C',1);
 
$pdf->Cell(105,4,"Descripción",1,0,'C',1);
 
$pdf->Cell(20,4,"Cantidad",1,0,'C',1); 
 
$pdf->Cell(15,4,"Precio",1,0,'C',1);
 
$pdf->Cell(15,4,"% Desc.",1,0,'C',1);
 
$pdf->Cell(20,4,"Importe",1,0,'C',1);
 
$pdf->Ln(4);  
 
    
$pdf->SetFillColor(224,235,255);
    
$pdf->SetTextColor(0);
    
$pdf->SetDrawColor(0,0,0);
    
$pdf->SetLineWidth(.2);
    
$pdf->SetFont('Arial','',9);
    
//$pdf->Cell();
 
 
 
 
 
while ($contador<25
 {
   
$pdf->Cell(1);
   
$pdf->Cell(15,4,"",'LR',0,'C');
   
$pdf->Cell(105,4,"",'LR',0,'C');
   
$pdf->Cell(20,4,"",'LR',0,'C'); 
   
$pdf->Cell(15,4,"",'LR',0,'C');
   
$pdf->Cell(15,4,"",'LR',0,'C');
   
$pdf->Cell(20,4,"",'LR',0,'C');
   
$pdf->Ln(4); 
   
$contador=$contador +1;
 }   
 
/*$pdf->SetFillColor(224,235,255);
    $pdf->SetTextColor(0);
    $pdf->SetDrawColor(0,0,0);
    $pdf->SetLineWidth(.2);
    $pdf->SetFont('Arial','',9);*/
 
$pdf->Cell(1);
 
$pdf->Cell(15,4,"",'LRB',0,'C');
 
$pdf->Cell(105,4,"",'LRB',0,'C');
 
$pdf->Cell(20,4,"",'LRB',0,'C'); 
 
$pdf->Cell(15,4,"",'LRB ',0,'C');
 
$pdf->Cell(15,4,"",'LRB',0,'C');
 
$pdf->Cell(20,4,"",'LRB',0,'C');
 
$pdf->Ln(4);  
 
//ahora mostramos el final de la factura
 
$pdf->Ln(10);  
 
$pdf->Cell(66); 
 
    
$pdf->SetFillColor(200,200,200);
    
$pdf->SetTextColor(0);
    
$pdf->SetDrawColor(0,0,0);
    
$pdf->SetLineWidth(.2);
    
$pdf->SetFont('Arial','B',10);
 
 
$pdf->Cell(30,4,"NETO",1,0,'C',1);
 
$pdf->Cell(30,4,"CUOTA IVA",1,0,'C',1);
 
$pdf->Cell(30,4,"IVA",1,0,'C',1); 
 
$pdf->Cell(35,4,"TOTAL",1,0,'C',1);
 
$pdf->Ln(4);
 
 
$pdf->SetFillColor(255,255,255);
 
$pdf->SetTextColor(0);
 
$pdf->SetDrawColor(0,0,0);
 
$pdf->SetLineWidth(.2);
 
$pdf->SetFont('Arial','B',10);
 
 
$pdf->Cell(66);
 
$pdf->Output(); 

gracias de antemano por vuestra ayuda.
saludos.


La franja horaria es GMT +2. Ahora son las 19:19:25.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi