@@ -4,22 +4,29 @@ use common\logic\Order\Order\Module\OrderModule; | |||
use yii\helpers\Html; | |||
$orderModule = OrderModule::getInstance(); | |||
$index = 0 | |||
$index = 1; | |||
$shoppingCartLabelsByColumn = 8; | |||
?> | |||
<?php foreach($ordersArray as $order): ?> | |||
<?php | |||
$i = 0; | |||
foreach($ordersArray as $key => $order): ?> | |||
<div class="shopping-cart-label shopping-cart-label-<?= $index ?>"> | |||
<div class="inner"> | |||
<div class="username"> | |||
<?= $orderModule->getOrderUsername($order); ?> | |||
</div> | |||
<div class="point-sale"> | |||
<?= Html::encode($order->pointSale->name); ?> • <?= date('d/m', strtotime($distribution->date)); ?> | |||
<?= date('d/m', strtotime($distribution->date)); ?> • | |||
<?= Html::encode($order->pointSale->name); ?> | |||
</div> | |||
<div class="products"> | |||
<?= $orderModule->getCartSummary($order); ?> | |||
</div> | |||
</div> | |||
</div> | |||
<?php $index = ($index == 5) ? 0 : $index + 1; ?> | |||
<?php $index = ($index == $shoppingCartLabelsByColumn) ? 1 : $index + 1; ?> | |||
<?php if($index == 1 && $key !== array_key_last($ordersArray)): ?> | |||
<columnbreak /> | |||
<?php endif; ?> | |||
<?php endforeach; ?> |
@@ -38,9 +38,12 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple | |||
'methods' => [ | |||
'SetHeader' => ['Étiquettes du ' . date('d/m/Y', strtotime($distribution->date))], | |||
'SetFooter' => ['{PAGENO}'], | |||
] | |||
], | |||
]); | |||
$pdf->getApi()->SetColumns(4); | |||
$pdf->getApi()->keepColumns = true; | |||
return $pdf->render(); | |||
} | |||
@@ -62,46 +65,30 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple | |||
} | |||
.shopping-cart-label { | |||
box-sizing: border-box; | |||
width: 49.9%; | |||
height: 368px; | |||
float: left; | |||
text-align: center; | |||
} | |||
.shopping-cart-label.shopping-cart-label-0, | |||
.shopping-cart-label.shopping-cart-label-2 { | |||
border-bottom: solid 1px #e0e0e0; | |||
border-right: solid 1px #e0e0e0; | |||
} | |||
.shopping-cart-label.shopping-cart-label-1, | |||
.shopping-cart-label.shopping-cart-label-3 { | |||
border-bottom: solid 1px #e0e0e0; | |||
} | |||
.shopping-cart-label.shopping-cart-label-4 { | |||
border-right: solid 1px #e0e0e0; | |||
-webkit-column-break-inside:avoid; | |||
column-break-inside: avoid; | |||
-webkit-page-break-inside:avoid; | |||
page-break-inside: avoid; | |||
} | |||
.shopping-cart-label .inner { | |||
padding: 20px; | |||
padding: 8px; | |||
} | |||
.shopping-cart-label .username { | |||
margin-bottom: 3px; | |||
font-weight: bold; | |||
font-size: 18px; | |||
font-size: 13px; | |||
} | |||
.shopping-cart-label .point-sale { | |||
margin-bottom: 10px; | |||
font-size: 15px; | |||
font-size: 10px; | |||
line-height: 12px; | |||
text-transform: uppercase; | |||
margin-bottom: 3px; | |||
} | |||
.shopping-cart-label .products { | |||
font-size: 10px; | |||
} | |||
'; | |||
} |
@@ -119,7 +119,7 @@ class ExportManager extends AbstractManager | |||
]; | |||
} | |||
private function producerHasOptionExportEnabled(string $exportName): bool | |||
private function producerHasOptionExportEnabled(string $exportName): ?bool | |||
{ | |||
$producer = $this->getProducerContext(); | |||
$fieldOptionExport = $this->getProducerFieldOptionExport($exportName); |
@@ -208,7 +208,7 @@ class OrderRepository extends AbstractRepository | |||
* Retourne le résumé du panier au format HTML. | |||
* @TODO : à déplacer dans OrderSolver | |||
*/ | |||
public function getCartSummary(Order $order, $htmlFormat = true): string | |||
public function getCartSummary(Order $order, bool $htmlFormat = true): string | |||
{ | |||
if (!isset($order->productOrder)) { | |||
$order->productOrder = $this->productOrderRepository->findProductOrdersByOrder($order); | |||
@@ -217,17 +217,18 @@ class OrderRepository extends AbstractRepository | |||
$html = ''; | |||
$i = 0; | |||
$count = count($order->productOrder); | |||
foreach ($order->productOrder as $p) { | |||
if (isset($p->product)) { | |||
$html .= Html::encode($p->product->name) . ' (' . $p->quantity . ' ' . $this->productSolver->strUnit( | |||
$p->product, | |||
'wording_short', | |||
true | |||
) . ')'; | |||
foreach ($order->productOrder as $productOrder) { | |||
if (isset($productOrder->product)) { | |||
$html .= | |||
'<strong>' . $productOrder->quantity . ($htmlFormat ? ' ' : ' '). $this->productSolver->strUnit($productOrder->product, 'wording_short', true) . '</strong> '. | |||
Html::encode($productOrder->product->name); | |||
if (++$i != $count) { | |||
if ($htmlFormat) { | |||
$html .= '<br />'; | |||
} else { | |||
} | |||
else { | |||
$html .= "\n"; | |||
} | |||
} |