<?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, $NumAbat, $mrs ;
// entete de la page
include 'menu/header.php';

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

$num_ordre=$_GET['ordre'];
$num_ligne_lot_decoupe =$_GET['num_ligne_lot_decoupe'];


echo "<br>Num : $num_ligne_lot_decoupe | Num ordre : $num_ordre | SERVER : ".$_SERVER['PHP_SELF']."<br>" ;


// menu haut new-supp-modif



echo "<center><HR size='1' width='500'>";
echo "<b>Cr&#233;atoin  d'une fiche de d&#233;coupe Quantitative</b>";
echo "<center><HR size='1' width='500'>";

Menu_CSD ($num_ordre) ;

echo "<br>";
echo "<table width='500' border='1' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<td width='100'>Num Lot Utilis&#233; :</td>";
echo "<form id='chglotdispo' name ='chglotdispo' method='GET' action='".$_SERVER['PHP_SELF']."'>";
echo "<input type='hidden' name='ordre' value='$num_ordre'/>";
echo "<td><select name='num_ligne_lot_decoupe' id='num_ligne_lot_decoupe' STYLE='width:120' onchange='submit()'>";

$myart =new decoupe;
$select = "select * FROM decoupe WHERE `categorie_decoupe`='4' AND `categorie_plu`='10' ORDER BY num_decoupe ASC";
$result = mysql_query($select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_ligne_lot_dispo=$myart-> num_decoupe ;
  $num_lot_dispo=$myart-> num_lot_decoupe ;
  $num_lot_dispo_trac=$myart-> tracabilite_decoupe ;

if  ($num_ligne_lot_decoupe==$num_ligne_lot_dispo)  {
  echo "<option value='$num_ligne_lot_dispo' selected='selected' >$num_lot_dispo | $num_lot_dispo_trac</option>";
  $num_lot_decoupe=$num_lot_dispo ;
  $num_ligne_lot_decoupe=$num_ligne_lot_decoupe ;
  
} else {
  echo "<option value='$num_ligne_lot_dispo' >$num_lot_dispo | $num_lot_dispo_trac</option>";
}
}
echo "</select></td>";
//

//
$myart =new entreabat;
$select = "select * FROM quantitative_haut WHERE Num_Lot='$num_lot_decoupe' ";
$result = mysql_query($select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
$Num_Client=$myart->Num_Client ;
$Num_categoriePlu=$myart->Num_categoriePlu ;
$Num_Lot=$myart->Num_Lot ;
$poid_entre=$myart->Poid_entre ;
}

echo "Num Lot : $num_lot_decoupe | Client : $Num_Client | Cateplu :$Num_categoriePlu " ;

echo "</form>";
echo "<form id='form1' name='form1' method='POST' action='ajout_decoupe_check.php'>";
echo "<input type='hidden' name='num_ligne_lot_decoupe' value='$num_ligne_lot_decoupe'/>";
echo "<input type='hidden' name='num_lot_decoupe' value='$num_lot_decoupe'/>";
echo "<input type='hidden' name='num_client_decoupe' value='$Num_Client'/>";
echo "<input type='hidden' name='Num_CatPlu' value='$Num_categoriePlu'/>";


echo "<td width='100'>Date D&eacute;coupe</td>";
echo "<td width='190'>"; //.$Date_Entre;
  
  $class = '';
  $fyear='2010';
  $lyear='2050';
  $name = 'date_decoupe';

  $yr=date("Y", strtotime($date));
  $mo=date("m", strtotime($date));
  $dy=date("d", strtotime($date));
  
 // 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 "<input type='hidden' name='num_entre' value='$num_entre'/>";
//echo "<input type='hidden' name='semaine_decoupe' value='$semaine_decoupe'/>";
//echo "NumEntre : $num_entre | semaine decoupe : $semaine_decoupe" ;

echo "<tr><td><input type='submit' value='* OK *'>
      </div></td>";
echo "<tr>";
echo "</table></form>";

include 'menu/footer.php';
?>
