<?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/modif_plu.php?ordre=3&num_plu=7
*/

// 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"];
}
/*
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</b></center>" ;

echo "<center><HR size='1' width='500'>";
echo "<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 "<center><br>" ;
echo "<form name='FormIntrant' method='GET' action='modif_plu_check.php'>";
echo "<input type='hidden' name='Num_entre' 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'>Nom PLU : </th>
      <td colspan='0'>
      <input name='nom_plu' type='text' id='nom_plu' accesskey='1' tabindex='1' value='$nom_plu' size='30' maxlength='30'>
	 		</td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>Nom PLU compl&eacute;ment: </th>
      <td colspan='0'>
      <input name='nom_plu_compl' type='text' id='nom_plu_compl' accesskey='2' tabindex='2' value='$nom_plu_compl' size='30' maxlength='30'>
	 		</td>";
echo "</tr>";

echo "<th width='120' align='center' valign='middle'>Categorie :</th>
	  <th width='120' align='left' valign='middle'>";
echo "<select name='num_cate_plu' id='num_cate_plu' accesskey='3' tabindex='3'>";

$myart =new categorieplu;
$select = 'select * FROM categorieplu';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_cate_plu=$myart->Num_CatPlu ;
  $categorie_plu=$myart->CategoriePlu ;

 if ($num_cate==$num_cate_plu) {
	echo "<option value='$num_cate_plu' selected='selected'>$categorie_plu</option>";
 } else {
	echo "<option value='$num_cate_plu'>$categorie_plu</option>";
}}

echo "</select>";

echo "</th></tr> ";
echo "<tr>";
echo "<th width='120' align='center' valign='middle'>Type : </th>
	  <th width='120' align='left' valign='middle'>";
echo "<select name='num_type_plu' id='num_type_plu' accesskey='4' tabindex='4'>";

$myart =new type_plu;
$select = 'select * FROM type_plu';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_cate_plu=$myart->Num_TypePlu ;
  $categorie_plu=$myart->TypePlu ;

 if ($num_type==$num_cate_plu) {
	echo "<option value='$num_cate_plu' selected='selected'>$categorie_plu</option>";
 } else {
	echo "<option value='$num_cate_plu'>$categorie_plu</option>";
}}
echo "</select>";

echo "</th></tr> ";
echo "<tr>";
echo "<th align='center' valign='middle'>Code tra&#231;abilit&#233;e : </th>
      <td colspan='0'>
      <input name='attribu_plu' type='text' id='attribu_plu' accesskey='5' tabindex='5' value='$attribu_plu' size='10' maxlength='4'>
	 </td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>D.L.C </th>
      <td colspan='0'>
	  <input name='dlc_plu' type='text' id='dlc_plu' accesskey='6' tabindex='6' value='$dlc_plu'  size='10' maxlength='4'> jours</td>";
echo "</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';
?>
