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

include 'menu/header.php';

$num_ordre=$_GET['ordre'];

/*
echo "<br>num entre : $num_entre | $select<br>" ;
echo "$Date_Fabric | $date_e | $DLC_Fabric | $date_dlc | $Num_Lot_Fabric | $Traca_Fabric<br>" ;
echo "$Client_Fabric | $Unite_Fabric | $Observation | $Etat | $Timestamp<br>" ;
echo "$num_plu_intant | $nom_plu_intrant | $num_cate_intrant | $num_unite_plu_intrant | $dlc_plu_intrants<br>" ;
//
//<a class='' href='consult_intrants.php?num_entre=$Num_entre_intrant&ordre=2'></a>
*/

echo "<div class='titre-text'><center>Saisie d'une Fabrication</div></center><HR size='1' width='500'></center>";
echo "<center><br>" ;
echo "<form id='ChgCateFabric' id='thing-alerts' name ='ChgCateFabric' method='get' action='ajout_saisie_fabrication_haut.php'>";
//echo "<input type='hidden' name='num_entre' value='$num_entre'/>";
echo "<input type='hidden' name='ordre' value='$num_ordre'/>";
echo "<table class='t-text' width='800' border='1' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<th align='center' valign='middle'>Cat&#233;gorie : </th>";
echo "<th width='120' align='left' valign='middle'>";
echo "<select name='Cate_Fabric' id='Cate_Fabric'>";
echo "<OPTION VALUE='0' SELECTED>Toutes</OPTION>\n";

$myart =new categorie_fabrications;
$select = 'SELECT * FROM categorie_fabrications ';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_Cate_Fabric=$myart->num_cate_fabric ;
  $Nom_Cate_Fabric=$myart->categorie_fabrication ;

 if ($Num_Cate_Fabric==$Cate_Fabric) {
	echo "<option value='$Num_Cate_Fabric' selected='selected'>$Nom_Cate_Fabric</option>";
 } else {
	echo "<option value='$Num_Cate_Fabric'>$Nom_Cate_Fabric</option>";
}


}
echo "</select>";

echo "</th> ";
echo "<th width='120' align='center' valign='middle'>PLU</th>
	  <th width='120' align='left' valign='middle'>";
echo "<select name='Num_plu_Fabric' id='Num_plu_Fabric'>";
echo "<OPTION VALUE='0' SELECTED>Toutes</OPTION>\n";
$myart =new plu;
$select = 'SELECT * FROM plu WHERE Num_TypePlu=2'; 
$select.=" AND IdNumClient='".$IdNumClient."'";
$select.=" ORDER BY `Num_PLU` ASC";

$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_plu=$myart->Num_PLU ;
  $Nom_plu_Fabric=$myart->PLU ;
  $dlc_plu=$myart->dlc_plu ;

 if ($Num_plu==$Num_plu_Fabric) {
	echo "<option value='$Num_plu' selected='selected'>$Num_plu | $Nom_plu_Fabric</option>";
	$dlc_plu_Fabric=$dlc_plu ;
	
	
 } else {
	echo "<option value='$Num_plu'>$Num_plu | $Nom_plu_Fabric</option>";
}


}

echo "<input type='hidden' name='dlc_plu_Fabric' value='$dlc_plu_Fabric'/>";

echo "</select>";
echo "</th></tr> ";
echo "<tr>";
echo "<th width='120' align='center' valign='middle'>Client : </th>
	  <th width='120' align='left' valign='middle'>";
echo "<select name='Num_Client_Fabric' id='Num_Client_Fabric'>";

$myart =new clients;
$select = 'SELECT * FROM clients';
$select.=" WHERE IdNumClient='".$IdNumClient."'";
$select.=" ORDER BY `clients`.`Nom_Client` ASC";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_Client=$myart->Num_Client ;
  $Nom_Client=$myart->Nom_Client ;
  $Nom_Let_Client=$myart->Let_Client ;

  echo "<option value='$Num_Client'>$Nom_Let_Client | $Nom_Client</option>";
}

echo "";
echo "<th align='center' valign='middle'>Date Fabrication : </th>
      <td colspan='0'>
      <input type='date' name='Date_Fabric'  id='Date_Fabric' accesskey='3' tabindex='3' value='$Date_Fabric'></td>";
echo "</tr>";
echo "<tr>";	  
echo "<th align='center' valign='middle'>Poids :  </th>
      <td colspan='0'><input type='text' name='Poid_Fabric'  id='Poid_Fabric' accesskey='5' tabindex='5' size='7'>";
	  echo "<select name='num_unitee_plu_intran' id='num_unitee_plu_intran'>";

$myart =new unitee ;
$select = 'select * FROM unitee';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_unitee=$myart->num_unite ;
  $nom_unite_long=$myart->nom_unite_long ;
  $nom_unite_ini=$myart->nom_unite_ini ;
  $conversion=$myart->conversion ;

  if ($Unite_Fabric==$num_unitee) {
	echo "<option value='$num_unitee' selected='selected'>$nom_unite_ini | $nom_unite_long</option>";
 } else {
	echo "<option value='$num_unitee'>$nom_unite_ini | $nom_unite_long</option>";
 }
}
  
echo "<th align='center' valign='middle'>Observation </th>
      <td colspan='0'><input type='text' name='Observation_Fabric'  id='Observation_Fabric' accesskey='5' tabindex='5'></td>";
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>" ;

echo "<center><br>" ;
include 'menu/footer.php';
?>
