|
|
@@ -40,6 +40,7 @@ namespace backend\controllers; |
|
|
|
|
|
|
|
use common\helpers\CSV; |
|
|
|
use common\helpers\GlobalParam; |
|
|
|
use common\helpers\Price; |
|
|
|
use common\logic\Document\DeliveryNote\Model\DeliveryNote; |
|
|
|
use common\logic\Document\Document\Model\Document; |
|
|
|
use common\logic\Document\Invoice\Model\Invoice; |
|
|
@@ -210,6 +211,7 @@ class DocumentController extends BackendController |
|
|
|
public function actionExportCsvEvoliz(int $id) |
|
|
|
{ |
|
|
|
$documentManager = $this->getDocumentManager(); |
|
|
|
$productOrderManager = $this->getProductOrderManager(); |
|
|
|
|
|
|
|
$datas = []; |
|
|
|
$document = $this->findModel($id); |
|
|
@@ -262,6 +264,14 @@ class DocumentController extends BackendController |
|
|
|
$price = $productOrder->getInvoicePrice(); |
|
|
|
} |
|
|
|
|
|
|
|
$typeTotal = $documentManager->isInvoicePrice($document) ? Order::INVOICE_AMOUNT_TOTAL : Order::AMOUNT_TOTAL; |
|
|
|
$priceTotal = $productOrderManager->getPriceByTypeTotal($productOrder, $typeTotal) * $productOrder->quantity; |
|
|
|
$tva = Price::getVat( |
|
|
|
$priceTotal, |
|
|
|
$productOrder->taxRate->value, |
|
|
|
$document->tax_calculation_method |
|
|
|
); |
|
|
|
|
|
|
|
$datas[] = [ |
|
|
|
$document->reference, // N° facture externe * |
|
|
|
date('d/m/Y', strtotime($document->date)), // Date facture * |
|
|
@@ -292,12 +302,12 @@ class DocumentController extends BackendController |
|
|
|
'', // Réf. |
|
|
|
$productOrder->product->name, // Désignation * |
|
|
|
$productOrder->quantity, // Qté * |
|
|
|
'', // Product::strUnit($productOrder->unit, 'wording'), // Unité |
|
|
|
'', // Product::strUnit($productOrder->unit, 'wording'), // Unité |
|
|
|
$price, // PU HT * |
|
|
|
'', // Remise |
|
|
|
$productOrder->taxRate->value * 100, // TVA |
|
|
|
'', // Total TVA |
|
|
|
'', // Total HT |
|
|
|
$tva, // Total TVA |
|
|
|
$priceTotal, // Total HT |
|
|
|
'', // Créateur |
|
|
|
]; |
|
|
|
} |