|
- <?php
-
-
-
- use \backend\controllers\StatsController ;
- use yii\helpers\Html;
-
- $this->setTitle('Statistiques <small>Produits '.$year.'</small>', 'Statistiques produits '.$year) ;
- $this->addBreadcrumb('Statistiques produits '.$year) ;
- $this->addButton(['label' => '< '.($year - 1), 'url' => ['stats/products','year' => $year - 1], 'class' => 'btn btn-default']) ;
- $this->addButton(['label' => ($year + 1).' >', 'url' => ['stats/products','year' => $year + 1], 'class' => 'btn btn-default']) ;
-
- $theMonth = 1 ;
-
- ?>
- <div class="stats-products">
-
-
- <table id="table-stats-products" class="table table-bordered table-hover header-fixed">
- <thead>
- <tr class="mois">
- <th></th>
- <?php foreach($monthArray as $key => $month):
- if(($key + 1) >= $iStart && ($key + 1) <= $iEnd):
- ?>
- <th colspan="2">
- <?php if($section != 1 && $key + 1 == $iStart): echo Html::a('<', ['stats/products', 'year' => $year, 'section' => $section - 1], ['class' => 'btn btn-default']) ; ?><?php endif; ?>
- <?= $month; ?>
- <?php if($key + 1 == $iEnd && $section != 4): echo Html::a('>', ['stats/products', 'year' => $year, 'section' => $section + 1], ['class' => 'btn btn-default']) ; ?><?php endif; ?>
- </th>
- <?php
- endif;
- endforeach;
- ?>
- <th colspan="2">Totaux</th>
- </tr>
- <tr class="sub-head">
- <th></th>
- <?php for($i=$iStart; $i<=$iEnd + 1; $i++): ?>
- <th>Maximum</th>
- <th>Commandés</th>
- <?php endfor; ?>
- </tr>
- </thead>
- <tbody>
- <?php foreach($productsArray as $currentProduct): ?>
- <tr>
- <td class="name"><?= Html::encode($currentProduct['name']) ?></td>
- <?php foreach($dataProducts as $month => $productsMonthArray):
-
- $findMax = false ;
- $findOrders = false ;
- ?>
- <?php if($month != StatsController::TOTALS): ?>
-
- <!-- max -->
- <?php
- $tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / '.$monthArray[$month - 1] .' '. $year.' / Maximum"' ;
- foreach($productsMonthArray['max'] as $product):
- ?>
- <?php if($product['name'] == $currentProduct['name']):
- $findMax = true ;
- ?>
- <td class="align-center">
- <div <?= $tooltip; ?>><?= (int) $product['total'] ?></div>
- </td>
- <?php endif; ?>
- <?php endforeach; ?>
- <?php if(!$findMax): ?><td class="align-center"><div <?= $tooltip; ?>>0</div></td><?php endif; ?>
-
- <!-- commandes -->
- <?php
- $tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / '. $monthArray[$month - 1] . ' '. $year .' / Commandés"' ;
- foreach($productsMonthArray['orders'] as $product):
- ?>
- <?php if($product['name'] == $currentProduct['name']):
- $findOrders = true ;
- ?>
- <td class="align-center">
- <div <?= $tooltip ?> ><?= (int) $product['total'] ?></div>
- </td>
- <?php endif; ?>
- <?php endforeach; ?>
- <?php if(!$findOrders): ?><td class="align-center"><div <?= $tooltip ?> >0</div></td><?php endif; ?>
-
-
- <?php else: ?>
- <!-- totaux max -->
- <?php
- $tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Maximums"' ;
- foreach($dataProducts[StatsController::TOTALS]['max'] as $productName => $totalMax):
- ?>
- <?php
- if($productName == $currentProduct['name']):
- $findMax = true ;
- ?>
- <td class="align-center">
- <div <?= $tooltip ?> ><?= (int) $totalMax ?></div>
- </td>
- <?php endif; ?>
- <?php endforeach; ?>
- <?php if(!$findMax): ?><td class="align-center"><div <?= $tooltip; ?>>0</div></td><?php endif; ?>
-
- <!-- totaux commandés -->
- <?php
- $tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Commandés"' ;
- foreach($dataProducts[StatsController::TOTALS]['orders'] as $productName => $totalOrders):
- ?>
- <?php if($productName == $currentProduct['name']):
- $findOrders = true ;
- ?>
- <td class="align-center">
- <div <?= $tooltip ?> ><?= (int) $totalOrders ?></div>
- </td>
- <?php endif; ?>
- <?php endforeach; ?>
- <?php if(!$findOrders): ?><td class="align-center"><div <?= $tooltip ?> >0</div></td><?php endif; ?>
-
- <?php endif; ?>
- <?php endforeach; ?>
- </tr>
-
- <?php endforeach; ?>
-
- </tbody>
- </table>
-
- </div>
|