search(\Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } public function actionAjaxDeleteDeliveryNote($idInvoice, $idDeliveryNote) { $orderModule = $this->getOrderModule(); $invoiceModule = $this-> getInvoiceModule(); $deliveryNoteModule = $this->getDeliveryNoteModule(); $invoice = $invoiceModule->findOneInvoiceById($idInvoice); $deliveryNote = $deliveryNoteModule->findOneDeliveryNoteById($idDeliveryNote); if ($invoice && $invoiceModule->isStatusDraft($invoice) && $deliveryNote) { $orderModule->unassignAllOrdersInvoiceByDeliveryNote($deliveryNote); return Ajax::responseSuccess('Bon de livraison supprimé de la facture.'); } else { return Ajax::responseError('Une erreur est survenue lors de la suppression du bon de livraison.'); } } public function actionAjaxAddDeliveryNote($idInvoice, $idDeliveryNote) { $orderModule = $this->getOrderModule(); $invoiceModule = $this-> getInvoiceModule(); $deliveryNoteModule = $this->getDeliveryNoteModule(); $invoice = $invoiceModule->findOneInvoiceById($idInvoice); $deliveryNote = $deliveryNoteModule->findOneDeliveryNoteById($idDeliveryNote); if ($invoice && $invoiceModule->isStatusDraft($invoice) && $deliveryNote) { $orderModule->assignAllOrdersInvoiceByDeliveryNote($invoice, $deliveryNote); return Ajax::responseSuccess("Bon de livraison ajouté à la facture."); } else { return Ajax::responseError("Une erreur est survenue lors de l'ajout du bon de livraison."); } } }