getProducerModule(); $invoiceModule = $this-> getInvoiceModule(); $userModule = $this->getUserModule(); $this->setTitle('Factures'); $this->addBreadcrumb($this->getTitle()); $this->addButton(['label' => 'Nouvelle facture ', 'url' => 'invoice/create', 'class' => 'btn btn-primary']); ?>
$searchModel, 'dataProvider' => $dataProvider, 'columns' => [ [ 'attribute' => 'status', 'label' => 'Statut', 'filter' => [ 'draft' => 'Brouillon', 'valid' => 'Valide', ], 'format' => 'raw', 'value' => function ($invoice) use ( $invoiceModule) { return $invoiceModule->getHtmlLabel($invoice); } ], [ 'attribute' => 'reference', 'headerOptions' => ['class' => 'column-hide-on-mobile'], 'filterOptions' => ['class' => 'column-hide-on-mobile'], 'contentOptions' => ['class' => 'column-hide-on-mobile'], 'value' => function ($invoice) { return (strlen($invoice->reference) > 0) ? $invoice->reference : ''; } ], 'name', [ 'attribute' => 'username', 'header' => 'Utilisateur', 'headerOptions' => ['class' => 'column-hide-on-mobile'], 'filterOptions' => ['class' => 'column-hide-on-mobile'], 'contentOptions' => ['class' => 'column-hide-on-mobile'], 'value' => function ($invoice) use ($userModule) { return $userModule->getUsername($invoice->user); } ], [ 'attribute' => 'date', 'header' => 'Date', 'headerOptions' => ['class' => 'column-hide-on-mobile'], 'filterOptions' => ['class' => 'column-hide-on-mobile'], 'contentOptions' => ['class' => 'column-hide-on-mobile'], 'value' => function ($invoice) { return date('d/m/Y', strtotime($invoice->date)); } ], [ 'attribute' => 'amount', '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', 'format' => 'raw', 'headerOptions' => ['class' => 'column-hide-on-mobile'], 'filterOptions' => ['class' => 'column-hide-on-mobile'], 'contentOptions' => ['class' => 'column-hide-on-mobile'], 'value' => function ($invoice) use ( $invoiceModule) { $amountWithTax = $invoiceModule->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL); if($amountWithTax && $invoiceModule->isInvoicePaid($invoice)) { return 'Oui'; } return 'Non'; } ], [ 'attribute' => 'is_sent', 'header' => 'Envoyée', 'format' => 'raw', 'headerOptions' => ['class' => 'column-hide-on-mobile'], 'filterOptions' => ['class' => 'column-hide-on-mobile'], 'contentOptions' => ['class' => 'column-hide-on-mobile'], 'value' => function ($model) { if ($model->is_sent) { return 'Oui'; } else { return 'Non'; } } ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{validate} {update} {delete} {send} {download} {export-csv-evoliz}', 'headerOptions' => ['class' => 'column-actions'], 'contentOptions' => ['class' => 'column-actions'], 'buttons' => [ 'validate' => function ($url, $invoice) use ( $invoiceModule) { return ( $invoiceModule->isStatusDraft($invoice) ? Html::a('', $url, [ 'title' => 'Valider', 'class' => 'btn btn-default' ]) : ''); }, 'send' => function ($url, $invoice) { return ((isset($invoice->user) && strlen($invoice->user->email) > 0) ? Html::a('', $url, [ 'title' => 'Envoyer', 'class' => 'btn btn-default' ]) : ''); }, 'download' => function ($url, $invoice) { return Html::a('', $url, [ 'title' => 'Télécharger', 'class' => 'btn btn-default' ]); }, 'export-csv-evoliz' => function ($url, $invoice) use ($producerModule) { if ($producerModule->getConfig('option_export_evoliz')) { return Html::a(' Evoliz', $url, [ 'title' => 'Export CSV Evoliz', 'class' => 'btn btn-default' ]); } return ''; }, 'update' => function ($url, $invoice) { return Html::a('', $url, [ 'title' => 'Modifier', 'class' => 'btn btn-default' ]); }, 'delete' => function ($url, $invoice) use ( $invoiceModule) { return ( $invoiceModule->isStatusDraft($invoice) ? Html::a('', $url, [ 'title' => 'Supprimer', 'class' => 'btn btn-default' ]) : ''); } ], ], ], ]); ?>
Aucune facture enregistrée