223 lines
12 KiB
PHP
223 lines
12 KiB
PHP
<?php
|
|
ob_Start();
|
|
|
|
require_once('tcpdf_include.php');
|
|
// create new PDF document
|
|
|
|
//error_reporting(E_ALL);
|
|
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
|
// set document information
|
|
$pdf->SetCreator(PDF_CREATOR);
|
|
$pdf->SetAuthor('Sophal');
|
|
$pdf->SetTitle('BULLETIN DE PAIE');
|
|
$pdf->SetSubject('BULLETIN DE PAIE');
|
|
|
|
// add a page
|
|
$pdf->AddPage();
|
|
|
|
$pdf->SetFont('helvetica', '', 8.5);
|
|
|
|
// -----------------------------------------------------------------------------
|
|
$months = array(1=>"Janvier", 2=>"Février", 3=>"Mars", 4=>"Avril", 5=>"Mai", 6=>"Juin",
|
|
7=>"Juillet", 8=>"Août", 9=>"Septembre", 10=>"Octobre", 11=>"Novembre", 12=>"Décembre");
|
|
$moisNbr = substr($_GET['periode'], -2);
|
|
$annee = substr($_GET['periode'], 0,-2);
|
|
$DateRecrutement = explode(" ", $res['employe']['DateRecrutement']);
|
|
$DateRecrutement = date_create($DateRecrutement[0]);
|
|
$var1 = '
|
|
<table cellpadding ="3">
|
|
|
|
<tr>
|
|
<th width="75" height="16" style="border-right:hidden; border-left:0.1px solid black; border-top:hidden; border-bottom:0.1px solid black;"><h4>Nom : </h4></th>
|
|
<th width="144" align="center" height="16" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;;" id="Nom">'.$res['employe']['Nom'].'</th>
|
|
<th width="140" rowspan="2" align="center" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;"><h3>BULLETIN DE PAIE</h3></th>
|
|
<th rowspan="4" width="180" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden;"><img src="../lib/tcpdf/templates/images/logo.png" width="188" height="73"></th>
|
|
</tr>
|
|
<tr>
|
|
<td height="16" style="border-right:hidden; border-left:0.1px solid black; border-top:hidden; border-bottom:0.1px solid black;"><h4>Prénom :</h4></td>
|
|
<td align="center" height="16" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;;">'.$res['employe']['Prenom'].'</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" height="16" style="border-right:0.1px solid black; border-left:0.1px solid black; border-top:hidden; border-bottom:0.1px solid black;"><H4>Matricule</H4></td>
|
|
<td align="center" height="16" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;"><H4>Fonction</H4></td>
|
|
<td align="center" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;">Paie du mois</td>
|
|
</tr>
|
|
<tr>
|
|
<td height="16" align="center" style="border-right:0.1px solid black; border-left:0.1px solid black; border-top:hidden; border-bottom:0.1px solid black;">'.$res['employe']['MATRICULE'].'</td>
|
|
<td height="16" align="center" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;">'.$res['employe']['Libelle'].'</td>
|
|
<td rowspan="2" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;">Mois : '.$months[(int)$moisNbr].'<BR><BR>Année : '.$annee.'</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="center" height="16" style="border-right:0.1px solid black; border-left:0.1px solid black; border-top:hidden; border-bottom:0.1px solid black;"><H4>Date Recrut.</H4></td>
|
|
<td align="center" height="16" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;">'.date_format($DateRecrutement,"d/m/Y").'</td>
|
|
<td align="center" style="border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:0.1px solid black;">N S.S Employeur : '.$res['employe']['NumEmplyeur'].'</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table>
|
|
<tr style="line-height: 50%;">
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<table cellpadding ="4">
|
|
<tr>
|
|
<th ></th>
|
|
<th width="244"></th>
|
|
<th width="80" height="20" align="center" style=" border-left:0.1px solid black; border-top:0.1px solid black; border-bottom:0.1px solid black;">S. Base </th>
|
|
<th width="80" height="20" align="center" style="border-right:0.1px solid black; border-top:0.1px solid black; border-bottom:0.1px solid black; text-align: right;">'.$res['entete']['SalBaseTheorique'].'</th>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
<table>
|
|
<tr style="line-height: 50%;">
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<table border="0.1" cellpadding ="3" style="border-radius: 10%;">
|
|
|
|
<tr>
|
|
<th align="center" style="width:3.9 cm" ><H4>Désignation Unité</H4></th>
|
|
<th align="center" style="width:1.6 cm"><H4>Centre de<br>cout</H4></th>
|
|
<th align="center" style="width:1.3 cm"><H4>Sit.Fam</H4></th>
|
|
<th align="center" style="width:1.3 cm"><H4>Nbre<br>Jrs/Hrs</H4></th>
|
|
<th align="center" style="width:2 cm"><H4>Cat/Sec/Ech</H4></th>
|
|
<th align="center" style="width:3.9 cm"><H4>N° Compte bancaire</H4></th>
|
|
<th align="center" style="width:2.5 cm"><H4>N° Mutuel</H4></th>
|
|
<th align="center" style="width:2.5 cm"><H4>N° Sec Soc</H4></th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>'.$res['employe']['SERVICE'].'</td>
|
|
<td align="center"></td>
|
|
<td align="center"></td>
|
|
<td align="center"></td>
|
|
<td></td>
|
|
<td align="center">'.$res['employe']['NumCompte'].'</td>
|
|
<td></td>
|
|
<td align="center">'.$res['employe']['NumSSNational'].'</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<table>
|
|
<tr style="line-height: 50%;">
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<table border="0.8" cellpadding ="5">
|
|
<tr >
|
|
<th height="25" align="center" style="width:1.5 cm ;"><H4>Code</H4></th>
|
|
<th align="center" style=" width:7.5 cm ; "><H4>Libelle de la Rubrique</H4></th>
|
|
<th align="center" style="width:1.6 cm ;"><H4>Nombre</H4></th>
|
|
<th align="center" style="width:1.8 cm ; "><H4>Base</H4></th>
|
|
<th align="center" style="width:1.6 cm ; "><H4>Taux</H4></th>
|
|
<th align="center" style="width:2.5cm ; "><H4>Gains</H4></th>
|
|
<th align="center" style="width:2.5cm ;"><H4>Retenues</H4></th>
|
|
</tr>
|
|
</table>
|
|
|
|
<table cellpadding ="2">';
|
|
|
|
$values = array();
|
|
for($i = 0 ; $i < count($res['lignes']) ; $i++){
|
|
$Nombre = floatval($res['lignes'][$i]['Nombre']) == 0 ? '' : number_format(floatval($res['lignes'][$i]['Nombre']), 2, ',', ' ');
|
|
$Base = floatval($res['lignes'][$i]['Base']) == 0 ? '' : number_format(floatval($res['lignes'][$i]['Base']), 2, ',', ' ');
|
|
$Taux = floatval($res['lignes'][$i]['Taux']) == 0 ? '' : number_format(floatval($res['lignes'][$i]['Taux']), 2, ',', ' ');
|
|
$ResEmploye = floatval($res['lignes'][$i]['ResEmploye']) == 0 ? '' : number_format(floatval($res['lignes'][$i]['ResEmploye']), 2, ',', ' ');
|
|
|
|
if((int)$res['lignes'][$i]['LeSens'] == +1 ){
|
|
$Gains = $ResEmploye;
|
|
$Retenues = '';
|
|
}elseif((int)$res['lignes'][$i]['LeSens'] == -1){
|
|
$Gains = '';
|
|
$Retenues = $ResEmploye;
|
|
}
|
|
|
|
$ligne = '<tr >
|
|
<td align="center" style=" width:1.5 cm ; border-right:0.1px solid black; border-left:0.1px solid black; border-top:hidden; border-bottom:hidden;">'.$res['lignes'][$i]['CodeRubrique'].'</td>
|
|
<td style=" width:7.5 cm ;border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden;">'.$res['lignes'][$i]['Libelle'].'</td>
|
|
<td style="width:1.6 cm ; border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden; text-align: right;">'.$Nombre.'</td>
|
|
<td style="width:1.8 cm ; border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden; text-align: right;">'.$Base.'</td>
|
|
<td style=" width:1.6 cm ; border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden; text-align: right;" >'.$Taux.'</td>
|
|
<td style="width:2.5cm ; border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden; text-align: right;">'.$Gains.'</td>
|
|
<td style=" width:2.5cm ; border-right:0.1px solid black; border-left:hidden; border-top:hidden; border-bottom:hidden; text-align: right;">'.$Retenues.'</td>
|
|
</tr>';
|
|
array_push($values,$ligne);
|
|
|
|
}
|
|
|
|
$var2 = implode("", $values);
|
|
|
|
$TotalBrut = $res['entete']['TotalBrut'] > 0 ? number_format($res['entete']['TotalBrut'], 2, '.', ' ') : "";
|
|
$BaseIRGTheorique = $res['entete']['BaseIRGTheorique'] > 0 ? number_format($res['entete']['BaseIRGTheorique'], 2, '.', ' ') : "";
|
|
$BaseSSTheorique = $res['entete']['BaseSSTheorique'] > 0 ? number_format($res['entete']['BaseSSTheorique'], 2, '.', ' ') : "";
|
|
$NetAPayer = $res['entete']['NetAPayer'] > 0 ? number_format($res['entete']['NetAPayer'], 2, '.', ' ') : "";
|
|
|
|
$var3 = '<tr>
|
|
<td style="border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black; text-align: right;" colspan="5"><H4>TOTAUX</H4></td>
|
|
<td align="center" style="border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black"><H4>'.number_format($res['entete']['TotalGain'], 2, '.', ' ').'</H4></td>
|
|
<td align="center" style="border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black"><H4>'.number_format($res['entete']['TotalRetenue'], 2, '.', ' ').'</H4></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table>
|
|
<tr style="line-height: 50%;">
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table cellpadding ="2">
|
|
|
|
<tr >
|
|
<th height="28" align="center" style=" width:2.8cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black;"><h4>Salaire Brut</h4></th>
|
|
<th width="3"></th>
|
|
<th align="center" style="width:3.8cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black;"><h4>Base I.R.G</h4></th>
|
|
<th width="3"></th>
|
|
<th align="center" style="width:3.3cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black;"><h4>Alloc. Familliales</h4></th>
|
|
<th width="3"></th>
|
|
<th align="center" style="width:3.7cm;border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black;"><h4>Salaire de Poste</h4></th>
|
|
<th width="3"></th>
|
|
<th align="center" style="width:5cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:0.8px solid black; border-bottom:0.8px solid black;"><h4>Net A Payer</h4></th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="center" style="width:2.8cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:hidden; border-bottom:0.8px solid black;"><h4>'.$TotalBrut.'</h4></td>
|
|
<td width="3"></td>
|
|
<td align="center" style="width:3.8cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:hidden; border-bottom:0.8px solid black;"><h4>'.$BaseIRGTheorique.'</h4></td>
|
|
<td width="3"></td>
|
|
<td align="center" style="width:3.3cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:hidden; border-bottom:0.8px solid black;"><h4></h4></td>
|
|
<td width="3"></td>
|
|
<td align="center" style="width:3.7cm; border-right:0.8px solid black; border-left:0.8px solid black; border-top:hidden; border-bottom:0.8px solid black;"><h4>'.$BaseSSTheorique.'</h4></td>
|
|
<td width="3"></td>
|
|
<td align="center" style="width:5cm;border-right:0.8px solid black; border-left:0.8px solid black; border-top:hidden; border-bottom:0.8px solid black;"><h4>'.$NetAPayer.'</h4></td>
|
|
</tr>
|
|
</table>';
|
|
$vartotal = $var1.$var2.$var3;
|
|
$pdf->writeHTML($vartotal, true, false, false, false, '');
|
|
|
|
|
|
|
|
|
|
|
|
//Close and output PDF document
|
|
$pdf->Output('BULLETIN_DE_PAIE.pdf', 'I');
|
|
|
|
|