You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
3.2KB

  1. <?php
  2. $this->title = 'Statistiques produits' ;
  3. $this->params['breadcrumbs'][] = 'Statistiques produits';
  4. ?>
  5. <div class="stats-produits">
  6. <h1>Statistiques produits <?= $year ?>
  7. <div id="nav-year">
  8. <a class="btn btn-default" href="<?= Yii::$app->urlManager->createUrl(['stats/produits','year' => $year - 1]); ?>">&lt; <?= ($year - 1) ?></a>
  9. <a class="btn btn-default" href="<?= Yii::$app->urlManager->createUrl(['stats/produits','year' => $year + 1]); ?>"><?= ($year + 1) ?> &gt;</a>
  10. </div>
  11. </h1>
  12. <?php if($empty): ?>
  13. <div class="alert alert-warning">Aucune statistique disponible pour cette période</div>
  14. <?php else: ?>
  15. <table id="table-stats-produits" class="table table-bordered table-hover header-fixed">
  16. <thead>
  17. <tr class="mois">
  18. <th></th>
  19. <?php foreach($arr_mois as $m): ?>
  20. <th colspan="2"><?= $m; ?></th>
  21. <?php endforeach; ?>
  22. </tr>
  23. <tr class="sub-head">
  24. <th></th>
  25. <?php for($i=1; $i<=12; $i++): ?>
  26. <th>Maximum</th>
  27. <th>Commandés</th>
  28. <?php endfor; ?>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <?php foreach($produits as $produit_current): ?>
  33. <tr>
  34. <td class="nom"><?= Html::encode($produit_current['nom']) ?></td>
  35. <?php foreach($arr_produits as $mois => $arr_produit_mois):
  36. $find_max = false ;
  37. $find_commandes = false ;
  38. ?>
  39. <!-- max -->
  40. <?php foreach($arr_produit_mois['max'] as $produit):
  41. $tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($produit_current['nom']).' / '.$arr_mois[$mois - 1] .' '. $year.' / Maximum"' ;
  42. ?>
  43. <?php if($produit['nom'] == $produit_current['nom']):
  44. $find_max = true ;
  45. ?>
  46. <td class="align-center">
  47. <div <?= $tooltip; ?>><?= $produit['total'] ?></div>
  48. </td>
  49. <?php endif; ?>
  50. <?php endforeach; ?>
  51. <?php if(!$find_max): ?><td class="align-center"><div <?= $tooltip; ?>>0</div></td><?php endif; ?>
  52. <!-- commandes -->
  53. <?php foreach($arr_produit_mois['commandes'] as $produit):
  54. $tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($produit_current['nom']).' / '. $arr_mois[$mois - 1] . ' '. $year .' / Commandés"' ;
  55. ?>
  56. <?php if($produit['nom'] == $produit_current['nom']):
  57. $find_commandes = true ;
  58. ?>
  59. <td class="align-center">
  60. <div <?= $tooltip ?> ><?= $produit['total'] ?></div>
  61. </td>
  62. <?php endif; ?>
  63. <?php endforeach; ?>
  64. <?php if(!$find_commandes): ?><td class="align-center"><div <?= $tooltip ?> >0</div></td><?php endif; ?>
  65. <?php endforeach; ?>
  66. </tr>
  67. <?php endforeach; ?>
  68. </tbody>
  69. </table>
  70. <?php endif; ?>
  71. </div>