<?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('entete');
	if(!$order_from) exit(error_message('Access denied!', false));

	/* get invoice */
	$order_id = intval($_REQUEST['identete']);
	if(!$order_id) exit(error_message('Invalid invoice ID!', false));
	
	/* retrieve entete info */
	$order_fields = get_sql_fields('entete');
	$res = sql("select {$order_fields} from {$order_from} and identete={$order_id}", $eo);
	if(!($order = db_fetch_assoc($res))) exit(error_message('Invoice not found!', false));
	?>

<html>
	<head>
		<title></title>
	<style type="text/css" media="print">
		input.imprimer{
			display:none;
		}
		
		.imprimer{
			display: none;
		}
	</style>
	
	<style>
		#imgentete
		{
			width: 80px;
			height: 80px;
			float: left;
		}		
		
		#imgentete2
		{
			width: 80px;
			height: 80px;
			float: right;
		}
		
		#bas {
			position: fixed;
			bottom: 0;
			width: 100%;
		}
	</style>
	 
	</head>
 
<body>
	<h4><a class="imprimer" href="entete_view.php">Retour</a></h4>
	
	<form method="POST" action=""> 
		<input type="button" value="Imprimer" class="imprimer" name="bnom" onClick="javascript:window.print()">
	</form>
</body>
 
</html>

	<div class="row">
		<div class="col-sm-6">
			<!-- customer info -->
			<div>
				<?php
					$logo_src = getUploadDir("") .$order["logo"];
					echo "<img id='imgentete' src=\"{$logo_src}\" />";
				?>
			</div>			
			<div>
				<?php
					$logo_src = getUploadDir("") .$order["logop"];
					echo "<img id='imgentete2' src=\"{$logo_src}\" />";
				?>
			</div>
			<h1 class="text-center"><?php echo $order['raison_sociale']; ?></h1>		
			<p class="text-center"><?php echo $order['description']; ?></p>			
		</div>		
	</div>
			<hr>
			<br><br>
	
	<div id="bas">
		<hr>
		<center>
			<p><?php echo $order['footer_3']; ?></p>
		</center>
	</div>

