|
|
|
|
|
|
|
|
public function actionIndex() { |
|
|
public function actionIndex() { |
|
|
// commandes |
|
|
// commandes |
|
|
$productions = Production::find() |
|
|
$productions = Production::find() |
|
|
->with('commande') |
|
|
|
|
|
->where(['>=', 'production.date', date('Y-m-d')]) |
|
|
|
|
|
->andWhere([ |
|
|
|
|
|
'production.id_etablissement' => Yii::$app->user->identity->id_etablissement, |
|
|
|
|
|
'production.actif' => 1 |
|
|
|
|
|
]) |
|
|
|
|
|
->orderBy('date ASC') |
|
|
|
|
|
->limit(5) |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
->with('commande') |
|
|
|
|
|
->where(['>=', 'production.date', date('Y-m-d')]) |
|
|
|
|
|
->andWhere([ |
|
|
|
|
|
'production.id_etablissement' => Yii::$app->user->identity->id_etablissement, |
|
|
|
|
|
'production.actif' => 1 |
|
|
|
|
|
]) |
|
|
|
|
|
->orderBy('date ASC') |
|
|
|
|
|
->limit(5) |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
// dernières commandes |
|
|
// dernières commandes |
|
|
$commandes = Commande::findBy([ |
|
|
$commandes = Commande::findBy([ |
|
|
'orderby' => 'date DESC', |
|
|
|
|
|
'limit' => 15, |
|
|
|
|
|
'condition' => 'production.date > \'' . date('Y-m-d 00:00:00') . '\' AND (type = \'' . Commande::TYPE_USER . '\' OR type = \'' . Commande::TYPE_ADMIN . '\')' |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
'orderby' => 'date DESC', |
|
|
|
|
|
'condition' => 'production.date > \'' . date('Y-m-d 00:00:00') . '\' AND (type = \'' . Commande::TYPE_USER . '\' OR type = \'' . Commande::TYPE_ADMIN . '\' OR (type = \'' . Commande::TYPE_AUTO . '\' AND (date_update IS NOT NULL OR date_delete IS NOT NULL)))' |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
foreach ($commandes as $c) |
|
|
foreach ($commandes as $c) |
|
|
$c->init(); |
|
|
$c->init(); |