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

	/* get invoice */
	$order_id = intval($_REQUEST['id_mission']);
	if(!$order_id) exit(error_message('ID facture invalide!', false));
	
	/* retrieve order info */
	$order_fields = get_sql_fields('missions');
	$res = sql("select {$order_fields} from {$order_from} and id_mission={$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('ordres_missions');
	$item_from = get_sql_from('ordres_missions');
	$res = sql("select {$item_fields} from {$item_from} and ordres_missions.from_mission={$order_id}", $eo);
	while($row = db_fetch_assoc($res)){
		//$row['LineTotal'] = str_replace('$', '', $row['montant']) * $row['qte'];
		$ordres_missions[] = $row;
		//$order_total += $row['LineTotal'];
	}
	
	//var_dump(ordres_missions);
	
	?>

<html>
<head>
	<title>Ordre de mission</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>


<br><br><br><br><br><br><br><br><br><br><br>
<center><u><h1>ORDRE DE MISSION</h1></u></center>

	<div class="row">
		<div class="col-sm-6">
			<!-- customer info -->
			<h5><u>DESTINATION</u> : <?php echo $order['destination']; ?></h5>
			<h5><u>MOTIF DE LA MISSION</u> : <?php echo $order['motif']; ?></h5>
			<h5><u>MOYEN DE TRANSPORT</u> : <?php echo $order['moyen']; ?></h5>
			<h5><u>DATE DE DEPART</u> : <?php echo $order['date_depart']; ?></h5>
			<h5><u>DATE DE RETOUR</u> : <?php echo $order['date_retour']; ?></h5>
			
		</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>NOM ET PRENOM</th>
			<th>FONCTION</th>
			<th>DIRECTION</th>
			<th>SERVICE</th>
		</thead>
		
		<tbody>
			<?php foreach($ordres_missions as $i => $item){ ?>
				<tr>
					<td><?php echo $item['nom_prenom']; ?></td>
					<td><?php echo $item['fonction']; ?></td>
					<td><?php echo $item['direction']; ?></td>
					<td><?php echo $item['service']; ?></td>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<br>
	<h3><u>AMPLIATIONS:</u></h3>
	<p>
	<ul>
		<li>MHUAT</li>
		<li>DAAF</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>
	<!--
	<center>
	<p>
		Numéro Téléphone : +222 37 66 39 34 | +213 780 01 12 81 | Email gérant : boubouttboullah@icloud.com<br>
		Email bureau : sbbs.impexp@gmail.com | RC : 102204/GU/23213/477 | NIF : 00621223
	</p>
	</center>
	-->
	<!-- <span id="in-words" style="color: red;"><b>NB. AUCUNE SOMME PAYEE N'EST EN AUCUN CAS REMBOURSABLE</b></span> /-->
	
	<?php

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

?>
