<?php
	$currDir = dirname(__FILE__);
	include("$currDir/nel.php");
	include("$currDir/defaultLang.php");
	include("$currDir/language.php");
	include("$currDir/lib.php");

	include_once("$currDir/header.php");

	/* grant access to all users who have access to the facture table */
	$order_from = get_sql_from('conges');
	if(!$order_from) exit(error_message('Accès non autorisé!', false));

	/* get invoice */
	$order_id = intval($_REQUEST['id_conge']);
	if(!$order_id) exit(error_message('ID facture invalide!', false));
	
	/* retrieve order info */
	$order_fields = get_sql_fields('conges');
	$res = sql("select {$order_fields} from {$order_from} and id_conge={$order_id}", $eo);
	if(!($order = db_fetch_assoc($res))) exit(error_message('Aucune facture disponible', false));
	
	//var_dump($order);
	
	/* retrieve order items */
	$items = array();
	$order_total = 0;
	$item_fields = get_sql_fields('conges');
	$item_from = get_sql_from('conges');
	$res = sql("select {$item_fields} from {$item_from} and conges.matricule={$order_id}", $eo);
	while($row = db_fetch_assoc($res)){
		//$row['LineTotal'] = str_replace('$', '', $row['montant']) * $row['qte'];
		$ordres_conges[] = $row;
		//$order_total += $row['LineTotal'];
	}
	
	//var_dump(ordres_conges);
	
	?>

<html>
<head>
	<title>Note de service de conges</title>
<style type="text/css" media="print">
input.imprimer
{
display:none;
}
</style>
 
</head>
 
<body>

<form method="POST" action="">
 
<input type="button" value="Imprimer" class="imprimer" name="bnom" onClick="javascript:window.print()">
</form>

</body>
 
</html>


<h6>Honneur - Fraternité - Justice</h6>
<center>
<h4>Ministère de l'Habitat de l'Urbanisme et de l'Aménagement du territoire</h4>
<p>Direction des Affaires Administratives et Financières</p>
<p>Service du Personnel</p>
</center>

<br><br>
<center><u><h4>NOTE DE SERVICE DE CONGE N° <?php echo $order['id_conge']; ?>/MHUAT/SG/<?php echo date('Y');?></h4></u></center>
<br><br>
	<div class="row">
		<div class="col-sm-6">
			<!-- customer info -->
			<p><u>NOM ET PRENOM</u> : <?php echo $order['nom_prenom']; ?></p>
			<p><u>MATRICULE</u> : <?php echo $order['matricule']; ?></p>
			<p><u>FONCTION</u> : <?php echo $order['fonction']; ?></p>
			<p><u>DIRECTION</u> : <?php echo $order['direction']; ?></p>
			<p><u>SERVICE</u> : <?php echo $order['service']; ?></p>
			<p><u>N°FICHE DE LA DEMANDE DE CONGE</u> : <?php echo $order['num_fiche']; ?></p>
<br><br>
		</div>
		<div class="col-sm-6 text-right">
			<!-- invoice info 
			<h1></h1>
			<h5>Nouakchott, le <?php echo $order['date']; ?></h5>
			-->
			
		</div>
	</div>


	
	<!-- order etat_paiements -->
	<table class="table table-striped table-bordered">
		<thead>
			<th>NATURE DU CONGE ANNUEL</th>
			<th>NOMBRE DE JOUR</th>
			<th>DATE DE DEBUT</th>
			<th>DATE DE FIN</th>
		</thead>
		
		<tbody>
			<?php foreach($ordres_conges as $i => $item){ ?>
				<tr>
					<td><?php echo $item['nature']; ?></td>
					<td class="text-center"><?php echo $item['jours']; ?></td>
					<td class="text-center"><?php echo $item['date_debut']; ?></td>
					<td class="text-center"><?php echo $item['date_fin']; ?></td>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<br><br>
	<p>
		La présente note de service prend effet à compter du :
	</p>
	<h4><u>AMPLIATIONS:</u></h4>
	<p>
	<ul>
		<li>DGHU</li>
		<li>DAAF</li>
		<li>IG</li>
		<li>Interessé</li>
		<li>Chrono</li>
	</ul>
	</p>

<?php

?>
	<center>
	<span id="in-words" style="float: right;"><b><h5>Le Secrétaire Général<br><?php echo $order['directeur']; ?></h5></b></span>
	</center>
	
	<?php

	include_once("$currDir/footer.php");

?>
