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

$Num_entre=$_GET['Num_entre'];

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

$myart =new table_dechets;
$select = "SELECT * FROM table_dechets WHERE num_ligne_dechets='$Num_entre'";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_ligne_dechets =$myart->num_ligne_dechets ;
  $Num_bon_dechets =$myart->Num_bon_dechets ;
  $Num_prestataire =$myart->Num_prestataire ;
  $num_cat_dechets =$myart->num_cate_dechets ;
  $mrs =$myart->mrs ;
  $poids_dechets =$myart->poids_dechets ;
  $sem_dechets =$myart->sem_dechets ;
  $date_enleve_dechets =$myart->date_enleve_dechets ;
  $observations =$myart->observations ;
}
//echo $num_ligne_dechets." | ".$Num_bon_dechets." | ".$Num_prestataire." | ".$poids_dechets." | ".$num_cat_dechets."<br>" ;
// menu haut new-supp-modif

echo "<center>";

echo "<center><HR size='1' width='500'>";
echo "<b>Consultations bon d'&#233;quarissage</b>";
echo "<center><HR size='1' width='500'>";
//
//$date_e=date("d/m/Y", strtotime($date_enleve_dechets));
//echo  date("d/m/Y", strtotime($date_enleve_dechets))." ".$date_enleve_dechets;
//
echo "<br>";
echo "<table class='t-text' width='500' border='1' cellspacing='0' cellpadding='4'>";
echo "<tr>";
echo "<td width='100'>Prestataire : </td>";
echo "<td width='100'>";

$myart =new fournisseurs;
$select = "select * FROM fournisseurs WHERE `Num_fournisseur`= $Num_prestataire";
$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 "$Ident_four";
}


echo "</td>";
echo "<td width='100'>Date enl&#232;vement</td>";
echo "<td>";
  
  $class = '';
  $fyear='2010';
  $lyear='2050';
  $name ='DateEntre';

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

  
echo $dy."/".$mo."/"."$yr";
echo "</td></tr>";
echo "<tr>";
echo "<td>cat&#233;gorie :</td>";
echo "<td>";

$myart =new categorie_dechets ;
$select = "select * FROM categorie_dechets WHERE `num_cate_dechets`= $num_cat_dechets";
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_cate_dechets=$myart->num_cate_dechets ;
  $categorie_dechets=$myart->categorie_dechets ;
}
echo $categorie_dechets."</td>";

echo "<td>Num Bon : </td>";
echo "<td>".$Num_bon_dechets."</td>";
echo "</tr>";

echo "<tr>";
echo "<td>Poids :</td>";
echo "<td>$poids_dechets Kg</td>";
echo "<td>M.R.S ? : </td>";
if ($mrs==1) {
echo "<td colspan='1'>oui <input name='mrs' type='radio' id='mrs' accesskey='2' tabindex='2' value='1' checked>
non <input name='mrs' type='radio' id='mrs' accesskey='2' tabindex='2' value='0'></td>";
} else {
echo "<td colspan='1'>oui <input name='mrs' type='radio' id='mrs' accesskey='2' tabindex='2' value='1'>
non <input name='mrs' type='radio' id='mrs' accesskey='2' tabindex='2' value='0' checked></td>";
}
echo "</tr>";
echo "<tr>";
echo "<td>Observations :</td>";
echo "<td colspan='4'>$observations</td>";
echo "</tr>";
echo "</table>";

if ($mrs==1) {
echo "<center><HR size='1' width='500'>";
echo "<b>Detail Mrs</b>";
echo "<center><HR size='1' width='500'>";

echo "<table border='1' cellpadding='1' cellspacing='1' width='500' height='22'><tr>";
echo "<td width='30' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Date entre</div></td></span>";
echo "<td width='30' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Num Ident</div></td></span>";
echo "<td width='50' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Num Bon</td></span>";
echo "<td width='50' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Date Bon</td></span>";
echo "<td width='50' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Poids Mrs</td></span>";
echo "<td width='50' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Prestataire</td></span>";
echo "<td width='30' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>elvmt ? </td></span>";
echo "<td width='20' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Md</td></span>";
echo "</tr>";

$myart =new table_mrs;
$select = "select * FROM table_mrs WHERE Num_Bon_Mrs = '$Num_bon_dechets' ORDER BY Date_Entre DESC";
$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 ;
  $Date_Entre=$myart->Date_Entre ;
  $Date_Bon=$myart->Date_Bon_Mrs ;
  $Poids_Mrs=$myart->Poids_Mrs ;
  $Num_Bon_Mrs=$myart->Num_Bon_Mrs ;
  $Prestataire=$myart->Prestataire ;
  $enleve=$myart->Enlevement_mrs ;


$date_e=date("d/m/Y", strtotime($Date_Entre));
$date_b=date("d/m/Y", strtotime($Date_Bon));
//echo  date("d/m/Y", strtotime($Date_Entre))." ".$date_e."<br>";
//echo  date("d/m/Y", strtotime($Date_Bon))." ".$date_b."<br>";
//echo $Num_ligne_mrs."|".$Num_ident_Animal."|".$Poids_Mrs."|".$Num_Bon_Mrs."|".$Prestataire."|".$enleve."<br>" ;
  
    echo "<tr><td width='30' height='20' valign='center'>
	<div align='center'><span class='t-text'>$date_e</div></td></span>";
    echo "<td width='30' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Num_ident_Animal</div></td></span>";
    echo "<td width='50' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Num_Bon_Mrs</div></td></span>";
    echo "<td width='50' height='20' valign='center'>
	<div align='center'><span class='t-text'>$date_b</div></td></span>";
    echo "<td width='50' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Poids_Mrs</div></td></span>";
    echo "<td width='30' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Prestataire</div></td></span>";
   if ($enleve != 1 ) {
	echo "<td width='20' height='20' valign='center'>
	<div align='center'><img src='images/croix.gif' width='20' height='20'></div></td>";	
	} else {
	echo "<td width='20' height='20' valign='center'>
	<div align='center'><img src='images/coche.gif' width='20' height='20'></div></td>";
	}
  
   echo "<td width='20' height='20' valign='center'>
<div align='center'><img src='images/modifie.png' width='20' height='20'></a></div></td>";

$totalPoids = number_format($Poids_Mrs + $totalPoids, 2, ',', ' ');



} 
echo "<table border='1' cellpadding='1' cellspacing='1' width='500' height='22'><tr>";
echo "<td width='167' height='20' valign='center' >
	<div align='center'><span class='t-text'>Total MrS : </div></td></span>";
echo "<td width='70' height='20' valign='center' >
	<div align='center'><span class='t-text'>".$totalPoids." Kg </div></td></span>";
echo "<td width='70' height='20' valign='center' >
	<div align='center'><span class='t-text'></td></span>";
echo "</tr>";
echo "</tr></table>";

} else {

}

echo "<br><br>";
echo "<a href='#' onclick='javascript:history.go(-1);'>O.K. |</a>";
echo "<A HREF='javascript:Popup(\"edition_abattoir.php?Num_entre=$Num_entre\",700,400,\"location=0,menubar=0,scrollbars=0,statusbar=0\")'>Edition</A>";
echo "<br><br>";



include 'menu/footer.php';
?>
