<?php
include("include/data.php");
Init_boutique();
global $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $myart, $A_NumArt,$i, $result, $NbLigne, $mygroupeart, $mysousgroupeart, $semaine, $limitesuivante, $limiteprecedente, $limite, $total, $page, $Nom_Client ;
// entete de la page
include 'menu/header.php';

$Num_ligne_mrs=$_GET['Num_ligne_mrs'];
$Num_entre=$_GET['Num_entre'];

$date = date("d-m-Y");

// menu haut new-supp-modif

echo "<center>";

$myart =new table_mrs;
$select ="SELECT * FROM table_mrs WHERE Num_ligne_mrs='$Num_ligne_mrs'";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_ligne_mrs=$myart->Num_ligne_mrs ;
  $Num_ident_animal=$myart->Num_ident_animal ;
  $Num_Client=$myart->Num_Clients ;
  $Date_Entre=$myart->Date_Entre ;
  $Date_Decoupe=$myart->Date_Decoupe ;
  $Poids_carcasse=$myart->Poids_carcasse ;
  $Date_enlev_mrs=$myart->Date_enlev_mrs ;
  $Enlevement_mrs=$myart->Enlevement_mrs ;
  $Num_Bon_Mrs=$myart->Num_Bon_Mrs ;
  $Poids_Mrs=$myart->Poids_Mrs ;
  $Prestataire=$myart->Prestataire ;
}

// Titre Page //
echo "<div class='titre-text'><center><br><br>Modification D&eacute;tail MrS Num : ".$Num_ligne_mrs."</center><br>" ;

echo "<form id='form1' name='form1' method='POST' action='modif_det_mrs_ok.php'>";
echo "<table class='t-text' width='700' border='1' cellspacing='5' cellpadding='5'>";
echo "<tr>";
echo "<td width='150'>Num Bon MrS : </td>";
echo "<td width='200'><input type='text' size='12' maxlength='12' name='Num_Bon' value='$Num_Bon_Mrs'/></td>";
echo "<td width='150'>Client : </td>";
echo "<td width='200'><select name='Num_Client' id='Num_Client' STYLE='width:120'>";

$myart =new clients;
$select = 'select * FROM clients';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_Clientf=$myart->Num_Client ;
  $Let_Client=$myart->Let_Client ;
  $Nom_Client=$myart->Nom_Client ;

if  ($Num_Client==$Num_Clientf) 
echo "<option value='$Num_Clientf' selected='selected'>$Let_Client | $Nom_Client</option>";
else
echo "<option value='$Num_Clientf'>$Let_Client | $Nom_Client</option>";


}
echo "</select></td>";
echo "<tr>";
echo "<td>Poids carcasse : </td>";
echo "<td><input type='text' size='5' maxlength='5' name='Poids_carcasse' value='$Poids_carcasse'/> kg</td>";
echo "<td>Date entr&#233;e</td>";
echo "<td>";


  $class = '';
  $fyear='2010';
  $lyear='2050';
  $name = 'Date_Entre';

  $yr=date("Y",strtotime($Date_Entre));
  $mo=date("m",strtotime($Date_Entre));
  $dy=date("d",strtotime($Date_Entre));
  
 // Jour 
  
  $s="<SELECT NAME=\"${name}_d\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$dy>$dy</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=31;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$dy) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i2\"$sclt>$i</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Mois 
  
  $s.="<SELECT NAME=\"${name}_m\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$mo>$mo</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=12;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$mo) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $mon2=date("M", mktime(0, 0, 0, $i, 1, 2001));
  $s.="<OPTION VALUE=\"$i2\"$sclt>$mon2</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Année 
  
  $s.="<SELECT NAME=\"${name}_y\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$yr>$yr</OPTION>\n";
  $sclt=""; 
  for ($i=$fyear;$i<=$lyear;$i++)
  { 
  $i2="$i"; 
  if ($i2==$yr) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i\"$sclt>$i</OPTION>\n"; 
  } 
  $s.="</SELECT>\n"; 
    echo"$s";

