<?php
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', array(6,6,5,5));
$html2pdf->pdf->SetDisplayMode('fullpage');
ob_start();
?>
<style type="text/css">
<!--
table{width:100% !important;}
table tr td{ text-align:left; }
table tr th{text-align:center;}
table tr .title{font-size:9pt; font-weight: bold;}
table tr .content{text-align:left; font-size:9pt;}
-->
</style>
<page>
<table cellspacing="0" align="center" style="width: 100%;height:30%; text-align:center;text-align: center; font-size: 10pt;" align="center">
<tr>
<td rowspan="3" style="width: 33%; text-align: center;border: solid 1px black;"><h2>Groupe Hammami</h2><h3><?php echo $conge["depart"]?></h3></td>
<td rowspan="3" style="width: 33%; text-align: center;border: solid 1px black;font-weight: bold; font-size:20pt;">Demande de conge</td>
<td style="width: 33%; text-align: center;border: solid 1px black;text-transform: uppercase;">GRH-FR-03/03</td>
</tr>
<tr>
<td style="text-align: center;border: solid 1px black;text-transform: uppercase;"> <?php echo date("d/m/Y",strtotime($conge["creationdate"])); ?></td>
</tr>
<tr>
<td style="text-align: center;border: solid 1px black;text-transform: uppercase;">Page 1 sur 1 </td>
</tr>
</table>
<table cellspacing="0" align="center" style="width: 100%; text-align: center; font-size: 10pt;margin-top: 30px;">
<tr>
<td class="title" style=" text-align: left;font-weight: bold;" >Date:</td>
<td class="content" style="text-align: left;" colspan="3"><?php echo $conge["creationdate"]; ?></td>
</tr>
<tr>
<td class="title" style="width: 25%; "> Nom & Prénom: </td>
<td class="content" style="width: 25%;" > <?php echo ucwords($conge["nom"])." ".ucwords($conge["prenom"]); ?></td>
<td class="title" style="width: 25%; "> Matricule:</td>
<td class="content" style="width: 25%; " ><?php echo $conge["matricule"]; ?>
</td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Poste:</td>
<td class="content" style="width:25%; "><?php echo $conge["poste"]; ?></td>
<td class="title" style="width: 25%; "> Au Titre de l’année:</td>
<td class="content" style="width: 25%; "><?php echo date("Y",strtotime($conge["creationdate"])); ?></td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Date Début du Congé:</td>
<td class="content" style="width: 25%; "> <?php echo date("d/m/Y",strtotime( $conge["datedebut"])); ?></td>
<td class="title" style="width: 25%; ">Date Fin de congé : </td>
<td class="content" style="width: 25%; "><?php echo date("d/m/Y",strtotime( $conge["datefin"])); ?></td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Demi journée date debut:</td>
<td class="content" style="width: 25%; "><?php echo $conge["demijourned"]; ?></td>
<td class="title" style="width: 25%; ">Demi journée date fin</td>
<td class="content" style="width: 25%; "><?php echo $conge["demijournef"]; ?></td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Durée en nombre de jours:</td>
<td class="content" style="width: 25%; ">
<?php
$datetime1 = new DateTime($conge['datedebut']);
$datetime2 = new DateTime($conge['datefin']);
if (($conge['demijourned']=="0")&&($conge['demijournef']=="0"))
{
$interval = $datetime1->diff($datetime2);
echo $interval->d+1;
}
elseif(($conge['demijourned']!="0")&&($conge['demijournef']!="0"))
{
$interval = $datetime1->diff($datetime2);
echo $interval->d+1-0.5-0.5;
}
elseif(($conge['demijourned']!="0")||($conge['demijournef']!="0"))
{
$interval = $datetime1->diff($datetime2);
echo $interval->d+1-0.5;
}
?>
</td>
<td class="title" style="width: 25%; "><!--Reste solde de conge:--></td>
<td class="content" style="width: 25%; ">
<?php
/*$consome = 0;
foreach($userconges as $itemconge){
$datetime1 = new DateTime($itemconge['datedebut']);
$datetime2 = new DateTime($itemconge['datefin']);
if (($itemconge['demijourned']=="0")&&($itemconge['demijournef']=="0"))
{
$interval = $datetime1->diff($datetime2);
$consome+= $interval->d+1;
}
elseif(($itemconge['demijourned']!="0")&&($itemconge['demijournef']!="0"))
{
$interval = $datetime1->diff($datetime2);
$consome+= $interval->d+1-0.5-0.5;
}
elseif(($itemconge['demijourned']!="0")||($itemconge['demijournef']!="0"))
{
$interval = $datetime1->diff($datetime2);
$consome+= $interval->d+1-0.5;
}
}
echo $soldeconge-$consome ;*/
?>
</td>
</tr>
<tr>
<td class="title" style="width: 25%; "> Nature du Congé: </td>
<td class="content" style="width: 75%;" colspan="3"><?php echo $conge["typeconge"]; ?></td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Motif de congé:</td>
<td class="content" style="width: 75%; " colspan="3"><?php echo $conge["congedesc"]; ?> </td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Adresse pendant le congé :</td>
<td class="content" style="width: 75%; " colspan="3"><?php echo $conge["adresse"]; ?> </td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Tel:</td>
<td class="content" style="width: 75%; " colspan="3"><?php echo $conge["tel"]; ?> </td>
</tr>
<tr>
<td class="title" style="width: 25%; ">Nom et prénom de l’intérimaire:</td>
<td class="content" style="width: 75%; " colspan="3"><?php echo $conge["interim"]; ?> </td>
</tr>
</table>
<table cellspacing="0" align="center" style="width: 100%;height:30%; margin-top: 50px; text-align: center; font-size: 10pt;" align="center">
<tr >
<td style="width: 50%; font-weight:bold; text-align: center;border: solid 1px black;" >Signature du collaborateur</td>
<td style="width: 50%; font-weight:bold; text-align: center;border: solid 1px black;" >Validation de la direction</td>
</tr>
<tr >
<td style="width: 50%; text-align: center;height:30%; border: solid 1px black;" >
<?php echo ucwords($conge["nom"])." ".ucwords($conge["prenom"]); ?>
</td>
<td style="width: 50%; text-align: center; height:30%; border: solid 1px black;" >
<?php
$valide_values = array(
'0'=>'En Attente',
'1'=>'Confirmée',
'2'=>'Rejetée',
'3'=>'Annulée',
);
echo $valide_values[$conge["etat"]]." par ".ucwords($conge["validator"]);
?>
</td>
</tr>
</table>
<table cellspacing="0" align="center" style="width: 100%;height:30%; margin-top: 50px; text-align: center; font-size: 10pt;" align="center">
<tr >
<td style="width: 25%; font-weight:bold; text-align: center;border: solid 1px black;" >Signature du collaborateur</td>
<td style="width: 50%; font-weight:bold;text-align: center;border: solid 1px black;" >Validation de la direction</td>
<td style="width: 25%; font-weight:bold; text-align: center;border: solid 1px black;" >Visa de l’agent de sécurité</td>
</tr>
<tr >
<td style="width: 25%; text-align: center;height:30%; border: solid 1px black;" >
<?php echo ucwords($conge["nom"])." ".ucwords($conge["prenom"]); ?>
</td>
<td style="width: 50%; text-align: center; height:30%; border: solid 1px black;" >
<?php
$valide_values = array(
'0'=>'En Attente',
'1'=>'Confirmé',
'2'=>'Rejeté',
'3'=>'Annulé',
);
echo $valide_values[$conge["etat"]]." par ".ucwords($conge["validator"]);
?>
</td>
<td style="width: 25%; text-align: center; height:30%; border: solid 1px black;" ></td>
</tr>
</table>
</page>
<?php
$content = ob_get_clean();
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('DemandeConge-'.ucwords($conge["nom"])."-".ucwords($conge["prenom"])."-". date("d-m-Y",strtotime($conge["creationdate"])).".pdf");
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
?>