function afficherPDF($vpdf) { require 'fpdf/mc_table.php'; $pdf = ob_get_clean(); $pdf = new PDF_MC_Table(); $pdf->AddPage(); $pdf->SetFont('Times', '', 12); $pdf->Image("images/logo.png", 7, 5, 50.9); $pdf->SetXY(9, 15); $pdf->RoundedRect(95, 54, 110, 35, 2, 'D'); $pdf->SetXY(9, 40); $pdf->MultiCell(80, 5, utf8_decode("Siège social : GSB\nPhiladelphie, \nPennsylvanie, Etats-Unis\ngsb_galaxybourdin@gmail.com "), 0, "L", 0); $pdf->SetXY(100, 57); $pdf->MultiCell(100, 7, utf8_decode("Client : " . $vpdf['nom'] . " " . $vpdf['prenom'] . "\nAdresse : " . $vpdf['adresse'] . "\nCode postal : " . $vpdf['cp'] . "\nVille : " . $vpdf['ville']), 0, "L", 0); $pdf->SetXY(9, 100); $pdf->MultiCell(80, 5, utf8_decode("Remboursement du : " . $vpdf['numMois'] . " / " . $vpdf['numAnnee']), 0, "L", 0); $pdf->SetWidths(array(47.5, 47.5, 47.5, 47.5)); srand(microtime() * 1000000); $pdf->SetXY(10, 110); $pdf->MultiCell(190, 7, utf8_decode('Eléments forfaitisés'), 1, "L", 0); $pdf->Row2(array('Frais forfaitaires', utf8_decode('Quantité'), 'Montant unitaire', 'Montant total')); $pdf->Row2(array($vpdf['libelle'][0], utf8_decode($vpdf['quantite'][0]), $vpdf['montant'][0], $vpdf['montantT'][0] . " " . html_entity_decode($vpdf['euros']))); $pdf->Row2(array(utf8_decode($vpdf['libelle'][1]), utf8_decode($vpdf['quantite'][1]), $vpdf['montant'][1], $vpdf['montantT'][1] . " " . html_entity_decode($vpdf['euros']))); $pdf->Row2(array(utf8_decode($vpdf['libelle'][2]), utf8_decode($vpdf['quantite'][2]), $vpdf['montant'][2], $vpdf['montantT'][2] . " " . html_entity_decode($vpdf['euros']))); $pdf->Row2(array(utf8_decode($vpdf['libelle'][3]), utf8_decode($vpdf['quantite'][3]), $vpdf['montant'][3], $vpdf['montantT'][3] . " " . html_entity_decode($vpdf['euros']))); $pdf->SetXY(10, 157); mysql_connect('localhost', 'root', ''); mysql_select_db('gsbv2'); //First table: put all columns automatically $pdf->MultiCell(190, 7, utf8_decode('Eléments hors forfait'), 1, "L", 0); $prop = array('HeaderColor' => array(205, 216, 211), 'color1' => array(255, 255, 255), 'color2' => array(255, 255, 250), 'padding' => 2); $pdf->AddCol('date', 35, '', 'Date'); $pdf->AddCol('libelle', 105, 'Libelle'); $pdf->AddCol('montant', 50, 'Montant', 'R'); $pdf->Table("select date,libelle,montant from lignefraishorsforfait lf where lf.mois='" . $vpdf['mois'] . "' and lf.idVisiteur='" . $vpdf['id'] . "' " . "UNION ALL (select date,libelle,montant as idlfr from lignefraishorsforfaitrefuse lfr where lfr.mois='" . $vpdf['mois'] . "' and lfr.idVisiteur='" . $vpdf['id'] . "')", $prop); $pdf->SetXY(10, 200); $pdf->SetXY(130, 230); $pdf->MultiCell(70, 7, "Total du " . $vpdf['numMois'] . " / " . $vpdf['numAnnee'] . " : " . $vpdf['montVal'] . " " . html_entity_decode($vpdf['euros']) . "\nNombre de justificatifs : " . $vpdf['nbJust'] . " fiche(s)" . utf8_decode("\nMontant refusé : ") . $vpdf['montRefuse'] . " " . html_entity_decode($vpdf['euros']) . "\nFait le : " . $vpdf['dateNow'] . "", 1, "R", 0); $pdf->Output(); }