Parcourir la source

[Administration] Distributions > récapitulatif commandes PDF : amélioration lisibilité quantités #1282

feature/souke
Guillaume Bourgeois il y a 1 an
Parent
révision
5a5a36ecfc
1 fichiers modifiés avec 11 ajouts et 9 suppressions
  1. +11
    -9
      common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php

+ 11
- 9
common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php Voir le fichier

@@ -23,7 +23,7 @@ use kartik\mpdf\Pdf;

class DistributionReportPdfGenerator extends AbstractGenerator
{
const LIMIT_PRODUCTS = 100;
const LIMIT_PRODUCTS = 120;

protected OrderRepository $orderRepository;
protected OrderBuilder $orderBuilder;
@@ -175,8 +175,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$strProducts .= '(' .$quantity .$theUnit.') '.$this->productSolver->getNameExport($product) . '<br />';
$strProducts .= $this->displayOrderProduct($quantity, $unit, $product);
}
}

@@ -230,8 +229,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
foreach ($productsArray as $product) {
foreach ($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = ( $this->productSolver->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= '('.$productOrder->quantity .$unit.') '.$this->productSolver->getNameExport($product) . '<br />';
$strProducts .= $this->displayOrderProduct($productOrder->quantity, $productOrder->unit, $product);
}
}
}
@@ -335,8 +333,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$this->productSolver->getNameExport($product) . '<br />';
$html .= $this->displayOrderProduct($quantity, $unit, $product);
}
}

@@ -360,8 +357,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = $this->orderSolver->getProductQuantity($product, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->name . '<br />';
$html .= $this->displayOrderProduct($quantity, $unit, $product);
}
}
if($isBig && $cpt == self::LIMIT_PRODUCTS) {
@@ -377,4 +373,10 @@ class DistributionReportPdfGenerator extends AbstractGenerator

return $html;
}

public function displayOrderProduct(string $quantity, string $unit, Product $product)
{
$theUnit = ( $this->productSolver->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $this->productSolver->strUnit($unit, 'wording_short', true) ;
return '<strong>'.$quantity. $theUnit.'</strong> '.$this->productSolver->getNameExport($product). '<br />';
}
}

Chargement…
Annuler
Enregistrer