218 lines
6.6 KiB
PHP
218 lines
6.6 KiB
PHP
<?php
|
|
require_once('tcpdf_include.php');
|
|
|
|
// 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->writeHTML("<hr>", true, false, false, false, '');
|
|
|
|
}
|
|
|
|
// 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 ACTION 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('');
|
|
$pdf->SetSubject('Sophal');
|
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
|
|
|
|
|
|
|
|
|
// set margins
|
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP+4, 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);
|
|
|
|
$pdf->Cell( 0, 0, 'Oran le :'.date('d/m/Y', strtotime($response['date_creation'])), 0, 1 ,'R');
|
|
//$pdf->writeHTML("<hr>", true, false, false, false, '');
|
|
$pdf->Ln();
|
|
$pdf->Cell( 0, 0, 'Matricule : '.$response['matricule'], 0, 1 ,'L');
|
|
$pdf->Cell( 0, 0, 'Réf : '.$response['num_reference'].'/ DRH/SS/LR /'.date('Y', strtotime($response['date_creation'])), 0, 1 ,'L');
|
|
$pdf->Ln();
|
|
$pdf->Ln();
|
|
$pdf->SetFont('times', 'BIU', 18);
|
|
$txt = <<<EOD
|
|
- TITRE DE CONGE -
|
|
EOD;
|
|
// print a block of text using Write()
|
|
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
|
|
|
|
$pdf->Ln();
|
|
$pdf->SetFont('times', 'I', 12);
|
|
|
|
$v ='<table cellpadding ="3" >
|
|
<tr>
|
|
<th style=" width: 4cm ;">Nom et Prénom</th>
|
|
<th style=" width: 14cm ;">: '.$response['fullname'].'</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Fonction</td>
|
|
<td>: '.$response['fonction'].'</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Date de Recrutement</td>
|
|
<td>: '.$response['date_recrutement'].'</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Structure</td>
|
|
<td>: '.$response['structure'].'</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Sous Structure</td>
|
|
<td>: '.$response['sous_structure'].'</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table cellpadding ="3">
|
|
<tr>
|
|
<td style=" width: 5.5cm ;">Est en congé pour la période : </td>
|
|
<td style=" width: 12.5cm ;"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table cellpadding ="3">
|
|
<tr>
|
|
<td style=" width: 2cm ;"><strong>Exercice :</strong></td>
|
|
<td><strong>'.$response['exercice'].'</strong></td>
|
|
</tr>
|
|
|
|
</table>
|
|
';
|
|
$pdf->writeHTML($v, true, false, false, false, '');
|
|
|
|
|
|
|
|
|
|
$pdf->SetFont('times', 'I', 11);
|
|
$t = '<table cellpadding ="3" border="1">
|
|
|
|
<tr style="text-align: centre;">
|
|
<th rowspan="2">DESIGNATIONS</th>
|
|
<th rowspan="2" >NOMBRE<br>DE<br>JOURS</th>
|
|
<th colspan="2">PERIODE</th>
|
|
<th rowspan="2">DATE<br>DE<br>REPRISE</th>
|
|
<th rowspan="2">OBSERVATIONS</th>
|
|
</tr>
|
|
<tr style="text-align: centre;">
|
|
<th>DU</th>
|
|
<th>AU</th>
|
|
</tr>
|
|
|
|
<tr style="text-align: centre;">
|
|
<td>'.$response['designations'].'</td>
|
|
<td><strong>'.$response['nbr_jour'].' jours</strong></td>
|
|
<td><strong>'.$response['date_debut'].'</strong></td>
|
|
<td><strong>'.$response['date_fin'].'</strong></td>
|
|
<td><strong>'.$response['date_reprise'].'</strong></td>
|
|
<td>'.$response['observations'].'</td>
|
|
</tr>
|
|
|
|
</table>';
|
|
$pdf->writeHTML($t, true, false, false, false, '');
|
|
|
|
|
|
$pdf->SetFont('times', 'I', 12);
|
|
$qr = '<table>
|
|
<tr>
|
|
<td><strong><u>ADRESSE COMPLETE DURANT LE CONGE </u>: </strong>'.$response['adresse'].'</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong><u>Reliquat</u> : </strong>'.$response['reliquat'].' jours</td>
|
|
</tr>
|
|
</table>';
|
|
$pdf->writeHTML($qr, true, false, false, false, '');
|
|
|
|
$pdf->Ln();
|
|
$pdf->Cell( 0, 0, 'En foi de quoi ,le présent titre lui est délivrée our servier et valoir ce que droit.', 0, 1 ,'L');
|
|
$pdf->Ln();
|
|
|
|
$visa = '<table >
|
|
<tr align="left">
|
|
<th><strong><u>COPIE :</u></strong></th>
|
|
<th><strong><u>Le Directeur des Ressources Humaines</u></strong></th>
|
|
</tr>
|
|
<tr align="left">
|
|
<th>L'intéressé(e)<br>Dossier Administratif</th>
|
|
<th><img src="../lib/tcpdf/templates/images/cachet.png" width="188" height="73"></th>
|
|
</tr>
|
|
|
|
</table>';
|
|
|
|
$pdf->writeHTML($visa, true, false, false, false, '');
|
|
//qr code
|
|
$style = array(
|
|
'border' => 0,
|
|
'vpadding' => 'auto',
|
|
'hpadding' => 'auto',
|
|
'fgcolor' => array(0,0,0),
|
|
'bgcolor' => false, //array(255,255,255)
|
|
'module_width' => 1, // width of a single module in points
|
|
'module_height' => 1 // height of a single module in points
|
|
);
|
|
|
|
|
|
$setText = 'Mat:'.$response['matricule'].',
|
|
Mr:'.$response['fullname'].',
|
|
fonction:'.$response['fonction'].'
|
|
structure:'.$response['structure'].',
|
|
Sous structure:'.$response['sous_structure'].',
|
|
date de recrutement:'.date('d/m/Y', strtotime($response['date_recrutement'])).'
|
|
exercice:'.$response['exercice'].',
|
|
designations:'.$response['designations'].',
|
|
nbr_jour:'.$response['nbr_jour'].',
|
|
date_debut:'.$response['date_debut'].',
|
|
date_fin:'.$response['date_fin'].',
|
|
date_reprise:'.$response['date_reprise'];
|
|
//delete all spaces
|
|
$filtreText = preg_replace('/\s+/', ' ', $setText);
|
|
$pdf->write2DBarcode($filtreText, 'QRCODE,M', 4, 246, 50, 30, $style, 'N');
|
|
|
|
|
|
$pdf->Output('attestation_de_travail.pdf', 'I');
|