1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| <?php
function convertionDate($dateEur){
$rsl = explode ('/',$dateEur);
$rsl = array_reverse($rsl);
return implode($rsl,'-');
}
//gestion de la ligne selectionnée
if (isset($_POST['uf']))
{$uf=$_POST['uf'];
}
else
{$uf="";}
if (isset($_POST['service']))
{$v_service=$_POST['service'];
}
else
{$v_service="";}
?>
<table width="580" height="209" border="3">
<form name="rechercher" method="post" action="index.php?idpage=3">
<tr>
<td height="35" colspan="5" align="center" style="font-size:24px" >Statistiques de consommation </td>
</tr>
<tr>
<td height="32" colspan="5" align="left">
<select name="service" >
<option selected> Choisissez un service</option>
<?php
$requete = "SELECT distinct service FROM servcart order by service";
$req = mysql_query($requete) or die( mysql_error() ) ;
while ($donnees=mysql_fetch_array($req))
{
$service = $donnees['service'];
?>
<!-- affichage de la liste déroulante -->
<option value="<?php echo $service ?>" <?php if ($service == $v_service) { echo 'Selected' ; } ?> ><?php echo $service?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td height="30" colspan="5" align="center">
<label>Entre : </label>
<input type="text" id="datepicker" name="date_debut"/>
<label>Et : </label>
<input type="text" id="datepicker1" name="date_fin" />
</td>
</tr>
<tr>
<th height="28" colspan="5" scope="row" align="center">
<input type="submit" value="Rechercher" />
</th>
</tr>
<tr>
<th width="52" height="36" bgcolor="#5ab9d8" scope="col">UF</th>
<th width="159" bgcolor="#5ab9d8" scope="col">SERVICE</th>
<th width="191" bgcolor="#5ab9d8" scope="col">CARTOUCHE</th>
<th width="77" bgcolor="#5ab9d8" scope="col">DATE</th>
<th width="63" bgcolor="#5ab9d8" scope="col">SORTIE STOCK</th>
</tr>
<?php
if (isset($_POST['date_debut'])
and isset($_POST['date_fin']))
{
$date_debut=convertionDate($_POST['date_debut']);
$date_fin=convertionDate($_POST['date_fin']);
$requete2 = "SELECT uf,service,cartouche,sortie_stock,date_sortie FROM servcart WHERE date_sortie BETWEEN '$date_debut' and '$date_fin' and uf='$uf' order by date_sortie ";
$req2 = mysql_query($requete2) or die( mysql_error() ) ;
while ($donnees2=mysql_fetch_array($req2))
{
?>
<tr>
<td height="22"><?php echo $donnees2['uf']; ?></td>
<td><?php echo $donnees2['service']; ?></td>
<td><?php echo $donnees2['cartouche']; ?></td>
<td><?php echo $donnees2['date_sortie']; ?></td>
<td><?php echo $donnees2['sortie_stock']; ?></td>
</tr>
<?php
}
}
?>
</form>
</table> |