|
|
@@ -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.') ? '' : ' '. $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.') ? '' : ' '. $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.') ? '' : ' '. $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.') ? '' : ' '. $this->productSolver->strUnit($unit, 'wording_short', true) ; |
|
|
|
return '<strong>'.$quantity. $theUnit.'</strong> '.$this->productSolver->getNameExport($product). '<br />'; |
|
|
|
} |
|
|
|
} |