public function buildAjaxInfosResponsePointsSale(Distribution $distribution) | public function buildAjaxInfosResponsePointsSale(Distribution $distribution) | ||||
{ | { | ||||
$producerManager = $this->getProducerManager(); | |||||
$pointSaleManager = $this->getPointSaleManager(); | $pointSaleManager = $this->getPointSaleManager(); | ||||
$pointSaleDistributionManager = $this->getPointSaleDistributionManager(); | $pointSaleDistributionManager = $this->getPointSaleDistributionManager(); | ||||
] | ] | ||||
]; | ]; | ||||
} | } | ||||
$pointSaleArray['credit_functioning'] = $producerManager->getPointSaleCreditFunctioning($pointSale); | |||||
} | } | ||||
return $pointsSaleArray; | return $pointsSaleArray; | ||||
$jsonProduct['quantity_ordered'] = $quantityOrder; | $jsonProduct['quantity_ordered'] = $quantityOrder; | ||||
if (!isset($product->productDistribution[0])) { | if (!isset($product->productDistribution[0])) { | ||||
$jsonProduct['productDistribution'][0] = $distributionManager->addProduct($distribution, $product)->getAttributes(); | |||||
$productDistributionAdd = $distributionManager->addProduct($distribution, $product); | |||||
$jsonProduct['productDistribution'][0] = $productDistributionAdd->getAttributes(); | |||||
$product->populateRelation('productDistribution', [$productDistributionAdd]); | |||||
} | } | ||||
else { | else { | ||||
foreach($product->productDistribution as $key => $productDistribution) { | foreach($product->productDistribution as $key => $productDistribution) { | ||||
'date' => date('d/m/Y H:i:s', strtotime($payment->date)), | 'date' => date('d/m/Y H:i:s', strtotime($payment->date)), | ||||
'user' => $payment->getUserObject() ? $userManager->getUsername($payment->getUserObject()) : '', | 'user' => $payment->getUserObject() ? $userManager->getUsername($payment->getUserObject()) : '', | ||||
'user_action' => $paymentManager->getStrUserAction($payment), | 'user_action' => $paymentManager->getStrUserAction($payment), | ||||
'wording' => $paymentManager->getStrWording($payment), | |||||
'wording' => $paymentManager->getStrWording($payment, $order), | |||||
'amount' => $paymentManager->getAmount($payment, Order::AMOUNT_TOTAL, true), | 'amount' => $paymentManager->getAmount($payment, Order::AMOUNT_TOTAL, true), | ||||
]; | ]; | ||||
} | } | ||||
'isCreditAutoPayment' => $orderManager->isCreditAutoPayment($order), | 'isCreditAutoPayment' => $orderManager->isCreditAutoPayment($order), | ||||
'isCreditContext' => $orderManager->isCreditContext($order), | 'isCreditContext' => $orderManager->isCreditContext($order), | ||||
'isPaid' => $orderManager->isOrderPaid($order), | 'isPaid' => $orderManager->isOrderPaid($order), | ||||
'isPaidViaInvoice' => $orderManager->isOrderPaidViaInvoice($order), | |||||
'paymentLabelShort' => $orderManager->getPaymentLabelShort($order) | 'paymentLabelShort' => $orderManager->getPaymentLabelShort($order) | ||||
]); | ]); | ||||
} | } |
if($documentManager->isDocumentInvoice($document) && $documentManager->isStatusValid($document)) { | if($documentManager->isDocumentInvoice($document) && $documentManager->isStatusValid($document)) { | ||||
$payment = $paymentManager->instanciatePayment( | $payment = $paymentManager->instanciatePayment( | ||||
Payment::TYPE_PAYMENT, | Payment::TYPE_PAYMENT, | ||||
$documentManager->getAmountWithTax($document), | |||||
number_format($documentManager->getAmountWithTax($document), 3), | |||||
$this->getProducerCurrent(), | $this->getProducerCurrent(), | ||||
null, | null, | ||||
null, | null, | ||||
null, | null, | ||||
$document | $document | ||||
); | ); | ||||
$payment->amount = number_format($payment->amount, 2); | |||||
if ($payment->load(\Yii::$app->request->post()) && $payment->save()) { | |||||
$posts = \Yii::$app->request->post(); | |||||
if(isset($posts['Payment']['date_transaction'])) { | |||||
$posts['Payment']['date_transaction'] = date('Y-m-d', strtotime(str_replace('/', '-', $posts['Payment']['date_transaction']))); | |||||
} | |||||
if ($payment->load($posts) && $payment->save()) { | |||||
$this->setFlash('success', 'Le règlement a bien été ajouté.'); | $this->setFlash('success', 'Le règlement a bien été ajouté.'); | ||||
return $this->redirect(['invoice/update', 'id' => $document->id]); | return $this->redirect(['invoice/update', 'id' => $document->id]); | ||||
} | } | ||||
else { | |||||
if($payment->date_transaction) { | |||||
$payment->date_transaction = date('d/m/Y', strtotime($payment->date_transaction)); | |||||
} | |||||
} | |||||
} | } | ||||
return $this->render('/document/update', [ | return $this->render('/document/update', [ |
public function actionUpdateOpendistribVersion() | public function actionUpdateOpendistribVersion() | ||||
{ | { | ||||
$producerManager = $this->getProducerManager(); | $producerManager = $this->getProducerManager(); | ||||
$producerManager->updateOpendistribVersion(GlobalParam::getCurrentProducer()); | |||||
$producerManager->updateOpendistribVersion($this->getProducerCurrent()); | |||||
return $this->redirect(\Yii::$app->request->referrer); | return $this->redirect(\Yii::$app->request->referrer); | ||||
} | } |
<th class="column-amount">Montant</th> | <th class="column-amount">Montant</th> | ||||
<th class="column-state-payment">Paiement</th> | <th class="column-state-payment">Paiement</th> | ||||
<th class="column-credit" v-if="!pointSaleActive || (pointSaleActive && pointSaleActive.credit == 1)">Crédit</th> | <th class="column-credit" v-if="!pointSaleActive || (pointSaleActive && pointSaleActive.credit == 1)">Crédit</th> | ||||
<th class="column-payment"></th> | |||||
<th class="column-actions">Actions</th> | |||||
<th class="column-tiller" v-if="producer && producer.tiller">Tiller</th> | <th class="column-tiller" v-if="producer && producer.tiller">Tiller</th> | ||||
<th class="column-actions"></th> | |||||
<th class="column-delivery-note"></th> | |||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
</td> | </td> | ||||
<td class="column-state-payment"> | <td class="column-state-payment"> | ||||
<order-state-payment :order="order" :producer="producer"></order-state-payment> | <order-state-payment :order="order" :producer="producer"></order-state-payment> | ||||
<span class="glyphicon glyphicon-time" title="Débit automatique du crédit la veille de la distribution" v-if="order.auto_payment && (order.amount_paid == 0 || order.amount_paid < order.amount)"></span> | |||||
</td> | </td> | ||||
<td class="column-credit" v-if="!pointSaleActive || (pointSaleActive && pointSaleActive.credit == 1)"> | <td class="column-credit" v-if="!pointSaleActive || (pointSaleActive && pointSaleActive.credit == 1)"> | ||||
<template v-if="order.isCreditContext"> | <template v-if="order.isCreditContext"> | ||||
<a :href="baseUrl+'/user/credit?id='+order.id_user" :class="order.user.credit >= 0 ? 'positive' : 'negative'"> | <a :href="baseUrl+'/user/credit?id='+order.id_user" :class="order.user.credit >= 0 ? 'positive' : 'negative'"> | ||||
{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }} | {{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }} | ||||
</a> | </a> | ||||
<span class="glyphicon glyphicon-time" title="Paiement automatique la veille de la distribution" v-if="order.auto_payment && (order.amount_paid == 0 || order.amount_paid < order.amount)"></span> | |||||
</template> | </template> | ||||
</td> | </td> | ||||
<td class="column-payment" v-if="producer && producer.credit"> | |||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |||||
Paiement <span class="caret"></span> | |||||
</button> | |||||
<ul class="dropdown-menu"> | |||||
<li v-if="order.isCreditContext"> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="credit"> | |||||
{{ getLabelPaymentRefund(order, 'Débiter', 'Recréditer', 'le crédit') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="money"> | |||||
{{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'en espèce') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="cheque"> | |||||
{{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par chèque') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="transfer"> | |||||
{{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par virement') }} | |||||
</a> | |||||
</li> | |||||
<!--<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="credit-card"> | |||||
{{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par carte bancaire') }} | |||||
</a> | |||||
</li>--> | |||||
<li><a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">Historique</a></li> | |||||
</ul> | |||||
<td class="column-payment" v-if="false && producer && producer.credit"> | |||||
<!--<div class="btn-group" v-if="order.user && !order.date_delete"> | <!--<div class="btn-group" v-if="order.user && !order.date_delete"> | ||||
<button class="btn btn-xs btn-default" v-if="order.amount_paid == order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount"> | <button class="btn btn-xs btn-default" v-if="order.amount_paid == order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount"> | ||||
<span class="glyphicon glyphicon-euro"></span> Recréditer | <span class="glyphicon glyphicon-euro"></span> Recréditer | ||||
</ul> | </ul> | ||||
</div>--> | </div>--> | ||||
</td> | </td> | ||||
<td v-if="producer && producer.tiller" class="tiller column-tiller"> | |||||
<input v-if="order.tiller_synchronization == true" type="checkbox" checked="checked" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||||
<input v-else type="checkbox" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||||
<label :for="'checkbox-tiller-synchronization-'+order.id">Tiller</label> | |||||
</td> | |||||
<td class="column-actions"> | <td class="column-actions"> | ||||
<span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span> | |||||
<span v-if="false && order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span> | |||||
<a href="javascript:void(0);" class="btn btn-default btn-xs" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></a> | |||||
<a href="javascript:void(0);" class="btn btn-default btn-xs" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></a> | |||||
<div class="wrapper-button-dropdown"> | |||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |||||
€ <span class="caret"></span> | |||||
</button> | |||||
<ul class="dropdown-menu"> | |||||
<template v-if="!order.isPaidViaInvoice"> | |||||
<li v-if="order.isCreditContext"> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="credit"> | |||||
<span class="glyphicon glyphicon-piggy-bank"></span> {{ getLabelPaymentRefund(order, 'Débiter', 'Recréditer', 'le crédit') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="money"> | |||||
<span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'en espèce') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="cheque"> | |||||
<span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par chèque') }} | |||||
</a> | |||||
</li> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="transfer"> | |||||
<span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par virement') }} | |||||
</a> | |||||
</li> | |||||
</template> | |||||
<!--<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="credit-card"> | |||||
{{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par carte bancaire') }} | |||||
</a> | |||||
</li>--> | |||||
<li> | |||||
<a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id"> | |||||
<span class="glyphicon glyphicon-th-list"></span> Historique | |||||
</a> | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
<div class="wrapper-button-dropdown"> | |||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||||
Action <span class="caret"></span> | |||||
<span class="glyphicon glyphicon-file"></span> <template v-if="countDocuments(order)">{{ countDocuments(order) }}</template> <span class="caret"></span> | |||||
</button> | </button> | ||||
<ul class="dropdown-menu"> | <ul class="dropdown-menu"> | ||||
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span> Voir</a></li> | |||||
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span> Modifier</a></li> | |||||
<li v-if="!order.id_delivery_note"> | |||||
<a href="javascript:void(0);" class="" :data-id-order="order.id" @click="generateDeliveryNote"> | |||||
<span class="glyphicon glyphicon-plus"></span> Générer un bon de livraison | |||||
</a> | |||||
</li> | |||||
<li v-if="order.id_quotation"> | |||||
<a :href="UrlManager.getBaseUrl()+'quotation/update?id='+order.id_quotation"> | |||||
<span class="glyphicon glyphicon-file"></span> Devis | |||||
</a> | |||||
</li> | |||||
<li v-if="order.id_delivery_note"> | |||||
<a :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+order.id_delivery_note"> | |||||
<span class="glyphicon glyphicon-file"></span> Bon de livraison | |||||
</a> | |||||
</li> | |||||
<li v-if="order.id_invoice"> | |||||
<a :href="UrlManager.getBaseUrl()+'invoice/update?id='+order.id_invoice"> | |||||
<span class="glyphicon glyphicon-file"></span> Facture | |||||
</a> | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
<div class="wrapper-button-dropdown"> | |||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |||||
<span class="caret"></span> | |||||
</button> | |||||
<ul class="dropdown-menu"> | |||||
<!--<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span> Voir</a></li> | |||||
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span> Modifier</a></li>--> | |||||
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li> | <li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li> | ||||
<li><a href="javascript:void(0);" class="" :data-id-order="order.id" @click="generateDeliveryNote"><span class="glyphicon glyphicon-file"></span> Générer un bon de livraison</a></li> | |||||
<li v-if="order.id_subscription > 0"><a class="" :href="baseUrl+'/subscription/update?id='+order.id_subscription"><span class="glyphicon glyphicon-repeat"></span> Modifier l'abonnement associé</a></li> | |||||
<li v-else><a class="add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id"><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span>Créer un abonnement sur cette base</a></li> | |||||
<li v-if="order.id_subscription > 0"><a class="" :href="baseUrl+'/subscription/update?id='+order.id_subscription"><span class="glyphicon glyphicon-repeat"></span> Modifier l'abonnement lié</a></li> | |||||
<li v-else><a class="add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id"><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span>Créer un abonnement</a></li> | |||||
</ul> | </ul> | ||||
</div> | |||||
<order-form | <order-form | ||||
v-if="showModalFormOrderUpdate && idOrderUpdate == order.id" | v-if="showModalFormOrderUpdate && idOrderUpdate == order.id" | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-md-12"> | <div class="col-md-12"> | ||||
<h4>Historique</h4> | |||||
<h4>Historique paiements</h4> | |||||
<table class="table table-condensed table-bordered table-hover" v-if="order.paymentsArray && order.paymentsArray.length > 0"> | <table class="table table-condensed table-bordered table-hover" v-if="order.paymentsArray && order.paymentsArray.length > 0"> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
<div class="alert alert-info" v-else> | <div class="alert alert-info" v-else> | ||||
Aucun paiement enregistré sur cette commande. | |||||
Aucun paiement rattaché à commande. | |||||
</div> | |||||
<div class="alert alert-success" v-if="order.isPaidViaInvoice"> | |||||
La commande est payée via la <a :href="UrlManager.getBaseUrl()+'invoice/update?id='+order.id_invoice">facture</a> à laquelle elle est rattachée. | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</modal> | </modal> | ||||
</td> | </td> | ||||
<td class="column-delivery-note"> | |||||
<a v-if="order.id_delivery_note" class="btn btn-default btn-xs" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+order.id_delivery_note"> | |||||
<span class="glyphicon glyphicon-file"></span> BL | |||||
</a> | |||||
<a v-if="order.id_invoice" class="btn btn-default btn-xs" :href="UrlManager.getBaseUrl()+'invoice/update?id='+order.id_invoice"> | |||||
<span class="glyphicon glyphicon-file"></span> FA | |||||
</a> | |||||
<td v-if="producer && producer.tiller" class="tiller column-tiller"> | |||||
<input v-if="order.tiller_synchronization == true" type="checkbox" checked="checked" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||||
<input v-else type="checkbox" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||||
<label :for="'checkbox-tiller-synchronization-'+order.id">Tiller</label> | |||||
</td> | </td> | ||||
</tr> | </tr> | ||||
<tr class="view" v-if="showViewProduct && idOrderView == order.id"> | <tr class="view" v-if="showViewProduct && idOrderView == order.id"> | ||||
<script type="text/x-template" id="order-state-payment"> | <script type="text/x-template" id="order-state-payment"> | ||||
<span class="label label-success" v-if="order.isPaid" v-html="order.paymentLabelShort"></span> | |||||
<span class="label label-default" v-else v-html="order.paymentLabelShort"></span> | |||||
<span v-html="order.paymentLabelShort"></span> | |||||
<!--<span class="glyphicon glyphicon-signal" title="Paiement partiel ou surplus" v-if="order.amount_paid > order.amount || order.amount_paid < order.amount"></span>--> | <!--<span class="glyphicon glyphicon-signal" title="Paiement partiel ou surplus" v-if="order.amount_paid > order.amount || order.amount_paid < order.amount"></span>--> | ||||
</select> | </select> | ||||
</div> | </div> | ||||
<div class="form-group"> | <div class="form-group"> | ||||
<label class="control-label" for="select-mean-payment">Moyen de paiement</label> | |||||
<!--<label class="control-label" for="select-mean-payment">Moyen de paiement</label> | |||||
<select class="form-control" id="select-mean-payment" v-model="order.mean_payment"> | <select class="form-control" id="select-mean-payment" v-model="order.mean_payment"> | ||||
<option value="0">--</option> | <option value="0">--</option> | ||||
<option v-for="(wordingMeanPayment, keyMeanPayment) in meansPayment" :value="keyMeanPayment">{{ wordingMeanPayment }}</option> | <option v-for="(wordingMeanPayment, keyMeanPayment) in meansPayment" :value="keyMeanPayment">{{ wordingMeanPayment }}</option> | ||||
</select> | |||||
</select>--> | |||||
</div> | </div> | ||||
<div class="form-group"> | <div class="form-group"> | ||||
<label class="control-label" for="textarea-comment">Commentaire</label> | <label class="control-label" for="textarea-comment">Commentaire</label> | ||||
<span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span> | <span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span> | ||||
<span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span> | <span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span> | ||||
<span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à débiter</span> | <span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à débiter</span> | ||||
<span class="glyphicon glyphicon-time" title="Paiement automatique" v-if="order.auto_payment && producer && producer.credit && (order.amount_paid == 0 || order.amount_paid < order.amount)"></span> | |||||
</div> | |||||
</div> | |||||
</script> | </script> | ||||
<!-- template for the modal component --> | <!-- template for the modal component --> |
<div class="info-box-content"> | <div class="info-box-content"> | ||||
<span class="info-box-text"> | <span class="info-box-text"> | ||||
Total<span v-if="taxRateProducer != 0"> (TTC)</span> | Total<span v-if="taxRateProducer != 0"> (TTC)</span> | ||||
<?php if($invoiceManager->isInvoicePaid($model)): ?> | |||||
<?php if($invoiceManager->isDocumentInvoice($model) && $invoiceManager->isInvoicePaid($model)): ?> | |||||
<span class="label label-success">PAYÉE</span> | <span class="label label-success">PAYÉE</span> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
</span> | </span> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th>Moyen de paiement</th> | <th>Moyen de paiement</th> | ||||
<th>Date transaction</th> | |||||
<th>Montant</th> | <th>Montant</th> | ||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<?php foreach($model->payments as $payment): ?> | <?php foreach($model->payments as $payment): ?> | ||||
<tr> | <tr> | ||||
<td><?= $paymentManager->getStrMeanPayment($payment); ?></td> | <td><?= $paymentManager->getStrMeanPayment($payment); ?></td> | ||||
<td><?= $payment->date_transaction ? date('d/m/Y', strtotime($payment->date_transaction)) : '' ?></td> | |||||
<td><?= Price::format($payment->amount); ?></td> | <td><?= Price::format($payment->amount); ?></td> | ||||
</tr> | </tr> | ||||
<?php endforeach; ?> | <?php endforeach; ?> | ||||
</table> | </table> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<?php if(!$invoiceManager->isInvoicePaid($model)): ?> | |||||
<?php if($invoiceManager->isDocumentInvoice($model) && !$invoiceManager->isInvoicePaid($model)): ?> | |||||
<div class="row"> | <div class="row"> | ||||
<?php $form = ActiveForm::begin(); ?> | <?php $form = ActiveForm::begin(); ?> | ||||
<div class="col-md-4"> | |||||
<div class="col-md-3"> | |||||
<?= $form->field($payment, 'mean_payment')->dropDownList(MeanPayment::getAll()); ?> | <?= $form->field($payment, 'mean_payment')->dropDownList(MeanPayment::getAll()); ?> | ||||
</div> | </div> | ||||
<div class="col-md-4"> | |||||
<?= $form->field($payment, 'amount')->textInput(); ?> | |||||
<div class="col-md-3"> | |||||
<?= $form->field($payment, 'date_transaction')->textInput([ | |||||
'class' => 'datepicker form-control' | |||||
]); ?> | |||||
</div> | </div> | ||||
<div class="col-md-4"> | |||||
<div class="col-md-3"> | |||||
<?= $form->field($payment, 'amount', [ | |||||
'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}', | |||||
])->textInput(); ?> | |||||
</div> | |||||
<div class="col-md-3"> | |||||
<div class="form-group"> | <div class="form-group"> | ||||
<br> | <br> | ||||
<?= Html::submitButton('Ajouter', ['class' => 'btn btn-primary']) ?> | <?= Html::submitButton('Ajouter', ['class' => 'btn btn-primary']) ?> |
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function ($invoice) use ($invoiceManager) { | 'value' => function ($invoice) use ($invoiceManager) { | ||||
$amountWithTax = $invoiceManager->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL); | $amountWithTax = $invoiceManager->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL); | ||||
$html = $invoiceManager->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL, true); | |||||
return $invoiceManager->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL, true); | |||||
} | |||||
], | |||||
[ | |||||
'header' => 'Payée', | |||||
'format' => 'raw', | |||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'value' => function ($invoice) use ($invoiceManager) { | |||||
$amountWithTax = $invoiceManager->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL); | |||||
if($amountWithTax && $invoiceManager->isInvoicePaid($invoice)) { | if($amountWithTax && $invoiceManager->isInvoicePaid($invoice)) { | ||||
$html .= ' <span class="label label-success">Payée</span>'; | |||||
return '<span class="label label-success">Oui</span>'; | |||||
} | } | ||||
return $html; | |||||
return '<span class="label label-default">Non</span>'; | |||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'attribute' => 'is_sent', | 'attribute' => 'is_sent', | ||||
'header' => 'Envoyé', | |||||
'header' => 'Envoyée', | |||||
'format' => 'raw', | 'format' => 'raw', | ||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | 'headerOptions' => ['class' => 'column-hide-on-mobile'], | ||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | 'filterOptions' => ['class' => 'column-hide-on-mobile'], | ||||
if ($model->is_sent) { | if ($model->is_sent) { | ||||
return '<span class="label label-success">Oui</span>'; | return '<span class="label label-success">Oui</span>'; | ||||
} else { | } else { | ||||
return '<span class="label label-danger">Non</span>'; | |||||
return '<span class="label label-default">Non</span>'; | |||||
} | } | ||||
} | } | ||||
], | ], |
} | } | ||||
/* line 279, ../sass/_adminlte.scss */ | /* line 279, ../sass/_adminlte.scss */ | ||||
body.skin-black .content-wrapper .table th.column-actions, body.skin-black .content-wrapper .table td.column-actions { | body.skin-black .content-wrapper .table th.column-actions, body.skin-black .content-wrapper .table td.column-actions { | ||||
width: 150px; | |||||
width: 172px; | |||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 283, ../sass/_adminlte.scss */ | /* line 283, ../sass/_adminlte.scss */ | ||||
font-style: italic; | font-style: italic; | ||||
} | } | ||||
/* line 278, ../sass/distribution/_index.scss */ | /* line 278, ../sass/distribution/_index.scss */ | ||||
.distribution-index #orders table td.column-delivery-note { | |||||
position: relative; | |||||
} | |||||
/* line 282, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.tiller { | .distribution-index #orders table td.tiller { | ||||
width: 60px; | width: 60px; | ||||
} | } | ||||
/* line 281, ../sass/distribution/_index.scss */ | |||||
/* line 285, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.tiller label { | .distribution-index #orders table td.tiller label { | ||||
font-size: 12px; | font-size: 12px; | ||||
cursor: pointer; | cursor: pointer; | ||||
top: -2px; | top: -2px; | ||||
font-weight: normal; | font-weight: normal; | ||||
} | } | ||||
/* line 290, ../sass/distribution/_index.scss */ | |||||
/* line 294, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions { | .distribution-index #orders table td.column-actions { | ||||
position: relative; | position: relative; | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 294, ../sass/distribution/_index.scss */ | |||||
/* line 298, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions .wrapper-button-dropdown { | |||||
display: inline-block; | |||||
} | |||||
/* line 302, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions .dropdown-menu { | .distribution-index #orders table td.column-actions .dropdown-menu { | ||||
top: 0px; | |||||
right: 0px; | |||||
left: -70px; | |||||
width: 227px; | |||||
} | } | ||||
/* line 299, ../sass/distribution/_index.scss */ | |||||
/* line 307, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions .modal-form-order, | .distribution-index #orders table td.column-actions .modal-form-order, | ||||
.distribution-index #orders table td.column-actions .modal-payment { | .distribution-index #orders table td.column-actions .modal-payment { | ||||
text-align: left; | text-align: left; | ||||
} | } | ||||
/* line 304, ../sass/distribution/_index.scss */ | |||||
/* line 312, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions .add-subscription { | .distribution-index #orders table td.column-actions .add-subscription { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 307, ../sass/distribution/_index.scss */ | |||||
/* line 315, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { | .distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { | ||||
position: absolute; | position: absolute; | ||||
top: 4px; | top: 4px; | ||||
right: 4px; | right: 4px; | ||||
font-size: 7px; | font-size: 7px; | ||||
} | } | ||||
/* line 316, ../sass/distribution/_index.scss */ | |||||
/* line 324, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-state-payment { | .distribution-index #orders table td.column-state-payment { | ||||
width: 120px; | |||||
width: 133px; | |||||
} | } | ||||
/* line 322, ../sass/distribution/_index.scss */ | |||||
/* line 330, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-credit a.positive { | .distribution-index #orders table td.column-credit a.positive { | ||||
color: green; | color: green; | ||||
} | } | ||||
/* line 325, ../sass/distribution/_index.scss */ | |||||
/* line 333, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-credit a.negative { | .distribution-index #orders table td.column-credit a.negative { | ||||
color: red; | color: red; | ||||
} | } | ||||
/* line 331, ../sass/distribution/_index.scss */ | |||||
/* line 339, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table .state-payment-mobile { | .distribution-index #orders table .state-payment-mobile { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 335, ../sass/distribution/_index.scss */ | |||||
/* line 343, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-payment { | .distribution-index #orders table td.column-payment { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 338, ../sass/distribution/_index.scss */ | |||||
/* line 346, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-payment div.btn-group { | .distribution-index #orders table td.column-payment div.btn-group { | ||||
width: 125px; | width: 125px; | ||||
} | } | ||||
/* line 344, ../sass/distribution/_index.scss */ | |||||
/* line 352, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table tr.view ul { | .distribution-index #orders table tr.view ul { | ||||
list-style-type: none; | list-style-type: none; | ||||
margin-left: 0px; | margin-left: 0px; | ||||
padding-left: 15px; | padding-left: 15px; | ||||
} | } | ||||
/* line 354, ../sass/distribution/_index.scss */ | |||||
/* line 362, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table tr.view .comment { | .distribution-index #orders table tr.view .comment { | ||||
margin-top: 20px; | margin-top: 20px; | ||||
} | } | ||||
/* line 358, ../sass/distribution/_index.scss */ | |||||
/* line 366, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table tr.view .delivery { | .distribution-index #orders table tr.view .delivery { | ||||
margin-top: 20px; | margin-top: 20px; | ||||
} | } | ||||
/* line 367, ../sass/distribution/_index.scss */ | |||||
/* line 375, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container { | .distribution-index .modal-form-order .modal-container { | ||||
width: 100%; | width: 100%; | ||||
padding: 0px; | padding: 0px; | ||||
} | } | ||||
/* line 371, ../sass/distribution/_index.scss */ | |||||
/* line 379, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container .modal-body { | .distribution-index .modal-form-order .modal-container .modal-body { | ||||
padding-right: 15px; | padding-right: 15px; | ||||
} | } | ||||
/* line 374, ../sass/distribution/_index.scss */ | |||||
/* line 382, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container .modal-body table { | .distribution-index .modal-form-order .modal-container .modal-body table { | ||||
margin-bottom: 150px; | margin-bottom: 150px; | ||||
} | } | ||||
/* line 379, ../sass/distribution/_index.scss */ | |||||
/* line 387, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container .modal-footer { | .distribution-index .modal-form-order .modal-container .modal-footer { | ||||
border-top-color: #f4f4f4; | border-top-color: #f4f4f4; | ||||
position: fixed; | position: fixed; | ||||
text-align: center; | text-align: center; | ||||
border-top: solid 1px #e0e0e0; | border-top: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 391, ../sass/distribution/_index.scss */ | |||||
/* line 399, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button { | .distribution-index .modal-form-order .modal-container .modal-footer .actions-form button { | ||||
float: none; | float: none; | ||||
} | } | ||||
/* line 395, ../sass/distribution/_index.scss */ | |||||
/* line 403, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form div.right { | .distribution-index .modal-form-order .modal-container .modal-footer .actions-form div.right { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 402, ../sass/distribution/_index.scss */ | |||||
/* line 410, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .btn-credit { | .distribution-index .modal-form-order .btn-credit { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 408, ../sass/distribution/_index.scss */ | |||||
/* line 416, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products .product-ordered td { | .distribution-index .modal-form-order table.table-products .product-ordered td { | ||||
background-color: #e9e9e9; | background-color: #e9e9e9; | ||||
} | } | ||||
/* line 412, ../sass/distribution/_index.scss */ | |||||
/* line 420, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products .product-ordered input.input-quantity { | .distribution-index .modal-form-order table.table-products .product-ordered input.input-quantity { | ||||
font-size: 16px; | font-size: 16px; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 418, ../sass/distribution/_index.scss */ | |||||
/* line 426, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.price { | .distribution-index .modal-form-order table.table-products td.price { | ||||
width: 150px; | width: 150px; | ||||
} | } | ||||
/* line 421, ../sass/distribution/_index.scss */ | |||||
/* line 429, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.price input { | .distribution-index .modal-form-order table.table-products td.price input { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 425, ../sass/distribution/_index.scss */ | |||||
/* line 433, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.price .input-group-addon { | .distribution-index .modal-form-order table.table-products td.price .input-group-addon { | ||||
background-color: #eee; | background-color: #eee; | ||||
} | } | ||||
/* line 429, ../sass/distribution/_index.scss */ | |||||
/* line 437, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.price .invoice-price { | .distribution-index .modal-form-order table.table-products td.price .invoice-price { | ||||
margin-top: 8px; | margin-top: 8px; | ||||
} | } | ||||
/* line 431, ../sass/distribution/_index.scss */ | |||||
/* line 439, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price { | .distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price { | ||||
font-size: 11px; | font-size: 11px; | ||||
font-weight: bold; | font-weight: bold; | ||||
color: gray; | color: gray; | ||||
} | } | ||||
/* line 439, ../sass/distribution/_index.scss */ | |||||
/* line 447, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity { | .distribution-index .modal-form-order table.table-products td.quantity { | ||||
width: 165px; | width: 165px; | ||||
} | } | ||||
/* line 442, ../sass/distribution/_index.scss */ | |||||
/* line 450, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity input { | .distribution-index .modal-form-order table.table-products td.quantity input { | ||||
text-align: center; | text-align: center; | ||||
color: black; | color: black; | ||||
} | } | ||||
/* line 447, ../sass/distribution/_index.scss */ | |||||
/* line 455, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity .form-control { | .distribution-index .modal-form-order table.table-products td.quantity .form-control { | ||||
border-right: 0px none; | border-right: 0px none; | ||||
padding-right: 4px; | padding-right: 4px; | ||||
} | } | ||||
/* line 452, ../sass/distribution/_index.scss */ | |||||
/* line 460, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { | .distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { | ||||
padding: 5px; | padding: 5px; | ||||
padding-left: 0px; | padding-left: 0px; | ||||
border-left: 0px none; | border-left: 0px none; | ||||
border-right: 0px none; | border-right: 0px none; | ||||
} | } | ||||
/* line 461, ../sass/distribution/_index.scss */ | |||||
/* line 469, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity-remaining { | .distribution-index .modal-form-order table.table-products td.quantity-remaining { | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 464, ../sass/distribution/_index.scss */ | |||||
/* line 472, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite { | .distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite { | ||||
color: #00A65A; | color: #00A65A; | ||||
} | } | ||||
/* line 468, ../sass/distribution/_index.scss */ | |||||
/* line 476, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { | .distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { | ||||
color: #DD4B39; | color: #DD4B39; | ||||
} | } | ||||
/* line 472, ../sass/distribution/_index.scss */ | |||||
/* line 480, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty { | .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty { | ||||
font-size: 18px; | font-size: 18px; | ||||
} | } | ||||
/* line 479, ../sass/distribution/_index.scss */ | |||||
/* line 487, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .actions-form button { | .distribution-index .modal-form-order .actions-form button { | ||||
margin-left: 15px; | margin-left: 15px; | ||||
} | } | ||||
/* line 487, ../sass/distribution/_index.scss */ | |||||
/* line 495, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-payment .info-box .info-box-icon { | .distribution-index .modal-payment .info-box .info-box-icon { | ||||
width: 50px; | width: 50px; | ||||
} | } | ||||
/* line 490, ../sass/distribution/_index.scss */ | |||||
/* line 498, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-payment .info-box .info-box-icon i { | .distribution-index .modal-payment .info-box .info-box-icon i { | ||||
font-size: 30px; | font-size: 30px; | ||||
} | } | ||||
/* line 495, ../sass/distribution/_index.scss */ | |||||
/* line 503, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-payment .info-box .info-box-content { | .distribution-index .modal-payment .info-box .info-box-content { | ||||
margin-left: 50px; | margin-left: 50px; | ||||
} | } |
return false; | return false; | ||||
}, | }, | ||||
countDocuments: function(order) { | |||||
var count = 0; | |||||
if(order.id_delivery_note) { | |||||
count ++; | |||||
} | |||||
if(order.id_quotation) { | |||||
count ++; | |||||
} | |||||
if(order.id_invoice) { | |||||
count ++; | |||||
} | |||||
return count; | |||||
} | |||||
}, | }, | ||||
}); | }); | ||||
font-size: 13px ; | font-size: 13px ; | ||||
} | } | ||||
th.column-actions, td.column-actions { | th.column-actions, td.column-actions { | ||||
width: 150px ; | |||||
width: 172px; | |||||
text-align: right ; | text-align: right ; | ||||
} | } | ||||
td.text-small, th.text-small { | td.text-small, th.text-small { |
} | } | ||||
} | } | ||||
td.column-delivery-note { | |||||
position: relative; | |||||
} | |||||
td.tiller { | td.tiller { | ||||
width: 60px; | width: 60px; | ||||
position: relative; | position: relative; | ||||
text-align: right; | text-align: right; | ||||
.wrapper-button-dropdown { | |||||
display: inline-block; | |||||
} | |||||
.dropdown-menu { | .dropdown-menu { | ||||
top: 0px; | |||||
right: 0px; | |||||
left: -70px; | |||||
width: 227px; | |||||
} | } | ||||
.modal-form-order, | .modal-form-order, | ||||
} | } | ||||
td.column-state-payment { | td.column-state-payment { | ||||
width: 120px; | |||||
width: 133px; | |||||
} | } | ||||
td.column-credit { | td.column-credit { |
*/ | */ | ||||
return [ | return [ | ||||
'version' => '23.9.A', | |||||
'version' => '23.9.B', | |||||
'siteName' => 'Opendistrib', | 'siteName' => 'Opendistrib', | ||||
'adminEmail' => 'contact@opendistrib.net', | 'adminEmail' => 'contact@opendistrib.net', | ||||
'supportEmail' => 'contact@opendistrib.net', | 'supportEmail' => 'contact@opendistrib.net', |
self::WITH => [ | self::WITH => [ | ||||
'productOrder', | 'productOrder', | ||||
'productOrder.product', | 'productOrder.product', | ||||
'productOrder.taxRate', | |||||
'pointSale', | |||||
'payment', | 'payment', | ||||
'payment.user', | |||||
'payment.userAction', | 'payment.userAction', | ||||
'pointSale', | |||||
'deliveryNote', | |||||
'invoice', | |||||
'quotation' | |||||
], | ], | ||||
self::JOIN_WITH => [ | self::JOIN_WITH => [ | ||||
'distribution', | 'distribution', | ||||
'user', | 'user', | ||||
'user.userProducer', | 'user.userProducer', | ||||
//'payment' | |||||
], | ], | ||||
self::ORDER_BY => 'order.date ASC', | self::ORDER_BY => 'order.date ASC', | ||||
self::ATTRIBUTE_ID_PRODUCER => 'distribution.id_producer' | self::ATTRIBUTE_ID_PRODUCER => 'distribution.id_producer' | ||||
public function isCreditContext(Order $order) | public function isCreditContext(Order $order) | ||||
{ | { | ||||
if(!$this->producerRepository->getConfig('credit')) { | |||||
return false; | |||||
} | |||||
//$pointSale = $this->pointSaleRepository->findOnePointSaleById($order->id_point_sale); | //$pointSale = $this->pointSaleRepository->findOnePointSaleById($order->id_point_sale); | ||||
$pointSale = $order->pointSale; | $pointSale = $order->pointSale; | ||||
return true; | return true; | ||||
} | } | ||||
return $this->isOrderPaidViaInvoice($order); | |||||
} | |||||
public function isOrderPaidViaInvoice(Order $order): bool | |||||
{ | |||||
if($order->invoice) { | if($order->invoice) { | ||||
$invoice = $this->invoiceRepository->findOneInvoiceById($order->id_invoice); | $invoice = $this->invoiceRepository->findOneInvoiceById($order->id_invoice); | ||||
if($invoice && $this->invoiceSolver->isInvoicePaid($invoice)) { | if($invoice && $this->invoiceSolver->isInvoicePaid($invoice)) { | ||||
{ | { | ||||
$isOrderPaid = $this->isOrderPaid($order); | $isOrderPaid = $this->isOrderPaid($order); | ||||
$amountPaid = $this->orderSolver->getOrderAmountPaid($order); | $amountPaid = $this->orderSolver->getOrderAmountPaid($order); | ||||
$label = ' '; | |||||
if(!$amountPaid) { | if(!$amountPaid) { | ||||
if($isOrderPaid) { | if($isOrderPaid) { | ||||
return 'Facture payée'; | |||||
$label = 'Facture payée'; | |||||
} | } | ||||
elseif($this->isCreditAutoPayment($order)) { | elseif($this->isCreditAutoPayment($order)) { | ||||
return 'Crédit non débité'; | |||||
$label = 'Crédit non débité'; | |||||
} | } | ||||
else { | else { | ||||
return 'Non réglé'; | |||||
$label = 'Non réglé'; | |||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$mainPayment = $this->getMainPayment($order); | $mainPayment = $this->getMainPayment($order); | ||||
if($mainPayment) { | if($mainPayment) { | ||||
if($this->paymentSolver->isMeanPaymentCredit($mainPayment)) { | if($this->paymentSolver->isMeanPaymentCredit($mainPayment)) { | ||||
return 'Crédit débité'; | |||||
$label = 'Crédit débité'; | |||||
} | } | ||||
else { | else { | ||||
return MeanPayment::getStrBy($mainPayment->mean_payment); | |||||
$label = MeanPayment::getStrBy($mainPayment->mean_payment); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
return ' '; | |||||
return '<span class="label label-'.($isOrderPaid ? 'success' : 'default').'">'.$label.'</span>'; | |||||
} | } | ||||
} | } |
*/ | */ | ||||
public function initOrderPaidAmount(Order $order): void | public function initOrderPaidAmount(Order $order): void | ||||
{ | { | ||||
$history = $this->paymentRepository->getByOrder($order); | |||||
$history = $order->payment; | |||||
$order->paid_amount = 0; | $order->paid_amount = 0; | ||||
if ($history && count($history)) { | if ($history && count($history)) { |
public function afterFind() | public function afterFind() | ||||
{ | { | ||||
if ($this->taxRate == null) { | |||||
if(!$this->id_tax_rate) { | |||||
$this->populateRelation('taxRate', GlobalParam::getCurrentProducer()->taxRate); | $this->populateRelation('taxRate', GlobalParam::getCurrentProducer()->taxRate); | ||||
} | } | ||||
parent::afterFind(); | parent::afterFind(); | ||||
} | } | ||||
[['id_user', 'id_user_action', 'id_order', 'id_invoice', 'id_producer'], 'integer'], | [['id_user', 'id_user_action', 'id_order', 'id_invoice', 'id_producer'], 'integer'], | ||||
[['date'], 'safe'], | [['date'], 'safe'], | ||||
[['amount'], 'double'], | [['amount'], 'double'], | ||||
[['date_transaction'], 'date', 'format' => 'php:Y-m-d'], | |||||
[['type', 'mean_payment'], 'string', 'max' => 255], | [['type', 'mean_payment'], 'string', 'max' => 255], | ||||
[['comment'], 'string', 'max' => 2048], | [['comment'], 'string', 'max' => 2048], | ||||
]; | ]; | ||||
'id_producer' => 'Producteur', | 'id_producer' => 'Producteur', | ||||
'mean_payment' => 'Moyen de paiement', | 'mean_payment' => 'Moyen de paiement', | ||||
'comment' => 'Commentaire', | 'comment' => 'Commentaire', | ||||
'date_transaction' => 'Date transaction' | |||||
]; | ]; | ||||
} | } | ||||
public function getDefaultOptionsSearch(): array | public function getDefaultOptionsSearch(): array | ||||
{ | { | ||||
return [ | return [ | ||||
self::WITH => [], | |||||
self::WITH => [ | |||||
'user' | |||||
], | |||||
self::JOIN_WITH => [], | self::JOIN_WITH => [], | ||||
self::ORDER_BY => Payment::tableName() . '.date ASc', | self::ORDER_BY => Payment::tableName() . '.date ASc', | ||||
self::ATTRIBUTE_ID_PRODUCER => Payment::tableName() . '.id_producer' | self::ATTRIBUTE_ID_PRODUCER => Payment::tableName() . '.id_producer' |
use common\helpers\MeanPayment; | use common\helpers\MeanPayment; | ||||
use common\logic\AbstractService; | use common\logic\AbstractService; | ||||
use common\logic\Order\Order\Model\Order; | |||||
use common\logic\Payment\Model\Payment; | use common\logic\Payment\Model\Payment; | ||||
use common\logic\SolverInterface; | use common\logic\SolverInterface; | ||||
* éventuellement de la date de sa commande associée. | * éventuellement de la date de sa commande associée. | ||||
* | * | ||||
*/ | */ | ||||
public function getStrWording(Payment $payment): string | |||||
public function getStrWording(Payment $payment, Order $order = null): string | |||||
{ | { | ||||
$str = ''; | $str = ''; | ||||
$type = $payment->getType(); | $type = $payment->getType(); | ||||
} | } | ||||
if (Payment::TYPE_PAYMENT == $type || Payment::TYPE_REFUND == $type) { | if (Payment::TYPE_PAYMENT == $type || Payment::TYPE_REFUND == $type) { | ||||
$order = $payment->getOrderObject(); | |||||
// Optimisation | |||||
if(!$order) { | |||||
$order = $payment->order; | |||||
} | |||||
if ($order && $order->distribution) { | if ($order && $order->distribution) { | ||||
$str .= '<br />Commande : ' . date('d/m/Y', strtotime($order->distribution->date)); | $str .= '<br />Commande : ' . date('d/m/Y', strtotime($order->distribution->date)); | ||||
} else { | } else { |
$versionsArray = Opendistrib::getVersions(); | $versionsArray = Opendistrib::getVersions(); | ||||
$producer->latest_version_opendistrib = reset($versionsArray); | $producer->latest_version_opendistrib = reset($versionsArray); | ||||
$this->saveUpdate($producer); | |||||
$this->update($producer); | |||||
} | } | ||||
public function savePrivateKeyStripe($filename, $value) | public function savePrivateKeyStripe($filename, $value) |
*/ | */ | ||||
public function getCredit(User $user): float | public function getCredit(User $user): float | ||||
{ | { | ||||
$userProducer = $this->userProducerRepository->findOneUserProducer($user); | |||||
// @TODO : optimisation à refactorer | |||||
$userProducer = null; | |||||
$producerId = $this->getProducerContextId(); | |||||
foreach($user->userProducer as $userProducerRelation) { | |||||
if($userProducerRelation->id_producer == $producerId) { | |||||
$userProducer = $userProducerRelation; | |||||
} | |||||
} | |||||
if(!$userProducer) { | |||||
$userProducer = $this->userProducerRepository->findOneUserProducer($user); | |||||
} | |||||
return $userProducer ? $userProducer->credit : 0; | return $userProducer ? $userProducer->credit : 0; | ||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
/** | |||||
* Class m230920_081923_add_column_payment_date_transaction | |||||
*/ | |||||
class m230920_081923_add_column_payment_date_transaction extends Migration | |||||
{ | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeUp() | |||||
{ | |||||
$this->addColumn('payment', 'date_transaction', Schema::TYPE_DATE); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeDown() | |||||
{ | |||||
$this->dropColumn('payment', 'date_transaction'); | |||||
} | |||||
} |