1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
<?php
ob_start();
include('../fpdf.php');
//Connect to your database
include("../inc/inc_connexion.php");
ob_end_clean();
//Create new pdf file
$pdf=new FPDF();
//Disable automatic page break
$pdf->SetAutoPageBreak(false);
//Add first page
$pdf->AddPage();
//set initial y axis position per page
$y_axis_initial = 25;
//print column titles
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',12);
$pdf->SetY($y_axis_initial);
$pdf->SetX(25);
$pdf->Cell(30,6,'NUMERO',1,0,'L',1);
$pdf->Cell(80,6,'SOCIETE',1,0,'L',1);
$pdf->Cell(30,6,'FACTURE',1,0,'L',1);
$pdf->Cell(30,6,'MONTANT',1,0,'R',1);
//******************************************************************
$y_axis = $y_axis + $row_height; // problème sur cette ligne
//******************************************************************
//Select the Products you want to show in your PDF file
$result=mysql_query('select fact_id,fact_facture,fact_montant,soc_societe from facture,societe WHERE soc_id = fact_id ORDER BY fact_id');
//initialize counter
$i = 0;
//Set maximum rows per page
$max = 25;
//Set Row Height
$row_height = 6;
while($row = mysql_fetch_array($result))
{
//If the current row is the last one, create new page and print column title
if ($i == $max)
{
$pdf->AddPage();
//print column titles for the current page
$pdf->SetY($y_axis_initial);
$pdf->SetX(25);
$pdf->Cell(30,6,'NUMERO',1,0,'L',1);
$pdf->Cell(80,6,'SOCIETE',1,0,'L',1);
$pdf->Cell(30,6,'FACTURE',1,0,'L',1);
$pdf->Cell(30,6,'MONTANT',1,0,'R',1);
//******************************************************************
//Go to next row
$y_axis = $y_axis + $row_height; // problème sur cette ligne
//******************************************************************
//Set $i variable to 0 (first row)
$i = 0;
}
$numero = $row['fact_id'];
$societe = $row['soc_societe'];
$facture = $row['fact_facture'];
$montant = $row['fact_montant'];
//******************************************************************
$pdf->SetY($y_axis); // problème sur cette ligne
//******************************************************************
$pdf->SetX(25);
$pdf->Cell(30,6,$numero,1,0,'L',1);
$pdf->Cell(80,6,$societe,1,0,'L',1);
$pdf->Cell(30,6,$facture,1,0,'L',1);
$pdf->Cell(30,6,$montant,1,0,'R',1);
//******************************************************************
//Go to next row
$y_axis = $y_axis + $row_height; // problème sur cette ligne
//******************************************************************
$i = $i + 1;
}
//Send file
$pdf->Output();
?> |
Partager