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
|
class PDF extends FPDF{
function Header(){
//Logo
//$this->Image('../images/fond.png',10,10,100);
//Police Arial gras 15
$this->SetFont('Arial','BI',30);
//Décalage à droite
$this->Cell(170);
//Titre
$this->Cell(30,30,'Remise de Chèques',0,0,'C');
//Saut de ligne
$this->Ln(12);
}
//Pied de page
function Footer(){
//Positionnement à 1,5 cm du bas
$this->SetY(-10);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
//Numéro de page
$this->Cell(0,10,'Vivats-TLC',0,0,'C');
}
//Chargement des données
function LoadData($file){
//Lecture des lignes du fichier
$chaine2 = file_get_contents($file);
$lines = explode('<finCotisation>',$chaine2);
$data = array();
foreach($lines as $line)
$data[] = explode(';',chop($line));
return $data;
}
//Tableau coloré
function CotisationTable($header,$data){
//Couleurs, épaisseur du trait et police grasse
$this->SetFillColor(255,0,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,0,0);
$this->SetLineWidth(.1);
$this->SetFont('','B');
//En-tête
$w=array(40,40,40,25,30,30);
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C',1);
$this->Ln();
//Restauration des couleurs et de la police
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetFont('');
//Données
$fill=0;
foreach($data as $row){
$this->Cell($w[0],6,$row[0],'LR',0,'L');
$this->Cell($w[1],6,$row[1],'LR',0,'L');
$this->Cell($w[2],6,$row[2],'LR',0,'C');
$this->Cell($w[3],6,$row[3],'LR',0,'R');
$this->Cell($w[4],6,$row[4],'LR',0,'L');
$this->Cell($w[5],6,$row[5],'LR',0,'R');
$this->Ln();
$fill=!$fill;
}
//Trait de terminaison
$this->Cell(array_sum($w),0,'','T');
}
} |
Partager