<?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';

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

if (!isset($_GET['pages']))
{ $NombrePages=10;} else { $NombrePages=($_GET['pages']);}

$limite=$_GET['limite'];
if (!isset($limite)) $limite = 0;
$nombre = $NombrePages ;
$limitePage = 0 ;
$PageC = ($limite/$NombrePages) ;



// on va afficher 10 résultats par page.
$limitesuivante = $limite + $NombrePages;
$limiteprecedente = $limite - $NombrePages;

$req = mysqli_query($link, $selectc); 
$row = mysqli_fetch_row($req);
$total= $row[0];
$NbPage =floor($total/$NombrePages);

// menu haut new-supp-modif

echo "<center>";
Echo "<table cellspacing=0 cellpadding=0 align=center border=0>";
Echo "<tbody>";
echo "<a href='saisie_ajout_mrs.php?limite=0'><b>Nouveau</b></a> <b> | </b>";
echo "<a href=''><b>Consulter</b></a> <b> | </b>";
echo "<a href=''><b>Supprimer</b></a> <b> | </b>";
echo "<a href=''><b>Modifier</b></a>";
Echo "</td></tr>";
Echo "</tbody>";
Echo "</table>";
//
//echo "total : ".$total."| limite  ".$limite."<br> limite suivante ".$limitesuivante."| limite precedente".$limiteprecedente ."<br>";
//
echo "<br> Saisie des M.R.S.<br><br>" ;
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 `Enlevement_mrs`=0 ';
$select.= " AND IdNumClient='".$IdNumClient."'";
$select.=  'ORDER BY Date_Entre ASC limit '.$limite.','.$nombre;
$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'><a class='' href='modif_det_mrs_s.php?Num_ligne_mrs=$Num_ligne_mrs&Num_entre=00'><img src='images/modifie.png' width='20' height='20'></a></div></td>";

} 
echo "</tr></table>";
echo "<br><br>";
echo "<table border='1' cellpadding='0' cellspacing='0' width='500' height='22'><tr>";
echo "<td width='120' height='20' valign='center'><div align='center'><span class='t-text'>";
	 
if($limite != 0) {
    echo '<a href="'.$page.'?limite='.$limiteprecedente.'">Page precedente</a>';
}
echo "</div></td></span>";
echo "<td width='120' height='20' valign='center'><div align='center'><span class='t-text'>";
if($limitesuivante < $total) {
    echo '<a href="'.$page.'?limite='.$limitesuivante.'">Page Suivante</a>';
}
echo "</div></td></span>";
echo "</tr></table>";


include 'menu/footer.php';
?>
