<?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, $TotalPoids ;
// entete de la page

echo "<HTML>";
echo "<HEAD>";
echo "<meta http-equiv='content-type' content='text/html;charset=utf-8'>";
echo "<TITLE>Trace 2000</TITLE>";
echo "<META content=index,follow name=robots>";
echo "<link href='script/Script_ed.css' rel='stylesheet' type='text/css'>";
echo "<script type='text/javascript' src='script/pop.js'></script>";
echo "</HEAD>";
echo "<BODY>";
echo "<P>&nbsp;</P><div align='center'>";
echo "<!-- D衵t Format de la page Page -->";
echo "<table cellpadding='0' cellspacing='0' width='800'>";
echo "<TR><Td width='800'>";
//Menu ();

//Menu_SaisieH ();

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

$Num_Bon = $_GET['Num_Bon'];
//echo "<br>Num Entre : ".$Num_entre."<br>" ;


echo "<center> Detail Bon Mrs N&deg; ".$Num_Bon."</center><br>"; 
echo "<table width='800' border='1' align='center' cellpadding='1' cellspacing='1' bordercolor='#000000'>";
echo "<tr class='haut'>";
echo "<th width='85' height='30'>Date Entr&eacute;</th>";
echo "<th width='130' height='30'>Client</th>";
echo "<th width='120' height='30'>Num_Ident</th>";
echo "<th width='85' height='30'>D.Decoup</th>";
echo "<th width='60' height='30'>Poids</th>";
echo "<th width='85' height='30'>D.Enlev</th>";
echo "<th width='60' height='30'>N&deg; Bon</th>";
echo "<th width='160' height='30'>Prestataire</th>";
echo "</tr>";


$select ="select * FROM table_mrs 
INNER JOIN table_mrs_haut 
ON table_mrs.Num_bon = table_mrs_haut.Num_bon 
WHERE table_mrs.Num_Bon='$Num_Bon'";
$myart =new table_mrs;
//$select ="SELECT * FROM table_mrs WHERE Num_bon='$Num_Bon'";
$result = mysql_query($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_Client ;
  $Date_Entre=$myart->Date_Entre ;
  $Date_Decoupe=$myart->Date_Decoupe ;
  $Poids=$myart->Poids ;
  $Date_enlev=$myart->Date_enlev ;
  $enleve=$myart->enleve ;
  $Num_Bon=$myart->Num_bon ;
  $Prestataire=$myart->Prestataire ;
  
$date_e=date("d/m/Y", strtotime($Date_Entre));
$date_d=date("d/m/Y", strtotime($Date_Decoupe));
$date_el=date("d/m/Y", strtotime($Date_Decoupe)); 

$myclient =new clients;
$selectc = "select * FROM clients where Num_Client='$Num_Client'";
$resultat = mysql_query($selectc);
$myclient->getnum($resultat);
while ($myclient->z < $myclient->num) {
  $myclient->readrow($resultat);
  $Num_Clientf=$myclient->Num_Client ;
  $Let_Client=$myclient->Let_Client ;
  $Nom_Client=$myclient->Nom_Client ;

$Cclient = $Let_Client." | ".$Nom_Client;
}

echo "<tr class='text'>";
echo "<td width='85' height='24' class='text' >$date_e</td>";
echo "<td width='130' height='24' class='text' >$Cclient</td>";
echo "<td width='120' height='24' class='text' >$Num_ident_Animal</td>";
echo "<td width='85' height='24' class='text' >$date_d</td>";
echo "<td width='60' height='24' class='text' >$Poids Kg</td>";
echo "<td width='85' height='24' class='text' >$date_el</td>";
echo "<td width='60' height='24' class='text' >$Num_Bon</td>";
echo "<td width='160' height='24' class='text'>$Prestataire</td>";

$TotalPoids = $TotalPoids + $Poids ;
}
echo "</tr>";
echo "<tr class='text'>";
echo "<td width='85' height='30' class='text' ></td>";
echo "<td width='130' height='30' class='text' ></td>";
echo "<td width='120' height='30' class='text' ></td>";
echo "<td width='85' height='30' class='text' ></td>";
echo "<td width='60' height='30' class='text' ></td>";
echo "<td width='85' height='30' class='text' ></td>";
echo "<td width='60' height='30' class='text' ></td>";
echo "<td width='160' height='30' class='text'></td>";
echo "</tr>";
echo "</tr>";
echo "<tr class='text'>";
echo "<td width='85' height='24' class='text' >&nbsp;</td>";
echo "<td width='130' height='24' class='text' >&nbsp;</td>";
echo "<td width='120' height='24' class='text' >&nbsp;</td>";
echo "<td width='85' height='24' class='text' >Total :</td>";
echo "<td width='60' height='24' class='text' >$TotalPoids Kg</td>";
echo "<td width='85' height='24' class='text' >&nbsp;</td>";
echo "<td width='60' height='24' class='text' >&nbsp;</td>";
echo "<td width='160' height='24' class='text'>&nbsp;</td>";
echo "</tr>";

//Menu_SaisieB();

echo "</td></table>";
echo "<br><br>";
echo "<center><a href='#' onclick='window.close()'>Fermer</a>";
echo " | ";
echo "<a href='#' onclick='window.print()'>Imprimer</a>";
echo "<br><br>";
echo "<table cellpadding='0' cellspacing='0' width='650'>";
echo "<td width='650' height='15' valign='center'>";
echo "<center><font face='Verdana' size='1' color='black'>";
echo "<B>Les Fermes du Pays Bourrian 2012(c)</B></font>";
//echo "<br>";
echo "</td></table>";
//echo"<br><br>";
echo "<table cellpadding='0' cellspacing='0' width='650' height='15'>";
echo "<td width='650' height='15' valign='top'><img src='images/bar.gif' width='650' height='15'>";
echo "</td></table>";
echo "<!-- Fin du Pied Page -->";
echo "<!-- Fin Page -->";
echo "</Td></TR></table></center>";
echo "</div>";
echo "<P>&nbsp</P>";
echo "</BODY>";
echo "</HTML>";
?>