<?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';
$num_entre=$_GET['num_entre'];
$num_ordre=$_GET['ordre'];

$myart =new fabrications_haut;
$select = "SELECT * FROM fabrications_haut WHERE Num_Fabric='$num_entre'";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result) ;
  $Num_Fabric =$myart->Num_Fabric ;
  $Num_plu_Fabric =$myart->Num_plu_Fabric ;
  $Cate_Fabric =$myart->Cate_Fabric ;
  $Client_Fabric =$myart->Client_Fabric ;
  $Semaine_Fabric =$myart->Semaine_Fabric ;
  $Date_Fabric =$myart->Date_Fabric ;
  $DLC_Fabric =$myart->DLC_Fabric ;
  $Num_Lot_Fabric =$myart->Num_Lot_Fabric ;
  $Traca_Fabric =$myart->Traca_Fabric ;	
  $Poid_Fabric =$myart->Poid_Fabric ;
  $Unite_Fabric =$myart->Unite_Fabric ;
  $Observation =$myart->Observation ;
  $Etat = $myart->Etat ;
  $Timestamp =$myart->Timestamp ;

}
$date_e=date("d/m/Y", strtotime($Date_Fabric));
$date_dlc=date("d/m/Y", strtotime($DLC_Fabric));

/*
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 "<br><center><b>Modification Fabrications Lot : $Num_Lot_Fabric</b></center>" ;
Menu_CSD ($num_ordre) ;
echo "<center><HR size='1' width='500'></center>";
echo "<center><br>" ;
echo "<form name='FormIntrant' id='thing-alerts' method='POST' action='modif_fabrications_haut_check.php'>";
echo "<input type='hidden' name='num_entre' value='$num_entre'/>";
echo "<table class='t-text' width='750' border='1' cellspacing='1' cellpadding='1'>";
echo "<tr>";
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'>";

$myart =new plu;
$select = 'SELECT * FROM plu WHERE Num_TypePlu=2 ORDER BY `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 ;

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


}
echo "</select>";
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'>";

$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></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 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 ;

 if ($Num_Client==$Client_Fabric) {
	echo "<option value='$Client_Fabric' selected='selected'>$Nom_Let_Client | $Nom_Client</option>";
 } else {
	echo "<option value='$Client_Fabric'>$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'>&#233;tat ? </th>
      <td colspan='0'>
	  <select name='Etat_Fabric' id='Etat_Fabric'>";
	 if ($Etat==0) {
	echo "<option value='0' selected='selected'>En Cours</option>";
	echo "<option value='1'>Cloturer</option>";
 } else {
	echo "<option value='0'>En Cours</option>";
	echo "<option value='1' selected='selected'>Cloturer</option>";
}
echo "</select>";

echo "<th align='center' valign='middle'>D.L.C </th>
      <td colspan='0'>
	  <input type='date' name='DLC_Fabric'  id='DLC_Fabric' accesskey='5' tabindex='5' value='$DLC_Fabric'></td>";
echo "<tr>";	  
echo "<th align='center' valign='middle'>N Lot : </th>
      <td colspan='0'><input type='text' name='Num_Lot_Fabric'  id='Num_Lot_Fabric' accesskey='5' tabindex='5' value='$Num_Lot_Fabric' readonly></td>";
echo "<th align='center' valign='middle'>Tra&#231;abilit&#233;e </th>
      <td colspan='0'><input type='text' name='Traca_Fabric'  id='Traca_Fabric' accesskey='5' tabindex='5' value='$Traca_Fabric' readonly></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' value='$Poid_Fabric' 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' value='$Observation'></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>" ;


include 'menu/footer.php';
?>
