Merge branch 'ticket-updateStats' into develop

This commit is contained in:
Marion Muszynski 2016-05-20 15:43:15 +02:00
commit 32492408f1

View File

@ -91,6 +91,63 @@ class AdminStatsLogistic extends AdminTab {
;
$stats = $this->getStats();
$poles = array();
for ($i=0; $i < 6; $i++) {
$poles[] = array(
'recap' => array(
'quantity' => 0,
'nb_package' => 0
),
'employee' => array(),
);
}
$poles[0]['name'] = 'Pôle 1 : Petites marques';
$poles[1]['name'] = 'Pôle 2 : Marques moyenne';
$poles[2]['name'] = 'Pôle 3 : Grosses marques';
$poles[3]['name'] = 'Pôle 4 : Postes complementaires';
$poles[4]['name'] = 'Pôle 5 : Multi';
$poles[5]['name'] = 'Pôle 6 : Autre';
foreach ($stats as $key => $stat) {
switch ($stat['id_employee']) {
case '52':
$poles[0]['recap']['quantity'] += $stat['quantity'];
$poles[0]['recap']['nb_package'] += $stat['nb_package'];
$poles[0]['employee'][] = $stat;
break;
case '22':
case '24':
$poles[1]['recap']['quantity'] += $stat['quantity'];
$poles[1]['recap']['nb_package'] += $stat['nb_package'];
$poles[1]['employee'][] = $stat;
break;
case '25':
case '44':
$poles[2]['recap']['quantity'] += $stat['quantity'];
$poles[2]['recap']['nb_package'] += $stat['nb_package'];
$poles[2]['employee'][] = $stat;
break;
case '47':
case '48':
$poles[3]['recap']['quantity'] += $stat['quantity'];
$poles[3]['recap']['nb_package'] += $stat['nb_package'];
$poles[3]['employee'][] = $stat;
break;
case '35':
case '36':
$poles[4]['recap']['quantity'] += $stat['quantity'];
$poles[4]['recap']['nb_package'] += $stat['nb_package'];
$poles[4]['employee'][] = $stat;
break;
case '28':
$poles[5]['recap']['quantity'] += $stat['quantity'];
$poles[5]['recap']['nb_package'] += $stat['nb_package'];
$poles[5]['employee'][] = $stat;
break;
default:
break;
}
$total_quantity += $stat['quantity'];
}
$total_colis = $this->getTotalColis();
$total_quantity = 0;
echo '
@ -108,17 +165,24 @@ class AdminStatsLogistic extends AdminTab {
</tr>
</thead>
<tbody>';
foreach ($stats as $key => $stat) {
$total_quantity += $stat['quantity'];
echo '<tr>
<td>'.$stat['id_employee'].'</td>
<td>'.$stat['firstname'].'</td>
<td>'.$stat['lastname'].'</td>
<td>'.$stat['email'].'</td>
<td>'.$stat['quantity'].'</td>
<td>'.$stat['nb_package'].'</td>
<td>'. number_format(($stat['nb_package']* 100 / $total_colis), 2) .' %</td>
</tr>';
foreach ($poles as $k => $pole) {
echo '<tr style="background:#00bbff;">
<td colspan="4" style="color:#fff;">'.$pole['name'].'</td>
<td style="color:#fff;">'.$pole['recap']['quantity'].'</td>
<td style="color:#fff;">'.$pole['recap']['nb_package'].'</td>
<td style="color:#fff;">'. number_format(($pole['recap']['nb_package']* 100 / $total_colis), 2) .' %</td>
</tr>';
foreach ($pole['employee'] as $key => $stat) {
echo '<tr>
<td>'.$stat['id_employee'].'</td>
<td>'.$stat['firstname'].'</td>
<td>'.$stat['lastname'].'</td>
<td>'.$stat['email'].'</td>
<td>'.$stat['quantity'].'</td>
<td>'.$stat['nb_package'].'</td>
<td>'. number_format(($stat['nb_package']* 100 / $total_colis), 2) .' %</td>
</tr>';
}
}
echo '<tbody>
<tfoot style="font-weight:bold">