212 lines
6.9 KiB
PHP
212 lines
6.9 KiB
PHP
<?php
|
||
ob_Start();
|
||
|
||
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 );
|
||
|
||
|
||
}
|
||
*/
|
||
|
||
// 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');
|
||
}
|
||
}
|
||
|
||
|
||
if($res[0]['type'] == 'contre decharge'){
|
||
$titre = 'Contre Décharge' ;
|
||
$type = 'Contre Décharge N° : ' ;
|
||
$text = 'avoir reçu de';
|
||
}else if($res[0]['type'] == 'decharge'){
|
||
$titre = 'Décharge' ;
|
||
$type = 'Décharge N° : ' ;
|
||
$text = 'avoir remis à';
|
||
}
|
||
|
||
// 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($titre);
|
||
$pdf->SetSubject('Sophal');
|
||
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
||
|
||
|
||
|
||
|
||
// 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);
|
||
|
||
|
||
// ---------------------------------------------------------
|
||
|
||
// set font
|
||
$pdf->SetFont('times', 'I', 12);
|
||
|
||
// add a page
|
||
$pdf->AddPage();
|
||
|
||
$codes = array("decharge"=>"FRM.D.00562.01 (SOP.D.00155.01)", "contre decharge"=>"FRM.D.00563.01 (SOP.D.00155.01)");
|
||
$headerTitels = array("decharge"=>"FORMULAIRE GÉNÉRAL DE DÉCHARGE DE RESPONSABILITÉ", "contre decharge"=>"FORMULAIRE GÉNÉRAL DE CONTRE DÉCHARGE DE RESPONSABILITÉ");
|
||
$Header = '<table border="0.5">
|
||
<thead>
|
||
<tr>
|
||
<td rowspan="2" width="95" align="center" ><br><img src="../lib/tcpdf/templates/images/logo.png" width="65" ></td>
|
||
<td width="265" align="center" height="70" ><br><h4>'.$headerTitels[$res[0]['type']].'</h4></td>
|
||
<td align="center"><br><h4>DATE D'APPLICATION</h4> <br> Avril 2022</td>
|
||
</tr>
|
||
<tr >
|
||
<td align="center" >'.$codes[$res[0]['type']].'</td>
|
||
<td></td>
|
||
</tr>
|
||
</thead>
|
||
</table>';
|
||
$pdf->writeHTML($Header, true, false, false, false, '');
|
||
|
||
$pdf->SetFont('times', 'BI', 12);
|
||
$pdf->Cell( 0, 0, $type.$res[0]['num'], 0, 1 ,'R');
|
||
|
||
|
||
|
||
$pdf->SetFont('times', 'I', 12);
|
||
$v = '<table>
|
||
<tr style="line-height: 150%;">
|
||
<td></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<table cellpadding ="2">
|
||
<tr>
|
||
<th style=" width:1.3 cm ; text-align: right">-</th>
|
||
<th style=" width:16 cm ;">On soussigné Direction des Systèmes d’Informations de la spa SOPHAL '.$text.' </th>
|
||
</tr>
|
||
<tr>
|
||
<td></td>
|
||
<td><strong>'.$res[0]['titre'].'.'.mb_strtoupper($user['fullname'],"UTF-8").'</strong> en qualité <strong>'.mb_strtoupper($res[0]['fonction'],"UTF-8").'</strong> les biens suivants:</td>
|
||
</tr>
|
||
</table>';
|
||
$pdf->writeHTML($v, true, false, false, false, '');
|
||
|
||
|
||
|
||
$var = '<table border="0.5" cellpadding ="5">
|
||
<tr >
|
||
<th height="25" style="width:5 cm ;"><H4>Désignation</H4></th>
|
||
<th style=" width:2 cm ; "><H4>Quantité</H4></th>
|
||
<th style="width:9 cm ;"><H4>Fiche Technique</H4></th>
|
||
<th style="width:2.5 cm ; "><H4>Etat</H4></th>
|
||
</tr>';
|
||
|
||
$values = array();
|
||
for($i = 0 ; $i < count($res) ; $i++){
|
||
$ligne = '<tr >
|
||
<td>'.$res[$i]['designation'].'</td>
|
||
<td>'.$res[$i]['quantite'].'</td>
|
||
<td>'.$res[$i]['fiche'].'</td>
|
||
<td>'.$res[$i]['etat'].'</td>
|
||
</tr>';
|
||
array_push($values,$ligne);
|
||
|
||
}
|
||
|
||
$var2 = implode("", $values);
|
||
$var3 = '</table>';
|
||
|
||
$pdf->writeHTML($var.$var2.$var3, true, false, false, false, '');
|
||
|
||
|
||
if($res[0]['type'] == 'decharge'){
|
||
$var4 = '<table cellpadding="2">
|
||
|
||
<tr>
|
||
<th style=" width:1.3 cm ; text-align: right">-</th>
|
||
<th style=" width:16 cm ; ">Je soussigné(e) <strong>'.$res[0]['titre'].'.'.mb_strtoupper($user['fullname'],"UTF-8").'</strong> avoir reçu les biens mentionnés ci-dessus.</th>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td style=" text-align: right">-</td>
|
||
<td>J’atteste qu’il est de ma seule responsabilité de veiller aux biens de la société qui m’ont été confié,
|
||
et je ne pourrai en aucun cas tenir la société pour responsable en cas de perte, de vol ou détérioration. </td>
|
||
</tr>
|
||
<tr>
|
||
<td style=" text-align: right">-</td>
|
||
<td>L’utiliser uniquement dans le cadre professionnel. </td>
|
||
</tr>
|
||
<tr>
|
||
<td style=" text-align: right ">-</td>
|
||
<td>Le remboursement se fait sous réserve de l’avis de la direction en cas de perte, vol ou casse. </td>
|
||
</tr>
|
||
<tr>
|
||
<td style="text-align: right">-</td>
|
||
<td>Je reconnais avoir pris connaissance des sanctions prévues dans le règlement intérieur. </td>
|
||
</tr>
|
||
|
||
</table>';
|
||
$pdf->writeHTML($var4, true, false, false, false, '');
|
||
}
|
||
|
||
$pdf->SetFont('times', 'BI', 12);
|
||
$x = '<table><tr style="line-height: 150%;"><td></td></tr></table>
|
||
<table cellpadding ="3">
|
||
<tr>
|
||
<th>Fait à Hassi Ben Okba, le : '.$res[0]['date'].'</th>
|
||
</tr>
|
||
</table>';
|
||
$pdf->writeHTML($x, true, false, false, false, '');
|
||
|
||
$pdf->SetFont('times', 'BIU', 12);
|
||
$visa = '<table><tr style="line-height: 150%;"><td></td></tr></table>
|
||
<table cellpadding ="3">
|
||
<tr align="center">
|
||
<th>'.$res[0]['titre'].'.'.mb_strtoupper($user['fullname'],"UTF-8").'</th>
|
||
<th>Direction des Systèmes d’Informations</th>
|
||
</tr>
|
||
|
||
</table>
|
||
<table><tr style="line-height: 2cm;"><td></td></tr></table>';
|
||
$pdf->writeHTML($visa, true, false, false, false, '');
|
||
|
||
|
||
$pdf->Output($res[0]['type'].'_'.$user['fullname'].'.pdf', 'I'); |