浏览代码

[backend] Producteurs : somme des abonnements

refactoring
Guillaume 4 年前
父节点
当前提交
b5ec5ca4af
共有 2 个文件被更改,包括 16 次插入1 次删除
  1. +12
    -1
      backend/controllers/ProducerAdminController.php
  2. +4
    -0
      backend/views/producer-admin/index.php

+ 12
- 1
backend/controllers/ProducerAdminController.php 查看文件

@@ -91,14 +91,25 @@ class ProducerAdminController extends BackendController
$dataProviderProducer = new ActiveDataProvider([
'query' => Producer::find()
->with('userProducer', 'user')
->orderBy('date_creation DESC'),
->orderBy('free_price DESC'),
'pagination' => [
'pageSize' => 1000,
],
]);

$producersArray = Producer::find()
->with('userProducer', 'user')
->orderBy('free_price DESC')
->all();

$sumFreePrice = 0 ;
foreach($producersArray as $producer) {
$sumFreePrice += $producer->free_price ;
}

return $this->render('index', [
'dataProviderProducer' => $dataProviderProducer,
'sumFreePrice' => $sumFreePrice
]);
}

+ 4
- 0
backend/views/producer-admin/index.php 查看文件

@@ -48,6 +48,10 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico

?>

<div class="alert alert-info">
Abonnements mensuels : <strong><?= $sumFreePrice ?> € HT</strong>
</div>

<?= GridView::widget([
'dataProvider' => $dataProviderProducer,
'columns' => [

正在加载...
取消
保存