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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Gestion - Heures</title>
<link rel="stylesheet" type="text/css" href="design.css" /> <!-- Liens vers le feuillet de style CSS -->
</head>
<body>
<form name="tbl_heures" action="form_ajt_heures.php" method="post">
<?php
$annee_select = $_POST['annee'];
$mois_select = $_POST['mois'];
if ($annee_select = 2006 )
{
$annee=2006;
}
elseif ($annee_select = 2007)
{
$annee=2007;
}
if ($_POST['mois'] = 1)
{
$debut_mois = $annee. 0301 ; $fin_mois = $annee. 0331;
}
?>
<div id="tbl_heures">
<table id="tables">
<tr>
<td><span class=tete>Nom</span></td>
<td><?php
include("connection.php");
//on recupère le nom des employés
$sql = "SELECT empl_id, empl_nom FROM employe_tbl" ;
$result = mysql_query ( $sql ) ;
$empl_nom = array() ;
while ( $row = mysql_fetch_assoc ( $result ) )
{
$empl_nom[] = $row ['empl_nom'] ;
}
echo listbox ( 'employe_nom' , $empl_nom, $empl_select =( isset ( $_POST['employe_nom'] ) ? $_POST['employe_nom'] : 0 ),
0 , 1 , 7, listbox , col120px, "this.form.submit()") ;?></td>
<td><span class=tete>Mois</span></td>
<td>
<?php echo listbox ( 'mois' , array(1 => "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre") ,
$mois_select =( isset ( $_POST['mois'] ) ? $_POST['mois'] : 0 )
, 0 , 1 , 8, listbox, col120px, "this.form.submit()") ;?></td>
<td><span class=tete>Année</span></td>
<td>
<?php echo listbox ( 'annee' , array(1 => "2006", "2007", "2008", "2009", "2010"),
$annee_select =( isset ( $_POST['annee'] ) ? $_POST['annee'] : 0 ),
0 , 1 , 9, listbox, col120px, "this.form.submit()") ;?></td>
<?php
//selectionne le mois à affiché dans le tableau
//ne tiens pas compte des mois à 30 ou 29 ou 28 jour car dans la table heures_tbl il ne
// devrait pas avoir d'erreur vu que le formulaire "form_ajt_heures" à un control.
?>
</td>
</tr>
</table>
</div>
<div id="tbl_heures1">
<table id="tables">
<tr><td id=col120px class=gras>Nom</td>
<td id=col120px class=gras>Prénom</td>
<td id=col120px class=gras>Date</td>
<td id=col120px class=gras>Nombre d'heures</td></tr>
<?php
$id_connexion=mysql_connect("localhost","jscheuner","jo1199");
mysql_select_db("gestion",$id_connexion);
$requete = " SELECT empl_nom, empl_prenom, heu_date, heu_heures, (SELECT
SEC_TO_TIME( SUM(TIME_TO_SEC(heu_heures)) ) FROM heures_tbl
INNER JOIN employe_tbl ON heures_tbl.heu_empl_id = employe_tbl.empl_id
WHERE empl_id = ($empl_select + 1)) As total_heures
FROM heures_tbl
INNER JOIN employe_tbl ON heures_tbl.heu_empl_id = employe_tbl.empl_id
WHERE empl_id = ($empl_select + 1) AND heu_date >$debut_mois AND heu_date <= $fin_mois ";
$resultat=mysql_query($requete,$id_connexion);
while ($tableau=mysql_fetch_array($resultat,MYSQL_ASSOC))
{
echo '<tr><td id=col120px>',$tableau['empl_nom'],'</td><td id=col120px>',$tableau['empl_prenom'],'</td>
<td id=col120px>',$tableau['heu_date'],'</td><td id=col120px>',$tableau['heu_heures'],'</td></tr>';
$total_heures = $tableau['total_heures'];
}?>
</table>
<table id="tables">
<tr><br/>
<td id=col120px></td>
<td id=col120px> </td>
<td id=col120px class=gras>Total</td>
<td id=col120px class=gras><?php echo $total_heures?> heures</td>
</tr>
</table>
</div>
</body>
</html> |
Partager