|
|
@@ -360,26 +360,36 @@ class Commande extends \yii\db\ActiveRecord |
|
|
|
$params['id_etablissement'] = Yii::$app->user->identity->id_etablissement ; |
|
|
|
|
|
|
|
$commandes = Commande::find() |
|
|
|
->with('commandeProduits', 'user', 'creditHistorique', 'pointVente') |
|
|
|
->joinWith('production') |
|
|
|
->with('commandeProduits', 'creditHistorique', 'pointVente') |
|
|
|
->joinWith(['production','user']) |
|
|
|
->where(['production.id_etablissement' => $params['id_etablissement']]) ; |
|
|
|
|
|
|
|
|
|
|
|
if(isset($params['date'])) |
|
|
|
$commandes = $commandes->andWhere(['production.date' => $params['date']]); |
|
|
|
|
|
|
|
/*$orderby = 'date' ; |
|
|
|
if(isset($params['orderby'])) |
|
|
|
$orderby = $params['orderby'] ; |
|
|
|
|
|
|
|
if(isset($params['order'])) |
|
|
|
$commandes = $commandes->orderBy('date '.$params['order']); |
|
|
|
$commandes = $commandes->orderBy($orderby.' '.$params['order']); |
|
|
|
else |
|
|
|
$commandes = $commandes->orderBy($orderby.' ASC');*/ |
|
|
|
|
|
|
|
if(isset($params['orderby'])) |
|
|
|
{ |
|
|
|
$commandes = $commandes->orderBy($params['orderby']); |
|
|
|
} |
|
|
|
else { |
|
|
|
$commandes = $commandes->orderBy('date ASC'); |
|
|
|
} |
|
|
|
|
|
|
|
if(isset($params['limit'])) |
|
|
|
$commandes = $commandes->limit($params['limit']) ; |
|
|
|
|
|
|
|
$commandes = $commandes->all() ; |
|
|
|
|
|
|
|
return $commandes ; |
|
|
|
|
|
|
|
return $commandes ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getEtat() |