소스 검색

Export commandes (tri)

Trier les commandes par numéro de boîte.
prodstable
keun 7 년 전
부모
커밋
120c140356
3개의 변경된 파일19개의 추가작업 그리고 8개의 파일을 삭제
  1. +2
    -1
      backend/controllers/CommandeController.php
  2. +1
    -1
      backend/controllers/SiteController.php
  3. +16
    -6
      common/models/Commande.php

+ 2
- 1
backend/controllers/CommandeController.php 파일 보기

@@ -67,7 +67,8 @@ class CommandeController extends BackendController {
$commandes = Commande::findBy([
'date' => $date,
'id_etablissement' => $id_etablissement
'id_etablissement' => $id_etablissement,
'orderby' => 'commentaire_point_vente ASC, user.nom ASC'
]) ;

foreach ($commandes as $c)

+ 1
- 1
backend/controllers/SiteController.php 파일 보기

@@ -88,7 +88,7 @@ class SiteController extends BackendController
// dernières commandes
$commandes = Commande::findBy([
'order' => 'DESC',
'orderby' => 'date DESC',
'limit' => 15
]) ;
foreach($commandes as $c)

+ 16
- 6
common/models/Commande.php 파일 보기

@@ -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()

Loading…
취소
저장