Преглед изворни кода

[Admin] Export commandes PDF : affichage du montant restant/surplus à régler

feature/souke
Guillaume Bourgeois пре 11 месеци
родитељ
комит
e05d0dcd9d
6 измењених фајлова са 59 додато и 16 уклоњено
  1. +0
    -7
      backend/views/distribution/index.php
  2. +5
    -1
      common/logic/Distribution/Distribution/Export/DistributionReportPdfGenerator.php
  3. +9
    -8
      common/logic/Order/Order/Repository/OrderRepository.php
  4. +24
    -0
      common/logic/Order/Order/Service/OrderSolver.php
  5. +11
    -0
      common/web/css/screen.css
  6. +10
    -0
      common/web/sass/_common.scss

+ 0
- 7
backend/views/distribution/index.php Прегледај датотеку

@@ -401,13 +401,6 @@ $this->setPageTitle('Distributions') ;
<order-state-payment :order="order" :producer="producer"></order-state-payment>
</a>
<span class="glyphicon glyphicon-time" title="Débit automatique du crédit la veille de la distribution" v-if="order.amount != 0 && order.isCreditAutoPayment && (order.amount_paid == 0 || order.amount_paid < order.amount)"></span>

<div v-if="order.amount_paid > 0 && order.amount_paid < order.amount">
<span class="glyphicon glyphicon-alert"></span> Reste à payer
</div>
<div v-if="order.amount_paid > order.amount">
<span class="glyphicon glyphicon-alert"></span> Surplus à rembourser
</div>
</template>
</td>
<td class="column-credit" v-if="!idActivePointSale || (pointSaleActive && pointSaleActive.credit == 1)">

+ 5
- 1
common/logic/Distribution/Distribution/Export/DistributionReportPdfGenerator.php Прегледај датотеку

@@ -115,6 +115,10 @@ class DistributionReportPdfGenerator extends AbstractGenerator implements Distri
table tr td {
font-size: 13px ;
}
.payment-detail-remaining-surplus {
font-size: 10px;
}
',
'methods' => [
'SetHeader' => ['Commandes du ' . date('d/m/Y', strtotime($distribution->date))],
@@ -289,7 +293,7 @@ class DistributionReportPdfGenerator extends AbstractGenerator implements Distri

public function columnOrderAmount(Order $order): string
{
$html = '<td><strong>'.number_format($order->amount_with_tax, 2) . ' €</strong>';
$html = '<td class="td-order-amount"><strong>'.number_format($order->amount_with_tax, 2) . ' €</strong>';

$paymentLabelPaid = $this->orderRepository->getPaymentLabelPaid($order);
if($paymentLabelPaid && strlen($paymentLabelPaid)) {

+ 9
- 8
common/logic/Order/Order/Repository/OrderRepository.php Прегледај датотеку

@@ -4,6 +4,7 @@ namespace common\logic\Order\Order\Repository;

use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use common\helpers\Price;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\Distribution\Repository\DistributionRepository;
@@ -581,7 +582,13 @@ class OrderRepository extends AbstractRepository
$titleLabel = 'Paiement partiel '.$amountPaid;
}

return '<span class="label label-'.$classLabel.'" title="'.$titleLabel.'">'.$label.'</span>';
$labelHtml = '<span class="label label-'.$classLabel.'" title="'.$titleLabel.'">'.$label.'</span>';

if($amountPaid) {
$labelHtml .= $this->orderSolver->getPaymentLabelAmountRemainingSurplus($order);
}

return $labelHtml;
}

public function getPaymentLabelPaid(Order $order): string
@@ -615,13 +622,7 @@ class OrderRepository extends AbstractRepository
}
}

$orderPaymentStatus = $this->orderSolver->getPaymentStatus($order);
if($orderPaymentStatus == Order::PAYMENT_SURPLUS) {
$label .= ' (surplus)';
}
elseif($orderPaymentStatus == Order::PAYMENT_UNPAID) {
$label .= ' (partiel)';
}
$label .= $this->orderSolver->getPaymentLabelAmountRemainingSurplus($order);
}
}


+ 24
- 0
common/logic/Order/Order/Service/OrderSolver.php Прегледај датотеку

@@ -300,6 +300,30 @@ class OrderSolver extends AbstractService implements SolverInterface
return $html;
}

public function getPaymentLabelAmountRemainingSurplus(Order $order): string
{
$amountPaid = $this->getOrderAmountPaid($order);

if($amountPaid) {
$amountRemaining = $this->getOrderAmountWithTax($order, Order::AMOUNT_REMAINING);
if($amountRemaining > 0) {
return $this->getHtmlPaymentLabelAmountRemainingSurplus('Reste <strong>'.Price::format($amountRemaining).'</strong> à payer');
}

$amountSurplus = $this->getOrderAmountWithTax($order, Order::AMOUNT_SURPLUS);
if($amountSurplus > 0) {
return $this->getHtmlPaymentLabelAmountRemainingSurplus('Surplus : <strong>'.Price::format($amountSurplus).'</strong> à rembourser');
}
}

return '';
}

private function getHtmlPaymentLabelAmountRemainingSurplus(string $text): string
{
return '<br><span class="payment-detail-remaining-surplus">'.$text.'</span>';
}

/**
* Retourne l'origine de la commande (client, automatique ou admin) sous forme texte ou HTML.
*/

+ 11
- 0
common/web/css/screen.css Прегледај датотеку

@@ -211,3 +211,14 @@ termes.
#main #content .site-error .alert .btn {
text-decoration: none;
}

/* Paiement */
/* line 144, ../sass/_common.scss */
.payment-detail-remaining-surplus {
font-size: 13px;
color: gray;
}
/* line 148, ../sass/_common.scss */
.payment-detail-remaining-surplus strong {
font-weight: bold;
}

+ 10
- 0
common/web/sass/_common.scss Прегледај датотеку

@@ -138,4 +138,14 @@
.actions {
//text-align: center;
}
}

/* Paiement */
.payment-detail-remaining-surplus {
font-size: 13px;
color: gray;

strong {
font-weight: bold;
}
}

Loading…
Откажи
Сачувај