|
|
@@ -109,22 +109,21 @@ class SiteController extends BackendController { |
|
|
|
public function actionIndex() { |
|
|
|
// commandes |
|
|
|
$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 |
|
|
|
$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) |
|
|
|
$c->init(); |