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
| <?php
$obj=$bdd->prepare('SELECT objectif.NomDept, Montant, ROUND(SUM(CA),2) as SOM
FROM objectif, test
WHERE objectif.NomDept=test.NomDept
AND Semestre =:semestre
AND datefact BETWEEN :date_deb AND :date_fin
ORDER BY objectif.NomDept
');
$obj->execute(array(
'semestre' => $semestre,
'date_deb' => $date_deb,
'date_fin' => $date_fin
));
?>
<div class="bill">
<br/>
<strong>
Liste des objectifs <?php echo htmlspecialchars($semstr);?>
</strong>
<table>
<tbody>
<tr>
<td>
Nom du département
</td>
<td>
Montant de l'objectif
</td>
<td>
Progression
</td>
</tr>
<?php
// Problème de calcul sur le 2nd tour de boucle pour le %
while($donnees=$obj->fetch())
{
?>
<tr>
<td>
<?php
echo htmlspecialchars($donnees['NomDept']);
?>
</td>
<td>
<?php
echo htmlspecialchars($donnees['Montant']);
?>
</td>
<td>
<?php
//$don=$prog->fetch();
$somme=$donnees['SOM'];
$montant=$donnees['Montant'];
$progress=round(100*$somme/$montant,2);
echo htmlspecialchars($progress." %");
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</body>
</html> |
Partager