<?php
try
{
$html2pdf = new HTML2PDF('L', 'A4', 'fr', true, 'UTF-8', array(2, 2, 2, 2));
$html2pdf->pdf->SetDisplayMode('fullpage');
ob_start();
?>
<style type="text/css">
<!--
table{width:100% !important;}
table tr td{ text-align:center; padding: 5px; }
table tr th{text-align:center;padding: 5px;}
table tr .title{font-size:10pt; font-weight: bold;}
table tr .content{text-align:left; font-size:10pt;}
h2{
text-align: center;
}
-->
</style>
<page backtop="50mm" backbottom="7mm" footer="page" >
<page_header footer='page' >
<table cellspacing="0" align="center" style="margin-bottom:40px; 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;"><img src="<?php echo base_url()."logo-site-pri.png";?>" style="width:100px;"></td>
<td rowspan="3" style="width: 33%; text-align: center;border: solid 1px black;font-weight: bold; font-size:20pt;">Etat des demandes</td>
<td style="width: 33%; text-align: center;border: solid 1px black;text-transform: uppercase;"></td>
</tr>
<tr>
<td style="text-align: center;border: solid 1px black;text-transform: uppercase;"></td>
</tr>
<tr>
<td style="text-align: center;border: solid 1px black;text-transform: uppercase;">Page [[page_cu]] </td>
</tr>
</table>
</page_header>
<table class="table table-striped" align="center" border="1">
<tr>
<th>Date de la demande</th>
<th>Utilisateur</th>
<th>Depart</th>
<th>Moyen de transport</th>
<th>Heure de sortie</th>
<th>Heure de fin</th>
<th>Total des heurs</th>
<th>Objet autorisation</th>
<th>Description</th>
<th>Etat</th>
</tr>
<?php foreach($autorisation as $d){ ?>
<tr>
<td><?php echo $d['datedemande']; ?></td>
<td><?php echo $d['name']." ".$d['prenom'];?></td>
<td><?php echo $d['depart']; ?></td>
<td><?php echo $d['transport']; ?></td>
<td><?php echo $d['heursdebut']; ?></td>
<td><?php echo $d['heursfin']; ?></td>
<td> <?php
$start = date_create('2015-01-26 '.$d["heursdebut"]);
$end = date_create('2015-01-26 '.$d["heursfin"]);
$diff=date_diff($end,$start);
echo $diff->h.":".$diff->i;
?></td>
<td><?php echo $d['objetautorisation']; ?></td>
<td><?php echo $d['description']; ?></td>
<td>
<?php
$valide_values = array(
'0'=>'En Attente',
'1'=>'Confirmée',
'2'=>'Rejetée',
'3'=>'Annulée',
);
echo $valide_values[$d["etat"]];
?>
</td>
</tr>
<?php } ?>
</table>
</page>
<page backtop="50mm" backbottom="7mm" footer="page" >
<table class="table table-striped" id="datamission" align="center" border="1">
<thead>
<tr>
<th>Date de la demande</th>
<th>Type mission </th>
<th>Utilisateur</th>
<th>Depart</th>
<th>Destination</th>
<th>Date depart</th>
<th>Date fin</th>
<th>Total</th>
<th>Transport </th>
<th>Objet mission </th>
<th>Interim </th>
<th>Description</th>
<th>Etat</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach($mission as $key=>$d){ ?>
<tr <?php echo ($key%2==0)?"style='background:#eff0f1;'":""?>>
<td><?php echo date("d/m/Y",strtotime($d['creationdate'])); ?></td>
<td><?php echo $d['typemission']; ?></td>
<td><?php echo $d['name']." ".$d['prenom']; ?></td>
<td><?php echo $d['depart']; ?></td>
<td><?php echo $d['destination']; ?></td>
<td><?php echo date("d/m/Y H:i",strtotime($d['datedebut'])); ?></td>
<td><?php echo date("d/m/Y H:i",strtotime($d['datefin'])); ?></td>
<td> <?php
$datetime1 = new DateTime($d['datedebut']);
$datetime2 = new DateTime($d['datefin']);
$interval = $datetime1->diff($datetime2);
echo $interval->d." jours ".$interval->h." Heures";
?></td>
<td><?php echo $d['transport']; ?></td>
<td><?php echo $d['objetmission']; ?></td>
<td><?php echo $d['interim']; ?></td>
<td><?php echo $d['description']; ?></td>
<td>
<?php
$etat_values = array(
'0'=>'En Attente',
'1'=>'Confirmée',
'2'=>'Rejetée',
'3'=>'Annulée',
);
echo $etat_values[$d["etat"]];
?>
</td>
<td>
<!-- <a href="<?php // echo site_url('mission/edit/'.$d['id']); ?>" class="btn btn-info btn-xs"><span class="fa fa-pencil"></span> Edition</a> -->
<!-- <a href="<?php //echo site_url('mission/remove/'.$d['idmission']); ?>" class="btn btn-danger btn-xs"><span class="fa fa-trash"></span> Supprimer</a>-->
<?php if($d["etat"]==1){ ?>
<a href="<?php echo site_url('mission/'.$d['file'].'/'.$d['idmission']); ?>" class="btn btn-success btn-xs"><span class="fa fa-print"></span> Imprimer</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</page>
<page backtop="50mm" backbottom="7mm" footer="page" >
<table class="table table-striped" align="center" border="1">
<tr>
<th class="title">Ordre</th>
<th class="title">Date de la demande</th>
<th class="title">Utilisateur</th>
<th class="title">Date debut</th>
<th class="title">Date fin</th>
<th class="title">Total</th>
<th class="title">Nature de congé</th>
<th class="title">Motif de congé</th>
<th class="title">Interim</th>
<th class="title">Etat</th>
</tr>
<?php foreach($conge as $key=>$d){ ?>
<tr <?php echo ($key%2==0)?"style='background:#eff0f1;'":""?> >
<td class="content"><?php echo $key+1; ?></td>
<td class="content"><?php echo $d['creationdate']; ?></td>
<td class="content"><?php echo $d['name']." ".$d['prenom']; ?></td>
<td class="content"><?php echo date("d/m/Y H:i",strtotime($d['datedebut'])); ?></td>
<td class="content"><?php echo date("d/m/Y H:i",strtotime($d['datefin'])); ?></td>
<td class="content"> <?php
$datetime1 = new DateTime($d['datedebut']);
$datetime2 = new DateTime($d['datefin']);
$interval = $datetime1->diff($datetime2);
echo $interval->d." jours ".$interval->h." Heures";
?></td>
<td class="content"><?php echo $d['libelle']; ?></td>
<td class="content"><?php echo $d['description']; ?></td>
<td class="content"><?php echo $d['interim']; ?></td>
<td class="content">
<?php
$valide_values = array(
'0'=>'En Attente',
'1'=>'Confirmée',
'2'=>'Rejetée',
'3'=>'Annulée',
);
echo $valide_values[$d["etat"]];
?>
</td>
</tr>
<?php } ?>
</table>
</page>
<?php
$content = ob_get_clean();
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output("demanderesume.pdf");
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
?>