Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
f1a85ee4cc
@ -334,52 +334,74 @@ class AdminStatsLogistic extends AdminTab {
|
||||
);
|
||||
}
|
||||
$poles[0]['name'] = 'Pôle 1 : Petites marques';
|
||||
$poles[1]['name'] = 'Pôle 2 : Marques moyenne';
|
||||
$poles[1]['name'] = 'Pôle 2 : Marques moyennes';
|
||||
$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';
|
||||
$poles[3]['name'] = 'Pôle 4 : Multi';
|
||||
$poles[4]['name'] = 'Pôle 5 : Mondial Relay';
|
||||
$poles[5]['name'] = 'Pôle 6 : Braderie';
|
||||
$poles[6]['name'] = 'Pôle 7 : Postes complémentaires';
|
||||
$total_quantity = 0;
|
||||
|
||||
/**
|
||||
* 52 Stock 0
|
||||
* 22 Stock 1
|
||||
* 24 Stock 2
|
||||
* 25 Stock 3
|
||||
* 44 Stock 4
|
||||
* 47 Stock 5
|
||||
* 48 Stock 6
|
||||
* 35 Multi 1
|
||||
* 36 Multi 2
|
||||
* 28 Karen
|
||||
* 56 Camille
|
||||
* 58 Camille
|
||||
*/
|
||||
foreach ($stats as $key => $stat) {
|
||||
if (!isset($stat['id_employee'])) {
|
||||
continue;
|
||||
}
|
||||
switch ((int)$stat['id_employee']) {
|
||||
case '52':
|
||||
//case '52':
|
||||
case '22':
|
||||
$poles[0]['recap']['quantity'] += $stat['quantity'];
|
||||
$poles[0]['recap']['nb_package'] += $stat['nb_package'];
|
||||
$poles[0]['employee'][] = $stat;
|
||||
break;
|
||||
case '22':
|
||||
case '24':
|
||||
case '25':
|
||||
$poles[1]['recap']['quantity'] += $stat['quantity'];
|
||||
$poles[1]['recap']['nb_package'] += $stat['nb_package'];
|
||||
$poles[1]['employee'][] = $stat;
|
||||
break;
|
||||
case '25':
|
||||
case '44':
|
||||
case '47':
|
||||
$poles[2]['recap']['quantity'] += $stat['quantity'];
|
||||
$poles[2]['recap']['nb_package'] += $stat['nb_package'];
|
||||
$poles[2]['employee'][] = $stat;
|
||||
break;
|
||||
case '47':
|
||||
case '48':
|
||||
case '35':
|
||||
case '36':
|
||||
$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':
|
||||
default:
|
||||
// case '48':
|
||||
// $poles[4]['recap']['quantity'] += $stat['quantity'];
|
||||
// $poles[4]['recap']['nb_package'] += $stat['nb_package'];
|
||||
// $poles[4]['employee'][] = $stat;
|
||||
// break;
|
||||
case '56':
|
||||
case '58':
|
||||
$poles[5]['recap']['quantity'] += $stat['quantity'];
|
||||
$poles[5]['recap']['nb_package'] += $stat['nb_package'];
|
||||
$poles[5]['employee'][] = $stat;
|
||||
break;
|
||||
case '28':
|
||||
default:
|
||||
$poles[6]['recap']['quantity'] += $stat['quantity'];
|
||||
$poles[6]['recap']['nb_package'] += $stat['nb_package'];
|
||||
$poles[6]['employee'][] = $stat;
|
||||
break;
|
||||
}
|
||||
$total_quantity += $stat['quantity'];
|
||||
}
|
||||
@ -433,27 +455,75 @@ class AdminStatsLogistic extends AdminTab {
|
||||
$reports = array(
|
||||
'25' => array(
|
||||
'name' => 'Nb commandes > 25j',
|
||||
'payment' => $this->getReport(25,2),
|
||||
'partial' => $this->getReport(25,17),
|
||||
'pending' => $this->getReport(25,19)
|
||||
'payment' => array(
|
||||
'total' => $this->getReport(25,2),
|
||||
'laposte' => $this->getReport(25,2,'laposte'),
|
||||
'mondialrelay' => $this->getReport(25,2,'mondialrelay'),
|
||||
),
|
||||
'partial' => array(
|
||||
'total' => $this->getReport(25,17),
|
||||
'laposte' => $this->getReport(25,17,'laposte'),
|
||||
'mondialrelay' => $this->getReport(25,17,'mondialrelay'),
|
||||
),
|
||||
'pending' => array(
|
||||
'total' => $this->getReport(25,19),
|
||||
'laposte' => $this->getReport(25,19,'laposte'),
|
||||
'mondialrelay' => $this->getReport(25,19,'mondialrelay'),
|
||||
),
|
||||
),
|
||||
'21' => array(
|
||||
'name' => 'Nb commandes > 21j',
|
||||
'payment' => $this->getReport(21,2),
|
||||
'partial' => $this->getReport(21,17),
|
||||
'pending' => $this->getReport(21,19)
|
||||
'payment' => array(
|
||||
'total' => $this->getReport(21,2),
|
||||
'laposte' => $this->getReport(21,2,'laposte'),
|
||||
'mondialrelay' => $this->getReport(21,2,'mondialrelay'),
|
||||
),
|
||||
'partial' => array(
|
||||
'total' => $this->getReport(21,17),
|
||||
'laposte' => $this->getReport(21,17,'laposte'),
|
||||
'mondialrelay' => $this->getReport(21,17,'mondialrelay'),
|
||||
),
|
||||
'pending' => array(
|
||||
'total' => $this->getReport(21,19),
|
||||
'laposte' => $this->getReport(21,19,'laposte'),
|
||||
'mondialrelay' => $this->getReport(21,19,'mondialrelay'),
|
||||
),
|
||||
),
|
||||
'18' => array(
|
||||
'name' => 'Nb commandes > 18j',
|
||||
'payment' => $this->getReport(18,2),
|
||||
'partial' => $this->getReport(18,17),
|
||||
'pending' => $this->getReport(18,19)
|
||||
'payment' => array(
|
||||
'total' => $this->getReport(18,2),
|
||||
'laposte' => $this->getReport(18,2,'laposte'),
|
||||
'mondialrelay' => $this->getReport(18,2,'mondialrelay'),
|
||||
),
|
||||
'partial' => array(
|
||||
'total' => $this->getReport(18,17),
|
||||
'laposte' => $this->getReport(18,17,'laposte'),
|
||||
'mondialrelay' => $this->getReport(18,17,'mondialrelay'),
|
||||
),
|
||||
'pending' => array(
|
||||
'total' => $this->getReport(18,19),
|
||||
'laposte' => $this->getReport(18,19,'laposte'),
|
||||
'mondialrelay' => $this->getReport(18,19,'mondialrelay'),
|
||||
),
|
||||
),
|
||||
'2' => array(
|
||||
'name' => 'Nb commandes > 2j',
|
||||
'payment' => $this->getReport(2,2),
|
||||
'partial' => $this->getReport(2,17),
|
||||
'pending' => $this->getReport(2,19)
|
||||
'payment' => array(
|
||||
'total' => $this->getReport(2,2),
|
||||
'laposte' => $this->getReport(2,2,'laposte'),
|
||||
'mondialrelay' => $this->getReport(2,2,'mondialrelay'),
|
||||
),
|
||||
'partial' => array(
|
||||
'total' => $this->getReport(2,17),
|
||||
'laposte' => $this->getReport(2,17,'laposte'),
|
||||
'mondialrelay' => $this->getReport(2,17,'mondialrelay'),
|
||||
),
|
||||
'pending' => array(
|
||||
'total' => $this->getReport(2,19),
|
||||
'laposte' => $this->getReport(2,19,'laposte'),
|
||||
'mondialrelay' => $this->getReport(2,19,'mondialrelay'),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
@ -487,9 +557,9 @@ class AdminStatsLogistic extends AdminTab {
|
||||
echo '<tr">
|
||||
<td>'.$report['name'].'</td>
|
||||
<td>'.date('Y-m-d', strtotime($this->date_stock. ' - '.$k.' days')).'</td>
|
||||
<td>'.$report['payment'].'</td>
|
||||
<td>'.$report['partial'].'</td>
|
||||
<td>'.$report['pending'].'</td>
|
||||
<td>'.$report['payment']['laposte'].' LP / '.$report['payment']['mondialrelay'].' MR / '.$report['payment']['total'].' ('.round(($report['payment']['mondialrealy']/$report['payment']['total']*100),2).'% MR)</td>
|
||||
<td>'.$report['partial']['laposte'].' LP / '.$report['partial']['mondialrelay'].' MR / '.$report['partial']['total'].' ('.round(($report['partial']['mondialrealy']/$report['partial']['total']*100),2).'% MR)</td>
|
||||
<td>'.$report['pending']['laposte'].' LP / '.$report['pending']['mondialrelay'].' MR / '.$report['pending']['total'].' ('.round(($report['pending']['mondialrealy']/$report['pending']['total']*100),2).'% MR)</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '<tbody>
|
||||
@ -562,7 +632,12 @@ class AdminStatsLogistic extends AdminTab {
|
||||
');
|
||||
}
|
||||
|
||||
public function getReport($day = 25, $state = 2) {
|
||||
public function getReport($day = 25, $state = 2, $carrier=false) {
|
||||
if($carrier == "laposte"){
|
||||
$carriers = Configuration::get('ANT_CARRIERS_SOCOL');
|
||||
} elseif($carrier == "mondialrelay"){
|
||||
$carriers = Configuration::get('ANT_CARRIERS_MR');
|
||||
}
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(o.`id_order`)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
@ -570,14 +645,7 @@ class AdminStatsLogistic extends AdminTab {
|
||||
WHERE o.`date_add` < DATE_SUB("'.pSQL($this->date_stock).'",INTERVAL '.((int)$day-1).' DAY)
|
||||
AND oh.`id_order_state` = '.(int)$state.'
|
||||
AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = o.`id_order` GROUP BY moh.`id_order`)
|
||||
-- AND
|
||||
-- (
|
||||
-- SELECT `id_order_state`
|
||||
-- FROM '._DB_PREFIX_.'order_history oh
|
||||
-- WHERE o.id_order = oh.id_order
|
||||
-- ORDER BY id_order_history DESC
|
||||
-- LIMIT 1
|
||||
-- ) = '.(int)$state.'
|
||||
'.($carrier?'AND o.id_carrier IN ('.$carriers.')':'').'
|
||||
');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user