<!doctype html>
<html><head>
<meta charset="UTF-8">
<title>DEVIS</title>

	

	<link rel="stylesheet" href="textedit.css" media="all" />
	<link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
	<script src="js/jquery-2.1.0.min.js"></script>
	<script type="text/javascript" src="js/jquery.tablednd.js"></script>
	<script src="js/jquery-ui.js"></script>
	<script src="js/jquery.ui.touch-punch.js"></script>

	
	<script src="/js/moment.js"></script>
	<script src="/js/jquery.redirect.js"></script>
	<!-- <script src="/js/swap.js"></script> -->
	
	</head>
    

    
 <body >



   
		<?php

		$NumeroIndexDevisP=$_POST['dnumdevis'];
		
	
		?>
	
	


<script type="text/javascript">   
	
   
    	

          
             $.post("textelettrefacres.php", { 'dnumdevis':<?php echo $NumeroIndexDevisP ?>},function(postresult){
        $("#presentprod").html(postresult); });
            
                                              
        $.post("textegenconfacres.php", { 'dnumdevis':<?php echo $NumeroIndexDevisP ?>},function(postresult){
       $("#presentcond").html(postresult); });
            
                                              
             $.post("texteditfacres.php", { 'dnumdevis':<?php echo $NumeroIndexDevisP ?>},function(postresult){
        $("#present").html(postresult); });
            
 $.post("textereceptionres.php", { 'dnumdevis':<?php echo $NumeroIndexDevisP ?>},function(postresult){
        $("#presentreception").html(postresult); });
                     

	

	</script>
	
<div id="present" style="display: inline-block;position: relative"></div> 
     
        
<p style="page-break-after: always;">&nbsp;</p>
<p style="page-break-before: always;">&nbsp;</p>

     
     <?php

		$NumeroIndexDevisP=$_POST['dnumdevis'];
		$NumeroIdxClient=$_POST['didxcli'];
	//	print "<br>".$NumeroIndexDevisP;	
	//	print "<br>".$NumeroIdxClient;	

// on se connecte à notre base pour devis

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "facture";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
	
				//	 $sql = "SELECT * FROM tete";
$sql = "SELECT * FROM tete WHERE idx=".$NumeroIndexDevisP." ";
//$sql = "SELECT * FROM tete WHERE idx=".intval($_POST['idxcli'])." ";
//print "<br>".$sql;	
			// print "<br>".$sql;	
			 
					// $sql = "UPDATE\n". "  `data`\n"." SET\n". " societe = \'testoooyeahhh\'\n". "WHERE\n". " id = 3";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
		
$NUM=$row["num"];
$IDX=$row["idx"];
$DATE=$row["date"];
$OBJETT=$row["objet"];
$IDXCLI=$row["idxcli"];
$MEMO=$row["memo"];
$ETATC=$row["etat"];		
		$NumeroIdxClient=$row["idxcli"];;
$CHANTIER=$row["chantier"];
$TVA=$row["tva"];
$BANQUE=$row["banque"];
$REMARQUE=$row["remarque"];
		$LETTRE=$row["lettre"];

    } 
    
	
	} else {
   // echo "0 results";
}

//$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour)
//VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', //'$today')";


$conn->close();

//print "<br>---->".strpos($TVA, '6%');
                                              
 if ((strpos($TVA, '6%')) > 0) {
     print "<div id='presentprod' style='display: inline-block;position: relative'></div>";
    } else {print "<div id='presentprod' style='display: none;position: relative'></div>";
		}
                                              
		?>
	
     
     
     
     
     
 
        
<p style="page-break-after: always;">&nbsp;</p>
<p style="page-break-before: always;">&nbsp;</p>

 <div id="presentcond" style="display: inline-block ;position: relative"></div>  
    
     <div id="presentreception" style="display: inline-block ;position: relative"></div>  

</body>		


</html>
