Browse Source

Adapter la page production du backend au système multi-boulangerie

master
keun 8 years ago
parent
commit
89baa009a6
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      backend/controllers/CommandeController.php

+ 13
- 3
backend/controllers/CommandeController.php View File

->with('commandeProduits', 'user') ->with('commandeProduits', 'user')
->joinWith('production') ->joinWith('production')
->where(['production.date' => $date]) ->where(['production.date' => $date])
->andWhere(['production.id_etablissement' => Yii::$app->user->identity->id_etablissement])
->all(); ->all();


foreach ($commandes as $c) foreach ($commandes as $c)
$commandes = []; $commandes = [];


// points de vente // points de vente
$points_vente = PointVente::find()->all();
$points_vente = PointVente::find()
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])
->all();


// produits // 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 // users
$arr_users = [0 => '--']; $arr_users = [0 => '--'];
// création du jour de production // création du jour de production
$production = null; $production = null;
if ($date != '') { 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) { if (!$production) {
$production = new Production; $production = new Production;
$production->date = $date; $production->date = $date;
->with('commandeProduits', 'user') ->with('commandeProduits', 'user')
->joinWith('production') ->joinWith('production')
->where(['production.date' => $date]) ->where(['production.date' => $date])
->andWhere(['production.id_etablissement' => Yii::$app->user->identity->id_etablissement])
->orderBy('date ASC') ->orderBy('date ASC')
->all(); ->all();



Loading…
Cancel
Save