search(\Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } public function actionAjaxDeleteDeliveryNote($idInvoice, $idDeliveryNote) { $orderManager = $this->getOrderManager(); $invoiceManager = $this->getInvoiceManager(); $deliveryNoteManager = $this->getDeliveryNoteManager(); $invoice = $invoiceManager->findOneInvoiceById($idInvoice); $deliveryNote = $deliveryNoteManager->findOneDeliveryNoteById($idDeliveryNote); if ($invoice && $invoiceManager->isStatusDraft($invoice) && $deliveryNote) { $orderManager->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) { $orderManager = $this->getOrderManager(); $invoiceManager = $this->getInvoiceManager(); $deliveryNoteManager = $this->getDeliveryNoteManager(); $invoice = $invoiceManager->findOneInvoiceById($idInvoice); $deliveryNote = $deliveryNoteManager->findOneDeliveryNoteById($idDeliveryNote); if ($invoice && $invoiceManager->isStatusDraft($invoice) && $deliveryNote) { $orderManager->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."); } } }