|
|
@@ -37,30 +37,40 @@ termes. |
|
|
|
*/ |
|
|
|
|
|
|
|
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"> |
|
|
|
|
|
|
|
<?php if($empty): ?> |
|
|
|
<div class="alert alert-warning">Aucune statistique disponible pour cette période</div> |
|
|
|
<?php else: ?> |
|
|
|
|
|
|
|
<table id="table-stats-products" class="table table-bordered table-hover header-fixed"> |
|
|
|
<thead> |
|
|
|
<tr class="mois"> |
|
|
|
<th></th> |
|
|
|
<?php foreach($monthArray as $month): ?> |
|
|
|
<th colspan="2"><?= $month; ?></th> |
|
|
|
<?php endforeach; ?> |
|
|
|
<?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=1; $i<=13; $i++): ?> |
|
|
|
<?php for($i=$iStart; $i<=$iEnd + 1; $i++): ?> |
|
|
|
<th>Maximum</th> |
|
|
|
<th>Commandés</th> |
|
|
|
<?php endfor; ?> |
|
|
@@ -71,6 +81,7 @@ $this->addButton(['label' => ($year + 1).' >', 'url' => ['stats/products','ye |
|
|
|
<tr> |
|
|
|
<td class="name"><?= Html::encode($currentProduct['name']) ?></td> |
|
|
|
<?php foreach($dataProducts as $month => $productsMonthArray): |
|
|
|
|
|
|
|
$findMax = false ; |
|
|
|
$findOrders = false ; |
|
|
|
?> |
|
|
@@ -78,14 +89,14 @@ $this->addButton(['label' => ($year + 1).' >', 'url' => ['stats/products','ye |
|
|
|
|
|
|
|
<!-- max --> |
|
|
|
<?php |
|
|
|
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / '.$monthArray[$month - 1] .' '. $year.' / Maximum"' ; |
|
|
|
$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; ?>><?= $product['total'] ?></div> |
|
|
|
<div <?= $tooltip; ?>><?= (int) $product['total'] ?></div> |
|
|
|
</td> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
@@ -93,14 +104,14 @@ $this->addButton(['label' => ($year + 1).' >', 'url' => ['stats/products','ye |
|
|
|
|
|
|
|
<!-- commandes --> |
|
|
|
<?php |
|
|
|
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / '. $monthArray[$month - 1] . ' '. $year .' / Commandés"' ; |
|
|
|
$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 ?> ><?= $product['total'] ?></div> |
|
|
|
<div <?= $tooltip ?> ><?= (int) $product['total'] ?></div> |
|
|
|
</td> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
@@ -110,35 +121,42 @@ $this->addButton(['label' => ($year + 1).' >', 'url' => ['stats/products','ye |
|
|
|
<?php else: ?> |
|
|
|
<!-- totaux max --> |
|
|
|
<?php |
|
|
|
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Maximums"' ; |
|
|
|
$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']): ?> |
|
|
|
<?php |
|
|
|
if($productName == $currentProduct['name']): |
|
|
|
$findMax = true ; |
|
|
|
?> |
|
|
|
<td class="align-center"> |
|
|
|
<div <?= $tooltip ?> ><?= $totalMax ?></div> |
|
|
|
<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" data-original-title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Commandés"' ; |
|
|
|
$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']): ?> |
|
|
|
<?php if($productName == $currentProduct['name']): |
|
|
|
$findOrders = true ; |
|
|
|
?> |
|
|
|
<td class="align-center"> |
|
|
|
<div <?= $tooltip ?> ><?= $totalOrders ?></div> |
|
|
|
<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> |
|
|
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
</div> |