145 lines
4.3 KiB
PHP
145 lines
4.3 KiB
PHP
<?php
|
|
|
|
ob_Start();
|
|
|
|
|
|
|
|
require_once('tcpdf_include.php');
|
|
|
|
// create new PDF document
|
|
|
|
|
|
|
|
// Extend the TCPDF class to create custom Header and Footer
|
|
|
|
class MYPDF extends TCPDF {
|
|
|
|
|
|
|
|
|
|
|
|
//Page header
|
|
|
|
|
|
|
|
public function Header() {
|
|
|
|
$this->SetTextColor(34, 112, 147);
|
|
|
|
$image_file = '../lib/tcpdf/templates/images/logo.png';
|
|
|
|
$this->Image($image_file, 15, 5, 19, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
|
|
|
|
$this->SetFont('times', 'B', 14 );
|
|
|
|
$this->Cell( 3 );
|
|
|
|
$this->Cell( 0, 0, 'SOCIETE PHARMACETIQUE ALGERIENNE', 0, 1 );
|
|
|
|
$this->SetFont('times', 'i', 9 );
|
|
|
|
$this->Cell( 22 );
|
|
|
|
$this->Cell( 0, 0, 'Siège social : BP 10, Bir El Djir - 31295 - Oran - Algérie,', 0, 1 );
|
|
|
|
$this->Cell( 22 );
|
|
|
|
$this->Cell( 0, 0, 'Usine : BP 147 , Hassi Ben Okba -31295 - Oran -Algérie', 0, 1 );
|
|
|
|
$this->Cell( 22 );
|
|
|
|
$this->Cell( 0, 0, 'Tél : +213 (0) 41 42 87 71/72 -Fax : +213 (0) 41 42 87 76', 0, 1 );
|
|
|
|
$this->Cell( 22 );
|
|
|
|
$this->Cell( 0, 0, 'Email : info@sophal.DZ/sophal@gmail.com', 0, 1 );
|
|
|
|
$this->Cell( 22 );
|
|
|
|
$this->Cell( 0, 0, '', 0, 1 );
|
|
|
|
$this->Cell( 3 );
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Page footer
|
|
|
|
public function Footer() {
|
|
|
|
// Position at 15 mm from bottom
|
|
|
|
$this->SetY(-15);
|
|
|
|
// Set font
|
|
|
|
$this->SetFont('helvetica', 'I', 8);
|
|
|
|
// Page number
|
|
|
|
$this->SetTextColor(34, 112, 147);
|
|
|
|
$this->Cell( 0, 0, 'SOCIETE PAR ACTIONS AU CAPITAL DE 5.000.000.000 DA', 0, 1 ,'C');
|
|
|
|
$this->Cell( 0, 0, 'R.C.N °99B 00103116 N°M.F:099931010311611 N° A.I:31030136520', 0, 1,'C' );
|
|
|
|
$this->SetTextColor(0, 0, 0);
|
|
|
|
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// create new PDF document
|
|
|
|
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set document information
|
|
|
|
$pdf->SetCreator(PDF_CREATOR);
|
|
|
|
$pdf->SetAuthor('Sophal');
|
|
|
|
$pdf->SetTitle('FICHE TECHNIQUE');
|
|
|
|
$pdf->SetSubject('FICHE TECHNIQUE');
|
|
|
|
|
|
|
|
// set margins
|
|
|
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP+8, PDF_MARGIN_RIGHT);
|
|
|
|
$pdf->SetHeaderMargin(2);
|
|
|
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
|
|
|
|
|
|
|
// set auto page breaks
|
|
|
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
|
|
|
|
|
|
|
// add a page
|
|
|
|
$pdf->AddPage();
|
|
|
|
|
|
|
|
$pdf->SetFont('times', 'I', 12);
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
$var = '<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th><h4>Nom :</h4></th>
|
|
|
|
<th>'.$ordinateur['name'].'</th>
|
|
|
|
<th><h4>Statut :</h4></th>
|
|
|
|
<th>'.$ordinateur['statut'].'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td><h4>Lieu :</h4></td>
|
|
|
|
<td>'.$ordinateur['location'].'</td>
|
|
|
|
<td><h4>Type :</h4></td>
|
|
|
|
<td>'.$ordinateur['types'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><h4>Utilisateur :</h4></td>
|
|
|
|
<td>'.$ordinateur['fullname'].'</td>
|
|
|
|
<td><h4>Fabricant :</h4></td>
|
|
|
|
<td>'.$ordinateur['fabricant'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><h4>UUID :</h4></td>
|
|
|
|
<td>'.$ordinateur['uuid'].'</td>
|
|
|
|
<td><h4>Modèle :</h4></td>
|
|
|
|
<td>'.$ordinateur['modele'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><h4>Réseau :</h4></td>
|
|
|
|
<td>'.$ordinateur['reseau'].'</td>
|
|
|
|
<td><h4>Numéro de série :</h4></td>
|
|
|
|
<td>'.$ordinateur['num_serie'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><h4>Commentaires :</h4></td>
|
|
|
|
<td colspan="3">'.$ordinateur['comment'].'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
|
|
|
|
$pdf->writeHTML($var, true, false, false, false, '');
|
|
|
|
|
|
|
|
|
|
|
|
$var1 = '<br><h4>Logiciels :</h4><br><table border="0.5" cellpadding="5"><tr><td><h4>Nom</h4></td><td><h4>Version</h4></td></tr>';
|
|
|
|
|
|
|
|
$values = array();
|
|
|
|
if($logiciels != null){
|
|
|
|
for($i = 0 ; $i < count($logiciels) ; $i++){
|
|
|
|
|
|
|
|
$ligne = '<tr>
|
|
|
|
<td>'.$logiciels[$i]['softname'].'</td>
|
|
|
|
<td>'.$logiciels[$i]['version'].'</td>
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
array_push($values,$ligne);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$var2 = implode("", $values);
|
|
|
|
$var3 = "</table>";
|
|
|
|
$vartotal = $var1.$var2.$var3 ;
|
|
|
|
$pdf->writeHTML($vartotal, true, false, false, false, '');
|
|
|
|
|
|
|
|
//Close and output PDF document
|
|
|
|
$pdf->Output('FICHE_TECHNIQUE.pdf', 'I'); |