<div class="list-frais list-frais-<?php echo $note['id'] ?>"> <ul> <?php //boucle des frais de la note foreach ($allFrais as $frais) { $categorie = CategorieFrais::getCategorieById($bdd, $frais['categorie_id']); ?> <li class="frais-<?php echo $frais['id'] ?>"> <div class="infos-frais"> <img class="img-frais" src="<?php echo $basePath . 'image/uploads/' . $frais['image'] ?>"/> <span><?php echo $frais['description'] ?></span> </div> <div class="total"> <?php $fdevise = Devise::getDeviseById($bdd, $frais['devise_id']); echo $frais['montant'] . ' ' . $fdevise->getSigne() . '<br/>'; echo '(<span class="total-frais">' . Devise::getValueOfChangedDevise($frais['montant'],$fdevise->getTaux(),$devise->getTaux()) . '</span> ' . $devise->getSigne() . ')'; ?><br/> <span><?php echo date("d-m-Y", strtotime($frais['date'])); ?></span><br/> <span class="categorie-frais"><?php echo $categorie->getName(); ?></span> </div> <div class="actions-frais"> <button class="frais-<?php echo $frais['id'] ?> btn btn-danger" data-note="note-<?php echo $note['id']; ?>">supprimer</button> <a class="btn btn-default" href="<?php echo $basePath . '?page=frais&id=' . $frais['id']; ?>">editer</a> </div> </li> <?php } //fin boucle des frais ?> </ul>
public static function getCoutOfUser($bdd) { $allUser = User::getAllUser($bdd); $couts = []; foreach ($allUser as $user) { $userNotes = Note::getNotesByUser($bdd, $user['id']); $uDevise = Devise::getDeviseById($bdd, $user['devise_id']); $totalNote = 0; foreach ($userNotes as $note) { $totalNote += Note::getMontantTotal($bdd, $note['id'], $uDevise->getTaux()); } $couts[] = ["username" => $user['login'], "total" => $totalNote]; } usort($couts, function ($a, $b) { if ($a['total'] == $b['total']) { return 0; } return $a['total'] < $b['total'] ? 1 : -1; }); return array_slice($couts, 0, 10); }
?> <h2> Bienvenue dans votre espace personnel <?php echo $sessionUser->getName(); ?> </h2> <br/> <h3> <strong>Voici quelques informations concernant votre compte : </strong></h3><br/> <div> <form action="" method="POST" enctype="multipart/form-data"> <span class="bandblue">Votre nom</span> : <?php echo $sessionUser->getName(); ?><br/> <span class="bandblue">Votre Login</span> : <?php echo $sessionUser->getLogin(); ?><br/> <span class="bandblue">Votre Email</span> : <input class = "formulaireEmail formprofil" type="text" name="nouveauMail" value='<?php echo $sessionUser->getEmail(); ?>'/> <input class = "btnmodif" type="submit" name="changementEmailUser" value="Modifier"/> <br/> <?php $Devise = new Devise(); $Devise = Devise::getDeviseById($bdd,$sessionUser->getDevise()); ?> <span class="bandblue">Votre devise actuelle</span> : <select class = "formulaire formulaireDevise formprofil" name="devise_id"> <?php $reponseDevise = Devise::getAllDevise($bdd); while($donnee = $reponseDevise->fetch()) { ?> <option value="<?php echo $donnee['id'];?>" <?php if($sessionUser->getDevise() == $donnee['id']){echo $selected; } ?>><?php echo $donnee['name'];?></option> <?php } ?> </select> <input class = "btnmodif" type="submit" name="changementDeviseUser" value="Modifier"/> </form>
$userCouts = Note::getCoutOfUser($bdd); //incrementation pour lesfrais par mois de l'année $i = 1; //couleur des categories $color = 30; foreach ($allCategorie as $categorie) { $categorieCout = Frais::getCoutByCategorieId($bdd, $categorie["id"]); $fdevise = Devise::getDeviseById($bdd, $categorieCout['devise_id'])->getTaux(); $data["categorie"]["labels"][] = $categorie["name"]; $data["categorie"]["cout"][] = Devise::getValueOfChangedDevise($categorieCout["totalCat"], $fdevise, $userDevise); $data["categorie"]["all"][] = ["value" => Devise::getValueOfChangedDevise($categorieCout["totalCat"], $fdevise, $userDevise), "color" => "rgb(" . $color . ", " . $color * 2 . ", " . $color / 2 . ")", "highlight" => "rgb(" . ($color + 15) . ", " . ($color * 2 + 15) . ", " . ($color + 15) . ")", "label" => $categorie["name"]]; $color += 30; } while ($i <= 12) { $coutMois = Frais::getCoutParMois($bdd, $i); $fdevise = Devise::getDeviseById($bdd, $coutMois['devise_id'])->getTaux(); if ($coutMois == NULL) { $coutMois = 0; } $data["mois"]["cout"][] = Devise::getValueOfChangedDevise($coutMois["totalMois"], $fdevise, $userDevise); $i++; } foreach ($userCouts as $uCout) { $data["user"]["login"][] = $uCout["username"]; $data["user"]["cout"][] = $uCout["total"]; } break; default: break; } }
<div class="admin-stat"> <h1>Statistiques du site (en <?php echo Devise::getDeviseById($bdd, $sessionUser->getDevise())->getSigne(); ?>)</h1> <div class="chart"> <h3>Couts par categorie : </h3> <canvas id="categorieChart" width="500" height="500"></canvas> </div> <div class="chart"> <h3>Couts des Frais par mois :</h3> <canvas id="fraisChart" width="500" height="500"></canvas> </div> <div class="chart"> <h3>Couts des 10 premiers utilisateurs :</h3> <canvas id="userChart" width="500" height="500"></canvas> </div> </div>
$objPHPExcel->getActiveSheet()->setCellValue('B8', $nomUtilisateur); $objPHPExcel->getActiveSheet()->setCellValue('F8', $sessionUser->getLogin()); $objPHPExcel->getActiveSheet()->setCellValue('J8', $CloneDevise->getName()); $datePremierFrais; $dateDernierFrais; $totalAvance = 0; $totalCase = 0; $totalTTC = 0; $baseRow = 16; //On boucle pour afficher les informations de chaques frais de la note dans le tableau excel foreach ($allFraisFromThisNote as $r => $fraisFromNote) { $row = $baseRow + $r; $CategorieName = CategorieFrais::getCategorieById($bdd, $fraisFromNote['categorie_id']); $objPHPExcel->getActiveSheet()->insertNewRowBefore($row, 1); //Affiche dans la bonne devise $deviseFrais = Devise::getDeviseById($bdd, $fraisFromNote['devise_id']); $montantDeviseUser = Devise::getValueOfChangedDevise($fraisFromNote['montant'], $deviseFrais->getTaux(), $CloneDevise->getTaux()); //Verifie si on a une avance if ($fraisFromNote['categorie_id'] == 4) { $totalAvance += $montantDeviseUser; $tva = $montantDeviseUser; $totalTTC -= $montantDeviseUser; } else { $tva = $montantDeviseUser * 1.2; $totalTTC += $tva; } $objPHPExcel->getActiveSheet()->setCellValue('A' . $row, $fraisFromNote['id'])->setCellValue('B' . $row, $fraisFromNote['date'])->setCellValue('C' . $row, $fraisFromNote['description'])->setCellValue('E' . $row, $montantDeviseUser)->setCellValue('F' . $row, $tva)->setCellValue('H' . $row, $CategorieName->getName()); $dateFrais = $fraisFromNote['date']; //On récupère la première et la dernière date if ($row == 16) { $datePremierFrais = $fraisFromNote['date'];
<a href="<?php echo $basePath ?>?page=admin§ion=user&action=adduser" class="btn btn-primary">Ajouter un utilisateur</a> <br/><br/> <div class="admin-user"> <table> <tr> <th>Nom</th> <th>Login</th> <th>Mail</th> <th>Role</th> <th>Devise</th> <th>Actions</th> </tr> <?php foreach ($listUser as $user) { ?> <tr class="tr-user-<?php echo $user['id']; ?>"> <td><?php echo $user['name']; ?></td> <td><?php echo $user['login']; ?></td> <td><?php echo $user['mail']; ?></td> <td><?php echo Role::getRoleById($bdd, $user['role_id'])->getName(); ?></td> <td><?php echo Devise::getDeviseById($bdd, $user['devise_id'])->getName(); ?></td> <td><button class="user-<?php echo $user['id']; ?> btn btn-danger">supprimer</button> <a class="btn btn-default" href="<?php echo $basePath ."?page=user&id=" . $user['id']; ?>">editer</a></td> </tr> <?php } ?> </table> </div> <br/> <a href="<?php echo $basePath ?>?page=admin§ion=user&action=adduser" class="btn btn-primary">Ajouter un utilisateur</a>