Pārlūkot izejas kodu

[Administration] Distribution > récapitulatif commandes PDF : informations de paiement (chèque, espèces, virement) #1346

feature/souke
Guillaume Bourgeois pirms 1 gada
vecāks
revīzija
5c5ab69c5c
3 mainītis faili ar 54 papildinājumiem un 5 dzēšanām
  1. +1
    -1
      common/helpers/MeanPayment.php
  2. +9
    -4
      common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php
  3. +44
    -0
      common/logic/Order/Order/Repository/OrderRepository.php

+ 1
- 1
common/helpers/MeanPayment.php Parādīt failu

@@ -67,7 +67,7 @@ class MeanPayment {
}
/**
* etourne tous les moyens de paiement sour forme de tableau.
* Retourne tous les moyens de paiement sour forme de tableau.
*
* @return array
*/

+ 9
- 4
common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php Parādīt failu

@@ -286,9 +286,14 @@ class DistributionReportPdfGenerator extends AbstractGenerator

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

if($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_PAID)
$paymentLabelPaid = $this->orderRepository->getPaymentLabelPaid($order);
if($paymentLabelPaid && strlen($paymentLabelPaid)) {
$html .= '<br />'.$paymentLabelPaid;
}

/*if($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_PAID)
{
$html .= '(débité)' ;
}
@@ -299,9 +304,9 @@ class DistributionReportPdfGenerator extends AbstractGenerator
elseif($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{
$html .= '(surplus : '.$this->orderSolver->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à recréditer)' ;
}
}*/

$html .= '</strong></td>' ;
$html .= '</td>' ;

return $html;
}

+ 44
- 0
common/logic/Order/Order/Repository/OrderRepository.php Parādīt failu

@@ -574,6 +574,50 @@ class OrderRepository extends AbstractRepository
return '<span class="label label-'.$classLabel.'" title="'.$titleLabel.'">'.$label.'</span>';
}

public function getPaymentLabelPaid(Order $order): string
{
$isOrderPaid = $this->isOrderPaid($order);
$amountPaid = $this->orderSolver->getOrderAmountPaid($order);
$amountTotal = $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL);
$label = '';

if($amountPaid > -0.01 && $amountPaid < 0.01) {
if ($isOrderPaid && $amountTotal != 0) {
$label = 'Facture payée';
}
}
else {
$mainPayment = $this->getMainPayment($order);
if($mainPayment) {
if($this->paymentSolver->isMeanPaymentCredit($mainPayment)) {
$label = 'Crédit débité';
}
else {
$strMeanPayment = strtolower(MeanPayment::getStrBy($mainPayment->mean_payment));
if(in_array($mainPayment->mean_payment, [MeanPayment::CHEQUE, MeanPayment::CREDIT_CARD, MeanPayment::TRANSFER])) {
$label = 'Payé par '.$strMeanPayment;
}
elseif($mainPayment->mean_payment == MeanPayment::MONEY) {
$label = 'Payé en '.$strMeanPayment;
}
elseif($mainPayment->mean_payment == MeanPayment::OTHER) {
$label = 'Payé ('.$strMeanPayment.')';
}
}

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

return $label;
}

public function isOrderCreditFunctioningMandatory(Order $order): bool
{
$pointSale = $order->pointSale;

Notiek ielāde…
Atcelt
Saglabāt