@@ -440,7 +440,8 @@ class DocumentController extends BackendController | |||
$ordersReturnArray[] = [ | |||
'id' => $order->id, | |||
'date' => $order->distribution->date, | |||
'amount_with_tax' => $order->invoice_amount_with_tax | |||
'name' => date('d/m/Y', strtotime($order->distribution->date)), | |||
'amount_with_tax' => $orderManager->getOrderAmountWithTax($order, Order::INVOICE_AMOUNT_TOTAL) | |||
]; | |||
} | |||
@@ -254,7 +254,7 @@ $documentClass = $documentManager->getClass($model); | |||
<table v-if="ordersUpdateArray && ordersUpdateArray.length > 0" class="table table-bordered"> | |||
<thead> | |||
<tr> | |||
<th>Libellé</th> | |||
<th>Date</th> | |||
<th v-if="taxRateProducer != 0">Montant (TTC)</th> | |||
<th v-else>Montant</th> | |||
<th v-if="document.status == 'draft'"></th> | |||
@@ -262,7 +262,7 @@ $documentClass = $documentManager->getClass($model); | |||
</thead> | |||
<tbody> | |||
<tr v-for="order in ordersUpdateArray"> | |||
<td>{{ order.date }}</td> | |||
<td>{{ order.name }}</td> | |||
<td>{{ formatPrice(order.amount_with_tax) }}</td> | |||
<td v-if="document.status == 'draft'"> | |||
<a class="btn btn-default" href="javascript:void(0);" @click="deleteOrderFromInvoice" :data-id="order.id"> | |||
@@ -279,7 +279,7 @@ $documentClass = $documentManager->getClass($model); | |||
<select class="form-control" v-model="orderAddId"> | |||
<option value="0" selected="selected">--</option> | |||
<option v-for="order in ordersCreateArray" :value="order.id"> | |||
{{ order.date }} | |||
{{ order.name }} | |||
</option> | |||
</select> | |||
</div> |
@@ -337,20 +337,11 @@ class OrderBuilder extends AbstractBuilder | |||
/** | |||
* Initialise le montant total, le montant déjà payé et le poids de la commande. | |||
*/ | |||
public function initOrder(Order $order, string $taxCalculationMethod = Document::TAX_CALCULATION_METHOD_DEFAULT): void | |||
public function initOrder(Order $order): void | |||
{ | |||
// @TODO : récupérer le bon taxCalculationMethod | |||
//$taxCalculationMethod = Document::TAX_CALCULATION_METHOD_SUM_OF_ROUNDINGS; | |||
$taxCalculationMethod = $this->getProducerContext()->option_tax_calculation_method; | |||
$this->initOrderAmount($order, $taxCalculationMethod); | |||
$this->initOrderPaidAmount($order); | |||
// @TODO : faire le bon calcul pour la TVA | |||
/*$totalVat = 0; | |||
foreach($order->invoice_amount_vat as $vat) { | |||
$totalVat += $vat; | |||
} | |||
$order->invoice_amount_with_tax = Price::round($order->invoice_amount + $totalVat);*/ | |||
} | |||
/** |
@@ -4,9 +4,11 @@ namespace common\logic\Order\Order\Service; | |||
use common\helpers\Price; | |||
use common\logic\AbstractService; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Document\Document\Service\DocumentSolver; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\Producer\Service\ProducerSolver; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\SolverInterface; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
@@ -20,12 +22,14 @@ class OrderSolver extends AbstractService implements SolverInterface | |||
protected UserSolver $userSolver; | |||
protected DocumentSolver $documentSolver; | |||
protected CreditHistorySolver $creditHistorySolver; | |||
protected ProducerSolver $producerSolver; | |||
public function loadDependencies(): void | |||
{ | |||
$this->documentSolver = $this->loadService(DocumentSolver::class); | |||
$this->userSolver = $this->loadService(UserSolver::class); | |||
$this->creditHistorySolver = $this->loadService(CreditHistorySolver::class); | |||
$this->producerSolver = $this->loadService(ProducerSolver::class); | |||
} | |||
public function getFieldNameAmount($typeTotal = Order::AMOUNT_TOTAL, string $typeField = ''): string | |||
@@ -53,6 +57,10 @@ class OrderSolver extends AbstractService implements SolverInterface | |||
$totalVat += $vat; | |||
} | |||
if($this->getProducerContext()->option_tax_calculation_method == Document::TAX_CALCULATION_METHOD_ROUNDING_OF_THE_SUM) { | |||
$totalVat = Price::round($totalVat); | |||
} | |||
return $totalVat; | |||
} | |||