|
|
@@ -57,6 +57,7 @@ class CommandeController extends \yii\web\Controller { |
|
|
|
->with('commandeProduits', 'user') |
|
|
|
->joinWith('production') |
|
|
|
->where(['production.date' => $date]) |
|
|
|
->andWhere(['production.id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
->all(); |
|
|
|
|
|
|
|
foreach ($commandes as $c) |
|
|
@@ -135,10 +136,15 @@ class CommandeController extends \yii\web\Controller { |
|
|
|
$commandes = []; |
|
|
|
|
|
|
|
// points de vente |
|
|
|
$points_vente = PointVente::find()->all(); |
|
|
|
$points_vente = PointVente::find() |
|
|
|
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
->all(); |
|
|
|
|
|
|
|
// produits |
|
|
|
$produits = Produit::find()->orderBy('order ASC')->all(); |
|
|
|
$produits = Produit::find() |
|
|
|
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
->orderBy('order ASC') |
|
|
|
->all(); |
|
|
|
|
|
|
|
// users |
|
|
|
$arr_users = [0 => '--']; |
|
|
@@ -150,7 +156,10 @@ class CommandeController extends \yii\web\Controller { |
|
|
|
// création du jour de production |
|
|
|
$production = null; |
|
|
|
if ($date != '') { |
|
|
|
$production = Production::find()->where(['date' => $date])->one(); |
|
|
|
$production = Production::find() |
|
|
|
->where(['date' => $date]) |
|
|
|
->andWhere(['id_etablissement'=>Yii::$app->user->identity->id_etablissement]) |
|
|
|
->one(); |
|
|
|
if (!$production) { |
|
|
|
$production = new Production; |
|
|
|
$production->date = $date; |
|
|
@@ -168,6 +177,7 @@ class CommandeController extends \yii\web\Controller { |
|
|
|
->with('commandeProduits', 'user') |
|
|
|
->joinWith('production') |
|
|
|
->where(['production.date' => $date]) |
|
|
|
->andWhere(['production.id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
->orderBy('date ASC') |
|
|
|
->all(); |
|
|
|
|