浏览代码

[Administration] Factures & bons de livraisons > Liste : amélioration des filtres de recherche

feature/rotating_product
Guillaume Bourgeois 5 个月前
父节点
当前提交
ed796a2064
共有 3 个文件被更改,包括 33 次插入11 次删除
  1. +1
    -1
      backend/controllers/InvoiceController.php
  2. +8
    -6
      backend/views/invoice/index.php
  3. +24
    -4
      domain/Document/Invoice/InvoiceSearch.php

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

@@ -60,7 +60,7 @@ class InvoiceController extends DocumentController
public function actionAjaxDeleteDeliveryNote($idInvoice, $idDeliveryNote)
{
$orderModule = $this->getOrderModule();
$invoiceModule = $this-> getInvoiceModule();
$invoiceModule = $this-> getInvoiceModule();
$deliveryNoteModule = $this->getDeliveryNoteModule();
$invoice = $invoiceModule->findOneInvoiceById($idInvoice);
$deliveryNote = $deliveryNoteModule->findOneDeliveryNoteById($idDeliveryNote);

+ 8
- 6
backend/views/invoice/index.php 查看文件

@@ -52,7 +52,6 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
?>

<div class="invoice-index">

<?php if (Invoice::searchCount()): ?>
<?= GridView::widget([
'filterModel' => $searchModel,
@@ -82,7 +81,7 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
'name',
[
'attribute' => 'username',
'header' => 'Utilisateur',
'label' => 'Utilisateur',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
@@ -105,12 +104,17 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
'header' => 'Montant',
'format' => 'raw',
'value' => function ($invoice) use ( $invoiceModule) {
$amountWithTax = $invoiceModule->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL);
return $invoiceModule->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL, true);
}
],
[
'header' => 'Payée',
'attribute' => 'paid',
'label' => 'Payée',
/*'filter' => [
0 => 'Non',
1 => 'Oui',
],*/
'filter' => false,
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
@@ -120,7 +124,6 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
if($amountWithTax && $invoiceModule->isInvoicePaid($invoice)) {
return '<span class="label label-success">Oui</span>';
}

return '<span class="label label-default">Non</span>';
}
],
@@ -166,7 +169,6 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
'title' => 'Export CSV Evoliz', 'class' => 'btn btn-default'
]);
}

return '';
},
'update' => function ($url, $invoice) {

+ 24
- 4
domain/Document/Invoice/InvoiceSearch.php 查看文件

@@ -40,17 +40,19 @@ namespace domain\Document\Invoice;

use common\helpers\GlobalParam;
use yii\data\ActiveDataProvider;
use yii\data\Sort;

class InvoiceSearch extends Invoice
{
var $paid;
var $username;

public function rules()
{
return [
[[], 'safe'],
[['paid'], 'safe'],
[['comment', 'address', 'status', 'username'], 'string'],
[['name', 'reference'], 'string', 'max' => 255],
[['name', 'reference', 'username'], 'string', 'max' => 255],
];
}

@@ -59,16 +61,34 @@ class InvoiceSearch extends Invoice
$invoiceRepository = InvoiceRepository::getInstance();
$optionsSearch = $invoiceRepository->getDefaultOptionsSearch();

$sort = new Sort([
'attributes' => [
'status',
'reference',
'name',
'date',
'username' => [
'asc' => ['user_invoice.lastname' => SORT_ASC, 'user_invoice.name' => SORT_ASC],
'desc' => ['user_invoice.lastname' => SORT_DESC, 'user_invoice.name' => SORT_DESC],
]
],
'defaultOrder' => [
'status' => SORT_ASC,
'reference' => SORT_DESC
]
]);

$query = Invoice::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'])
->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('invoice.status ASC, invoice.reference DESC')
//->orderBy('invoice.status ASC, invoice.reference DESC')
->orderBy($sort->orders)
->groupBy('invoice.id');

$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'reference', 'date']],
'sort' => $sort,
'pagination' => [
'pageSize' => 20,
],

正在加载...
取消
保存