Je dois modifier une application PHP et BD SQL Server 2008 a travers laquelle on liste le retour des matériels des techniciens (Numéro de série - Article - Date de récupération - Jours de possession) et je voudrai rajouter une colonne Frais de retards (pour les tech qui ne ramènent pas les matériels afin de les inciter a vite ramener...).
Ci-dessus un aperçu de l’interface PHP a modifier:
Code : Tout sélectionner
Numéro de série Article Date de récupération Jours de possession
073G457XVW97 22973 2015-01-14 142
200858414 22973 2014-09-03 9
S8D260979 34058 2015-01-18 5 Pour la colonne frais de retards a rajouter, l’idée est daller avec une date de reference de sorte que pour la 1ere ligne ca sera INV (en inventaire), pour la 2eme 10$ et pour la 3eme 0$. Donc la pénalité est de 10$/semaine, facturée chaque 8eme jour... Aussi j’aimerai afficher le total des frais...
Ci-joint mon script PHP:
<?php
$userToCheck = $_SESSION['user']['selected'];
$appareils = appareil::getAppareils(CODE_STATUT_RECUPERATION, $userToCheck);
?>
<h1><?php echo TXT_RECUPERATION; ?></h1>
<legend><?php echo TXT_A_RETOURNER; ?></legend>
<?php if(count($appareils) >= 1){ ?>
<table class="table table-striped table-hover" style="width:100%">
<thead>
<tr>
<th><?php echo TXT_NUMERO_SERIE; ?></th>
<th><?php echo TXT_ARTICLE; ?></th>
<th style="text-align:center">Date de récupération</th>
<th style="text-align:center"><?php echo TXT_NB_JOURS_POSSESSION; ?></th>
<th style="text-align:center"><?php echo TXT_TOTAL_PERCU; ?></th>
</tr>
</thead>
<tbody>
<?php foreach($appareils as $appareil){
$d = new discussion();
$d->loadDiscussion($userToCheck, $appareil->numeroSerie);
$button = '+';
if(sizeof($d->commentaires) > 0){
$button = sizeof($d->commentaires);
if($d->nbCommentairesNonLus > 0){
$button.= ' ('.$d->nbCommentairesNonLus.')';
}
}
if($appareil->nbJours > 14){
echo '<tr class="error">';
}else{
echo '<tr>';
}
echo '<td>'.$appareil->numeroSerie.'</td>';
echo '<td>'.$appareil->article.'</td>';
echo '<td style="text-align:center">'; echo date('Y-m-d', strtotime($appareil->dlocalisation));
if($appareil->nbJours > 14){
echo '<i style="position: absolute;margin: 3px 0px 0px 5px;"class="icon-warning-sign"></i>';
}
echo '</td>';
echo '<td style="text-align:center">'.$appareil->nbJours.'</td>';
echo '<td style="text-align:center"><a href="./?page=4&numeroSerie='.$appareil->numeroSerie.'" class="btn btn-primary" style="width:50px">'.$button.'</a></td>';
echo '</tr>';
}?>
</tbody>
</table>
<?php }else{ echo '<p style="text-align:center;width:100%">Aucun appareil à retourner</p>'; } ?>
<?php $appareils = appareil::getAppareilsFromHisto(CODE_STATUT_AFFI, $userToCheck); ?>
<legend><?php echo TXT_RETOURNE; ?></legend>
<table class="table table-striped table-hover" style="width:100%">
<thead>
<tr>
<th><?php echo TXT_NUMERO_SERIE; ?></th>
<th style="text-align:center">Date de retour</th>
<!-- <th style="text-align:center"><?php echo TXT_NB_JOURS_RETOURNE; ?></th> -->
</tr>
</thead>
<tbody>
<?php
foreach($appareils as $appareil){
if($appareil->nbJours <= 30){
echo '<tr>';
echo "<td>$appareil->numeroSerie</td>";
echo "<td style=\"text-align:center\">". date('Y-m-d', strtotime($appareil->dlocalisation)) . "</td>";
//echo "<td style=\"text-align:center\">$appareil->nbJours</td>";
echo '</tr>';
}
}
?>
</tbody>
</table>
Je n’ai aucune idée par ou commencer (tableau, ...., innerHTML...)...Je débute en PHP et je sollicite votre concours, merci d’avance.