<?php
include("include/data.php");
Init_boutique();
global $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $myart, $result, $NbLigne, $semaine, $limitesuivante, $limiteprecedente, $total, $page ;
// entete de la page

include 'menu/header.php';
/*
http://192.168.1.200/horius/detail_plu.php?ordre=2&num_plu=1
*/

// Get ou Post existe ou pas ?
if (!isset($_GET['ordre'])) { 
		// Transmis en POST
		$num_ordre=$_POST['ordre'];
		if (isset($_POST['num_plu'])) { $num_plu=$_POST['num_plu']; }  else {$num_plu=''; }
		$valForm="POST" ;
} else {
		// Transmis en GET
		$num_ordre=$_GET['ordre'];
		if (isset($_GET['num_plu'])) { $num_plu=$_GET['num_plu']; }  else {$num_plu=''; }
		$valForm="GET" ;
}

$sql = "SELECT * FROM plu WHERE Num_PLU='$num_plu'";
$sql.=" AND IdNumClient='".$IdNumClient."'";

$result =mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($result)) {
        $num_plu = $row["Num_PLU"]; 
			  $nom_plu = $row["PLU"];
			  $nom_plu_compl = $row["Plu_complement"];  
			  $num_cate = $row["Num_CatPlu"];
			  $num_type = $row["Num_TypePlu"]; 
			  $attribu_plu = $row["attribu_plu"]; 
			  $dlc_plu = $row["dlc_plu"];
			  $Cpt_plu = $row["Cpt_cpta"];
}

$sql1 = "SELECT * FROM plu_textes WHERE Num_PLU='$num_plu'";
$sql1.=" AND IdNumClient='".$IdNumClient."'";

$result1 =mysqli_query($link, $sql1);
while ($row = mysqli_fetch_assoc($result1)) {
        $num_plu = $row["Num_PLU"]; 
			  $ingredients = $row["ingredients"];
			  $mlegal_1 = $row["mlegal_1"];  
			  $mlegal_2 = $row["mlegal_2"];
			  $Tmin = $row["Tmin"]; 
			  $Tmax = $row["Tmax"]; 
			  $Tx_tva = $row["Tx_tva"];
			 
}

/*
echo "<br>num entre : $num_plu | $sql<br>" ;
echo "$num_plu | $nom_plu | $nom_plu_compl | $num_cate | $num_type | $attribu_plu | $dlc_plu | $Cpt_plu<br>" ;
*/

echo "<br><center><b>Consultation du d&#233;tail Plu N&#176; $num_plu - $nom_plu  $nom_plu_compl </b></center>" ;

echo "<center><HR size='1' width='500'>";
echo "<a href='plu_detail.php?ordre=$num_ordre&num_plu=$num_plu'><button>P.L.U</button></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='detail_plu.php?ordre=$num_ordre&num_plu=$num_plu'><button>D&#233;tail</button></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='detail_plu_tarif.php?ordre=$num_ordre&num_plu=$num_plu'><button>Tarif</button></a>";
echo "<br><br>" ;
echo "<form name='FormIntrant' method='GET' action='modif_det_plu.php'>";
echo "<input type='hidden' name='num_plu' value='$num_plu'/>";
echo "<input type='hidden' name='num_ordre' value='$num_ordre'/>";
echo "<table class='t-text' width='700' border='1' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<th align='center' valign='middle'>Ingredients : </th>
      <td colspan='0'><input name='Ingredients' type='text' id='Ingredients' accesskey='1' tabindex='1' value='$ingredients' size='50' maxlength='50'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>Mention L&#233;gale 1: </th>
      <td colspan='0'><input name='mlegal_1' type='text' id='mlegal_1' accesskey='2' tabindex='2' value='$mlegal_1' size='30' maxlength='30'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>Mention L&#233;gale 2: </th>
      <td colspan='0'><input name='mlegal_2' type='text' id='mlegal_2' accesskey='2' tabindex='2' value='$mlegal_2' size='30' maxlength='30'></td>";
echo "</tr>";

echo "<th width='120' align='center' valign='middle'>Temp&#233;rature de conservation :</th>
	  <th width='120' align='left' valign='middle'>entre :&nbsp;&nbsp;&nbsp;&nbsp; ";
echo "<select name='Tmin' id='Tmin' accesskey='3' tabindex='3'>";

for ($i=0; $i <11 ; $i++) { 

 if ($Tmin==$i) {
	echo "<option value='$i' selected='selected'>$i</option>";
 } else {
	echo "<option value='$i'>$i</option>";
}}
echo "</select>&nbsp;&nbsp;&nbsp;&nbsp; et &nbsp;&nbsp;&nbsp;&nbsp; ";

echo "<select name='Tmax' id='Tmax' accesskey='4' tabindex='4'>";
for ($i=0; $i <11 ; $i++) { 

 if ($Tmax==$i) {
	echo "<option value='$i' selected='selected'>$i</option>";
 } else {
	echo "<option value='$i'>$i</option>";

}}
echo "</select>";
echo "</th></tr> ";

echo "<tr>";
echo "<th align='center' valign='middle'>Taux de Tva </th>";
echo "<td><select name='Code_Tva' id='Code_Tva' accesskey='3' tabindex='3'>";

$sql = "SELECT * FROM TVA ";  
$req = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($req)) {
	$Code_Tva = $row["Code_Tva"];
	$Taux_Tva = $row["Taux_Tva"];

if ($Code_Tva==$Tx_tva) {
	echo "<option value='$Code_Tva' selected='selected'>$Taux_Tva &#37;</option>";
 } else {
	echo "<option value='$Code_Tva'>$Taux_Tva &#37;</option>";

}}

echo "</select></td>";
echo "</th></tr> ";

echo "<tr>";
echo "<th colspan='2' align='center' valign='middle'>
	  <input type='submit' name='ok' id='ok' value='Valider' accesskey='11' tabindex='11'>
	  &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
	  <input name='an' type='button' id='an' accesskey='12' tabindex='12' value='Retour' onClick='history.back()'></th>";
echo " </tr></div>";
echo "</table>";
echo "</form>";
echo "</center><br>" ;
//echo $sql1;

include 'menu/footer.php';
?>
