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

/*
http://192.168.1.200/orius/modif_cf.php?ordre=2&numligne=4
*/
if (!isset($_GET['ordre'])) { 
		// Transmis en POST
		$num_ordre=$_POST['ordre'];
		if (isset($_POST['numligne'])) { $numligne=$_POST['numligne']; }  else {$numligne=''; }
		$valForm="POST" ;
} else {
		// Transmis en GET
		$num_ordre=$_GET['ordre'];
		if (isset($_GET['numligne'])) { $numligne=$_GET['numligne']; } else {$numligne=''; }
		$valForm="GET" ;
}


include 'menu/header.php';


$sql = "select * FROM Base_CF WHERE `Num_ligne_CF`=".$numligne ;
$req = mysqli_query($link, $sql);  
while ($row = mysqli_fetch_assoc($req)) {
				 $NumLigneCF = $row["Num_ligne_CF"];
	       $Num_CF = $row["Num_CF"];
	       $Nom_CF = $row["Nom_CF"];
			   $Temp_Min = $row["Temp_Min"];
			   $Temp_Max = $row["Temp_Max"];
			   $Hydro_Min = $row["Hydro_Min"];
				 $Hydro_Max = $row["Hydro_Max"];
			   $num_cate_cf = $row["num_cate_cf"];
			 }


echo "<div class='titre-text'><center>Modification de la Chambre Froide N° $Num_CF</div></center>" ;

echo "<center><HR size='1' width='500'></center>";
echo "<center><br>" ;
echo "<form name='FormIntrant' method='GET' action='traitement_modif_base_cf.php'>";
echo "<input type='hidden' name='Num_CF' value='$Num_CF'/>";
echo "<input type='hidden' name='ordre' value='1'/>";
echo "<table class='t-text' width='500' border='1' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<th width='125' align='center' valign='middle'>Categorie</th>
	  <td colspan='3' width='250' align='left' valign='middle'>";
echo "<select style=' width: 150px;' name='Num_CatPlu' id='Num_CatCF'>";
echo "<option value='0'>Toutes</option>";

$sql = 'select * FROM categorie_CF';
$req = mysqli_query($link, $sql);  
while ($row = mysqli_fetch_assoc($req)) {
        $num_cate_plu_intran = $row["num_cate_cf"];
        $categorie_plu_intran = $row["categorie_cf"];
        
        if ($num_cate_plu_intran==$num_cate_cf)
        {
        echo "<option value='$num_cate_plu_intran' selected>$num_cate_plu_intran | $categorie_plu_intran</option>";	
        } else {
        echo "<option value='$num_cate_plu_intran'>$num_cate_plu_intran | $categorie_plu_intran</option>";
        }
   			
}

echo "</select>";

echo "</th></tr> ";
echo "<tr>";
echo "<th align='center' valign='middle'>Nom Ch Froide : </th>";
echo "<td colspan='3'><input name='Nom_plu_intrant' type='text' id='Nom_plu_intrant' accesskey='3' tabindex='3' value='$Nom_CF' size='30' maxlength='30'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>T&deg; c Min </th>
      <td colspan='0'><select name='temp_min' id='temp_min'>";
      
				$a=$Temp_Min;
				for ($i = -22; $i <= 20; $i+=0.2) {
				$i = number_format($i, 2, '.', ' ')	;
				 	if ($a==$i){
				 	echo "<option value='$i' selected>$i</option>";	
				 	} ELSE {
				 	echo "<option value='$i'>$i</option>";	
				 	}
				 	
				}

echo "</select>";

echo "<th align='center' valign='middle'>T&deg; c Max </th>";
echo "<td colspan='0'><select name='temp_max' id='temp_max'>";
				$a=$Temp_Max;
				for ($i = -22; $i <= 20; $i+=0.2) {
				$i = number_format($i, 2, '.', ' ')	;
				 	if ($a==$i){
				 	echo "<option value='$i' selected>$i</option>";	
				 	} ELSE {
				 	echo "<option value='$i'>$i</option>";	
				 	}
				 	
				}
		
echo "</select>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle'>Hydro Min</th>
      <td colspan='0'><select name='hydro_min' id='temp_min'>";
      if ($Hydro_Min==0) {echo "<option value='0' selected>Pas Hydro</option>";} ELSE {echo "<option value='0'>Pas Hydro</option>";}
          	
				for ($i = 1; $i <= 100; $i+=0.1) {
				$i = number_format($i, 2, '.', ' ')	;
				 	if ($Hydro_Min==$i){
				 	echo "<option value='$i' selected>$i</option>";	
				 	} ELSE {
				 	echo "<option value='$i'>$i</option>";	
				 	}
				 				 		
				 	}
echo "</select>";

echo "<th align='center' valign='middle'>Hydro Max</th>";
echo "<td colspan='0'><select name='hydro_max' id='temp_max'>";
if ($Hydro_Max==0) {echo "<option value='0' selected>Pas Hydro</option>";} ELSE {echo "<option value='0'>Pas Hydro</option>";}
          	
				for ($i = 1; $i <= 100; $i+=0.1) {
				$i = number_format($i, 2, '.', ' ')	;
				 	if ($Hydro_Max==$i){
				 	echo "<option value='$i' selected>$i</option>";	
				 	} ELSE {
				 	echo "<option value='$i'>$i</option>";	
				 	}
				 				 		
				 	}
				 	
				
echo "</select>";
echo "</tr>";

echo "<tr>";
echo "<th colspan='4' 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>" ;


include 'menu/footer.php';
?>
