|
|
|
|
|
|
|
|
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; |