<?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_entre=$_GET['num_entre'];
$num_ordre=$_GET['ordre'];
//
//echo "<br>Num Entre : $num_entre | Num ordre : $num_ordre <br>" ;
//

$select = "SELECT * FROM decoupe WHERE num_decoupe='$num_entre'";

$myart =new decoupe;
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
	$myart->readrow($result);
	$num_decoupe=$myart->num_decoupe ;
	$date_decoupe=$myart->date_decoupe ;
	$semaine_decoupe=$myart->semaine_decoupe ;
	$num_client_decoupe=$myart->num_client ;
	$num_lot_decoupe=$myart->num_lot_decoupe ;
	$tracabilite_decoupe=$myart->tracabilite_decoupe ;
	$categorie_decoupe=$myart->categorie_decoupe ;
	$categorie_plu_decoupe=$myart->categorie_plu ;
	$poid_decoupe=$myart->poid_decoupe ;
	$cloture=$myart->cloture ;
	$observations=$myart->observations ;
	
	$num_lot_decoupe=strtoupper ($num_lot_decoupe) ;
	$tracabilite_decoupe=strtoupper ($tracabilite_decoupe) ;
	$semaine_decoupe=date("W", strtotime($date_decoupe));
    $date_decoupe_ok=date("d/m/Y", strtotime($date_decoupe));
}
// menu haut new-supp-modif



echo "<center><HR size='1' width='500'>";
echo "<b>Fiche de d&#233;coupe N&deg; $num_entre pour le lot N&deg; $num_lot_decoupe </b>";
echo "<center><HR size='1' width='500'>";

Menu_CSD ($num_ordre) ;

echo "<br>";
echo "<form id='form1' name='form1' method='POST' action='".$_SERVER["HTTP_REFERER"]."'>";
echo "<table class='t-text' width='600' border='1' cellspacing='2' cellpadding='2'>";
echo "<tr>";
echo "<td width='150'>categorie PLU</td>";
echo "<td>";

$myart =new categorieplu;
$select = 'select * FROM categorieplu';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_CatPluf=$myart->Num_CatPlu ;
  $CategoriePlu=$myart->CategoriePlu ;
  
if  ($Num_CatPluf==$categorie_plu_decoupe)   
  echo "$Num_CatPluf | $CategoriePlu";
 
}
echo "</td>";
echo "<td width='150'>Date D&eacute;coupe : </td>";
echo "<td><center>".$date_decoupe_ok."</center>";
  
echo "</td></tr>";
echo "<tr>";
echo "<td>Client :</td>";
echo "<td>";

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

if  ($num_client_decoupe==$Num_Client) 
echo "$Let_Client | $Nom_Client";
}
echo "</td>";

echo "<td>Num lot : </td>";
echo "<td>";

$myart =new lot ;
$select = "select * FROM lot ORDER BY num_ligne_detail='$num_entre' ";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
   $num_lot_dispo=$myart->num_lot_decoupe ;
 }
if  ($num_lot_decoupe==$num_lot_dispo)   
  echo "$num_lot_dispo";



echo "</td>";

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

echo "<td>Cat&#233;gorie d&#233;coupe</td>";
// echo "categorie decoupe : $categorie_decoupe" ; //
echo "<td>";

$myart =new categorie_decoupe;
$select = 'select * FROM categorie_decoupe';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_cate_decoupe=$myart->num_cate_decoupe ;
  $cate_decoupe=$myart->cate_decoupe ;
  $lettre_trace=$myart->lettre_trace ;
  
if  ($categorie_decoupe==$num_cate_decoupe)   

  echo "$num_cate_decoupe | $cate_decoupe";
}
echo "</select></td>";

//echo "NumEntre : $num_entre | semaine decoupe : $semaine_decoupe" ;

echo "<td>Num Tra&#231;abilit&#233;</td>";
echo "<td>$tracabilite_decoupe</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Cl&#244;turer ? : </td>";
if ($cloture==1) {
echo "<td colspan='1'>oui <input name='cloture' type='radio' id='cloture' accesskey='9' tabindex='9' value='1' checked>
non <input name='cloture' type='radio' id='cloture' accesskey='9' tabindex='9' value='0'></td>";
} else {
echo "<td colspan='1'>oui <input name='cloture' type='radio' id='cloture' accesskey='9' tabindex='9' value='1'>
non <input name='cloture' type='radio' id='cloture' accesskey='9' tabindex='9' value='0' checked></td>";
}
// echo "</tr>";
// echo "<tr>";

echo "<td>Poids : </td>";
echo "<td colspan='1'>$poid_decoupe Kg</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Observations</td>";
echo "<td colspan='4'>$observations</td>";
echo "</tr>";
echo "<td colspan='4'><div align='center'>";
// <form id='form1' name='form1' method='post' action='modif_abattoir_check.php?Num_entre=$Num_entre'>
echo "<input type='submit' value='* OK *'>
      </div></td>";
echo "<tr>";
echo "</table></form>";



include 'menu/footer.php';
?>
