<?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.100/horius/ajout_nonconform.php?ordre=1
*/

include 'menu/header.php';

$last_num_entre = 0 ;
$sql = "SELECT max(Num_ligne_Conformite) FROM Table_Non_Conformite";  
$req = mysqli_query($link, $sql); 
$row = mysqli_fetch_row($req);
$last_num_entre = $row[0];
$last_num_entre = $last_num_entre + 1 ;

echo "<div class='titre-text'><center>Ajout d'une Non Conformit&eacute;e</div></center>" ;

echo "<center><HR size='1' width='500'></center>";
echo "<center><br>" ;
echo "<form name='FormIntrant' method='GET' action='traitement_ajout_conformite.php'>";
echo "<input type='hidden' name='ordre' value='1'/>";
echo "<input type='hidden' name='Num_ligne_Conformite' value=$last_num_entre>";
echo "<center>" ;
echo "<table width='600' id='customers'>";
echo "<tr>";
echo "<th width='50'>Num ligne :</th>" ;
echo "<td width='550'>$last_num_entre</td>" ;
echo "</tr><tr>";
echo "<th width='150'>Date Non Conformit&eacute;e :</th>" ;
echo "<td width='550'><input type='date' name='dateconformite' value=$aujourdhui_db></td>" ;
echo "</tr><tr>";
echo "<th width='50'>Cat&eacute;gorie :</th>" ;
echo "<td><select style=' width: 200px;' name='Num_CatConf' id='Num_CatConf'>";
echo "<option value='0'>Toutes</option>";
$myart =new categorieplu;
$select = 'select * FROM categorie_conformite';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_cate_cft=$myart->num_cate_cft ;
  $categorie_cft=$myart->categorie_cft ;
  
  echo "<option value='$num_cate_cft'>$num_cate_cft | $categorie_cft</option>";	
    
}
echo "</select>";
echo "</tr><tr>";
echo "<th width='150'>Titre Non Conformit&eacute;e</th>" ;
echo "<td width='550'><textarea name='Conformite_courte' rows='1' cols='60'></textarea></td>" ;
echo "</tr><tr>";
echo "<th width='150'>Non Conformit&eacute;e :</th>" ;
echo "<td width='550'><textarea name='Conformite_longue' rows='5' cols='60'></textarea></td>" ;
echo "</tr><tr>";

echo "<th width='150'>Etat non-conformit&eacute;e :</th>" ;
echo "<td><select style=' width: 200px;' name='Etat_conformite' id='Etat_conformite'>";
	echo "<option value='0' >En cours</option>";
	echo "<option value='1'	>Clotur&eacute;e sans action corretive Clotur&eacute;e</option>";
	echo "<option value='2'	>Clotur&eacute;e avec action corretive Clotur&eacute;e</option>";

echo "</select></td>";
echo "</tr><tr>";
echo "<th width='50'>Titre Action Corrective</th>" ;
echo "<td width='550'><textarea name='action_corrective_courte' rows='1' cols='60'></textarea></td>" ;
echo "</tr><tr>";
echo "<th width='50'>Action Corrective : </th>" ;
echo "<td width='550'><textarea name='action_corrective_longue' rows='5' cols='60'></textarea></td>" ;
echo "</tr></table>";

echo "<br>";
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';
?>