echo "</td></tr>";
echo "<tr>";
echo "<td>Poids MrS : </td>";
echo "<td><input type='text' size='5' maxlength='5' name='Poids_Mrs' value='$Poids_Mrs'/> kg</td>";
echo "<td>Date D&#233;coupe : </td>";
echo "<td>";


  $class = '';
  $fyear='2010';
  $lyear='2050';
  $name = 'Date_Decoupe';

  $yr=date("Y",strtotime($Date_Decoupe));
  $mo=date("m",strtotime($Date_Decoupe));
  $dy=date("d",strtotime($Date_Decoupe));

  
 // Jour 
  
  $s="<SELECT NAME=\"${name}_d\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$dy>$dy</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=31;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$dy) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i2\"$sclt>$i</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Mois 
  
  $s.="<SELECT NAME=\"${name}_m\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$mo>$mo</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=12;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$mo) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $mon2=date("M", mktime(0, 0, 0, $i, 1, 2001));
  $s.="<OPTION VALUE=\"$i2\"$sclt>$mon2</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Année 
  
  $s.="<SELECT NAME=\"${name}_y\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$yr>$yr</OPTION>\n";
  $sclt=""; 
  for ($i=$fyear;$i<=$lyear;$i++)
  { 
  $i2="$i"; 
  if ($i2==$yr) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i\"$sclt>$i</OPTION>\n"; 
  } 
  $s.="</SELECT>\n"; 
    echo"$s";

echo "</td></tr>";

echo "<tr>";
echo "<td width='100'>Prestataire : </td>";
echo "<td width='100'><select style='width:100px' name='id_presta' id='id_presta'>";

$myart =new fournisseurs;
$select = 'select * FROM fournisseurs WHERE `num_cate_four`=1';
$result = mysqli_query($link, $select);
$myart->getnum($result);
  while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $id_presta=$myart->Num_fournisseur ;
  $Ident_four=$myart->Ident_four ;
echo "<option value='$id_presta'>$Ident_four</option>";
}

echo "</select></td>";

echo "<td>Date enl&#232;vement : </td>";
echo "<td>";



  $class = '';
  $fyear='2010';
  $lyear='2050';
  $name = 'Date_enlev_mrs';

  $yr=date("Y",strtotime($Date_enlev_mrs));
  $mo=date("m",strtotime($Date_enlev_mrs));
  $dy=date("d",strtotime($Date_enlev_mrs));

  
 // Jour 
  
  $s="<SELECT NAME=\"${name}_d\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$dy>$dy</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=31;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$dy) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i2\"$sclt>$i</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Mois 
  
  $s.="<SELECT NAME=\"${name}_m\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$mo>$mo</OPTION>\n";
  $sclt=""; 
  for ($i=1;$i<=12;$i++) 
  { 
  $i2="0$i"; 
  $i2=substr($i2, -2); 
  if ($i2==$mo) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $mon2=date("M", mktime(0, 0, 0, $i, 1, 2001));
  $s.="<OPTION VALUE=\"$i2\"$sclt>$mon2</OPTION>\n";
  } 
  $s.="</SELECT> / "; 

 // Année 
  
  $s.="<SELECT NAME=\"${name}_y\" class='$class'>\n"; 
  $s.="<OPTION VALUE=$yr>$yr</OPTION>\n";
  $sclt=""; 
  for ($i=$fyear;$i<=$lyear;$i++)
  { 
  $i2="$i"; 
  if ($i2==$yr) 
  $sclt=" SELECTED"; 
  else 
  $sclt=""; 
  $s.="<OPTION VALUE=\"$i\"$sclt>$i</OPTION>\n"; 
  } 
  $s.="</SELECT>\n"; 
    echo"$s";

echo "</td></tr>";

echo "<tr>";
echo "<td>N&deg; Ident</td>";
echo "<td><input type='text' value='$Num_ident_animal' size='12' maxlength='12' readonly='readonly' name='Num_ident_animal' /></td>";
echo "<td>Enlev&eacute; ?</td>";

if ($Enlevement_mrs==1) {
echo "<td colspan='1'>Oui <input name='enleve' type='radio' id='enleve' accesskey='2' tabindex='2' value='1' checked>
Non <input name='enleve' type='radio' id='enleve' accesskey='2' tabindex='2' value='0'></td>";
} else {
echo "<td colspan='1'>Oui <input name='enleve' type='radio' id='enleve' accesskey='2' tabindex='2' value='1'>
Non <input name='enleve' type='radio' id='enleve' accesskey='2' tabindex='2' value='0' checked></td>";    
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<input type='hidden' name='Num_ligne_mrs' value='$Num_ligne_mrs'/>";
echo "<input type='hidden' name='Num_entre' value='$Num_entre'/>";
echo "<br><input type='submit' value='* OK *'>";
echo "</form>";


include 'menu/footer.php';
?>
