Bläddra i källkod

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

feature/souke
Guillaume Bourgeois 1 år sedan
förälder
incheckning
5c5ab69c5c
3 ändrade filer med 54 tillägg och 5 borttagningar
  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 Visa fil

} }
/** /**
* etourne tous les moyens de paiement sour forme de tableau.
* Retourne tous les moyens de paiement sour forme de tableau.
* *
* @return array * @return array
*/ */

+ 9
- 4
common/logic/Distribution/Distribution/Service/DistributionReportPdfGenerator.php Visa fil



public function columnOrderAmount(Order $order): string 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é)' ; $html .= '(débité)' ;
} }
elseif($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_SURPLUS) elseif($this->orderSolver->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{ {
$html .= '(surplus : '.$this->orderSolver->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à recréditer)' ; $html .= '(surplus : '.$this->orderSolver->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à recréditer)' ;
}
}*/


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


return $html; return $html;
} }

+ 44
- 0
common/logic/Order/Order/Repository/OrderRepository.php Visa fil

return '<span class="label label-'.$classLabel.'" title="'.$titleLabel.'">'.$label.'</span>'; 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 public function isOrderCreditFunctioningMandatory(Order $order): bool
{ {
$pointSale = $order->pointSale; $pointSale = $order->pointSale;

Laddar…
Avbryt
Spara