|
|
@@ -9,6 +9,7 @@ use common\logic\Feature\Feature\FeatureChecker; |
|
|
|
use common\logic\Feature\Feature\FeatureManager; |
|
|
|
use common\logic\Order\Order\Model\Order; |
|
|
|
use common\logic\Order\Order\Repository\OrderRepository; |
|
|
|
use common\logic\Order\Order\Service\OrderBuilder; |
|
|
|
use common\logic\Order\Order\Service\OrderSolver; |
|
|
|
use common\logic\Producer\Producer\Service\ProducerSolver; |
|
|
|
use kartik\mpdf\Pdf; |
|
|
@@ -24,6 +25,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
protected OrderRepository $orderRepository; |
|
|
|
protected OrderSolver $orderSolver; |
|
|
|
protected FeatureChecker $featureChecker; |
|
|
|
protected OrderBuilder $orderBuilder; |
|
|
|
|
|
|
|
public function loadDependencies(): void |
|
|
|
{ |
|
|
@@ -31,6 +33,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
$this->orderRepository = $this->loadService(OrderRepository::class); |
|
|
|
$this->orderSolver = $this->loadService(OrderSolver::class); |
|
|
|
$this->featureChecker = $this->loadService(FeatureChecker::class); |
|
|
|
$this->orderBuilder = $this->loadService(OrderBuilder::class); |
|
|
|
} |
|
|
|
|
|
|
|
public function getSpecificFormatDetailsArray(): array |
|
|
@@ -57,6 +60,10 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
$ordersArray = $this->orderRepository->findOrdersByDistribution($distribution); |
|
|
|
$ordersArray = $this->filterOrdersExcludedUsersAndPointSales($ordersArray); |
|
|
|
|
|
|
|
foreach($ordersArray as $order) { |
|
|
|
$this->orderBuilder->initOrder($order); |
|
|
|
} |
|
|
|
|
|
|
|
$content = \Yii::$app->getView()->render('@backend/views/distribution/shopping-cart-labels.php', [ |
|
|
|
'distribution' => $distribution, |
|
|
|
'ordersArray' => $ordersArray, |
|
|
@@ -161,6 +168,21 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
height: '.$specificFormatHeight.'mm; |
|
|
|
display: block; |
|
|
|
float: left; |
|
|
|
} |
|
|
|
|
|
|
|
.shopping-cart-label .amount-and-payment { |
|
|
|
margin-top: 8px; |
|
|
|
font-size: 10px; |
|
|
|
/*border-top: dotted 1px gray;*/ |
|
|
|
} |
|
|
|
|
|
|
|
.shopping-cart-label .amount-and-payment .amount { |
|
|
|
display: inline-block; |
|
|
|
background-color: #e0e0e0; |
|
|
|
color: #333; |
|
|
|
font-weight: bold; |
|
|
|
padding: 3px 8px; |
|
|
|
border-radius: 8px; |
|
|
|
}'; |
|
|
|
} |
|
|
|
else { |
|
|
@@ -181,8 +203,20 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
return $css; |
|
|
|
} |
|
|
|
|
|
|
|
public function getShoppingCartLabelAsHtml(Order $order, int $index): string |
|
|
|
public function getShoppingCartLabelAsHtml(Order $order, int $index, bool $isSpecificFormat): string |
|
|
|
{ |
|
|
|
$amountAndPayment = ''; |
|
|
|
if($isSpecificFormat) { |
|
|
|
$amountAndPayment = '<div class="amount-and-payment">'; |
|
|
|
$amountAndPayment .= '<span class="amount">'.$this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true).'</span>'; |
|
|
|
|
|
|
|
$paymentLabelPaid = $this->orderRepository->getPaymentLabelPaid($order); |
|
|
|
if($paymentLabelPaid && strlen($paymentLabelPaid)) { |
|
|
|
$amountAndPayment .= ' / '.$paymentLabelPaid; |
|
|
|
} |
|
|
|
$amountAndPayment .= '</div>'; |
|
|
|
} |
|
|
|
|
|
|
|
return '<div class="shopping-cart-label shopping-cart-label-'.$index.'"> |
|
|
|
<div class="inner"> |
|
|
|
<div class="username"> |
|
|
@@ -195,6 +229,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple |
|
|
|
<div class="products"> |
|
|
|
'.$this->orderRepository->getCartSummary($order).' |
|
|
|
</div> |
|
|
|
'.$amountAndPayment.' |
|
|
|
</div> |
|
|
|
</div>'; |
|
|
|
} |