Ver código fonte

[Administration] Distributions > récapitulatif commandes PDF : crédit à 0,00€ #1291

feature/souke
Guillaume Bourgeois 1 ano atrás
pai
commit
84eaaa421c
1 arquivos alterados com 4 adições e 7 exclusões
  1. +4
    -7
      common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php

+ 4
- 7
common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php Ver arquivo

@@ -17,6 +17,7 @@ use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Repository\ProductRepository;
use common\logic\Product\Product\Service\ProductSolver;
use common\logic\User\User\Repository\UserRepository;
use common\logic\User\UserProducer\Model\UserProducer;
use kartik\mpdf\Pdf;

@@ -32,6 +33,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
protected OrderSolver $orderSolver;
protected ProductSolver $productSolver;
protected DocumentSolver $documentSolver;
protected UserRepository $userRepository;

public function loadDependencies(): void
{
@@ -43,6 +45,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
$this->orderSolver = $this->loadService(OrderSolver::class);
$this->productSolver = $this->loadService(ProductSolver::class);
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->userRepository = $this->loadService(UserRepository::class);
}

public function generateDistributionReportPdf(Distribution $distribution, bool $save = false)
@@ -275,13 +278,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
$credit = '' ;

if(isset($order->user) && $order->user->id) {
$userProducer = UserProducer::searchOne([
'id_user' => $order->user->id
]);

if($userProducer) {
$credit = number_format($userProducer->credit,2).' €' ;
}
$credit = number_format($this->userRepository->getCredit($order->user, true),2).' €' ;
}

return '<td>'.$credit.'</td>' ;

Carregando…
Cancelar
Salvar