<?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('permissions');
	if(!$order_from) exit(error_message('Accès non autorisé!', false));

	/* get invoice */
	$order_id = intval($_REQUEST['id_permission']);
	if(!$order_id) exit(error_message('ID facture invalide!', false));
	
	/* retrieve order info */
	$order_fields = get_sql_fields('permissions');
	$res = sql("select {$order_fields} from {$order_from} and id_permission={$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('permissions');
	$item_from = get_sql_from('permissions');
	$res = sql("select {$item_fields} from {$item_from} and permissions.matricule={$order_id}", $eo);
	while($row = db_fetch_assoc($res)){
		//$row['LineTotal'] = str_replace('$', '', $row['montant']) * $row['qte'];
		$ordres_permissions[] = $row;
		//$order_total += $row['LineTotal'];
	}
	
	//var_dump(ordres_permissions);
	
	?>
<html>
<head>
	<title>Note de service de permissions</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>
<center><u><h4>NOTE DE SERVICE DE PERMISSION N° <?php echo $order['id_permission']; ?>/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 DU BENEFICIAIRE</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>DIVISION</u> : <?php echo $order['division']; ?></p>
			<p><u>N°FICHE DE LA DEMANDE DE PERMISSION</u> : <?php echo $order['num_fiche']; ?></p>
<br><br>
		</div>

		</div>


	
	<!-- order etat_paiements -->
		<p><u>NATURE DE LA PERMISSION</u> : <?php echo $order['nature']; ?></p>
		<p><u>NOMBRE DE JOUR</u> : <?php echo $order['jours']; ?></p>
		<p><u>DATE DE DEBUT</u> : <?php echo $order['date_debut']; ?></p>
		<p><u>DATE DE FIN</u> : <?php echo $order['date_fin']; ?></p>


	<br>
	<p>
		La présente note de service prend effet à compter du :
	</p>
	<h4><u>AMPLIATIONS:</u></h4>
	<p>
	<ul>
		<li>IG</li>
		<li>DAAF</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");

?>
