'tiller' => $producer->tiller | 'tiller' => $producer->tiller | ||||
]; | ]; | ||||
$json['means_payment'] = MeanPayment::getAll() ; | |||||
$distributionsArray = Distribution::searchAll([ | $distributionsArray = Distribution::searchAll([ | ||||
'active' => 1 | 'active' => 1 | ||||
], [ | ], [ | ||||
if(!$isSynchro) { | if(!$isSynchro) { | ||||
$orders = Order::searchAll([ | $orders = Order::searchAll([ | ||||
'distribution.date' => $date | |||||
'distribution.date' => $date, | |||||
'order.tiller_synchronization' => 1 | |||||
]) ; | ]) ; | ||||
$strDate = date('Y-m-d\T12:i:s+0000', strtotime($date) + 1) ; | $strDate = date('Y-m-d\T12:i:s+0000', strtotime($date) + 1) ; | ||||
] ; | ] ; | ||||
} | } | ||||
$typePaymentTiller = '' ; | |||||
if($order->mean_payment == MeanPayment::MONEY | |||||
|| $order->mean_payment == MeanPayment::CREDIT | |||||
|| $order->mean_payment == MeanPayment::TRANSFER | |||||
|| $order->mean_payment == MeanPayment::OTHER) { | |||||
$typePaymentTiller = 'CASH' ; | |||||
} | |||||
if($order->mean_payment == MeanPayment::CREDIT_CARD) { | |||||
$typePaymentTiller = 'CARD' ; | |||||
} | |||||
if($order->mean_payment == MeanPayment::CHEQUE) { | |||||
$typePaymentTiller = 'BANK_CHECK' ; | |||||
} | |||||
if(!strlen($typePaymentTiller) || !$order->mean_payment) { | |||||
$typePaymentTiller = 'CASH' ; | |||||
} | |||||
$tiller->postOrder([ | $tiller->postOrder([ | ||||
'externalId' => $order->id, | 'externalId' => $order->id, | ||||
'type' => 1, | 'type' => 1, | ||||
'closeDate' => $strDate, | 'closeDate' => $strDate, | ||||
'lines' => $lines, | 'lines' => $lines, | ||||
'payments' => [[ | 'payments' => [[ | ||||
'type' => 'CASH', | |||||
'type' => $typePaymentTiller, | |||||
'amount' => $order->getAmount(Order::AMOUNT_TOTAL) * 100, | 'amount' => $order->getAmount(Order::AMOUNT_TOTAL) * 100, | ||||
'status' => 'ACCEPTED', | 'status' => 'ACCEPTED', | ||||
'date' => $strDate | 'date' => $strDate |
* @param string $processCredit | * @param string $processCredit | ||||
*/ | */ | ||||
public function actionAjaxCreate( | public function actionAjaxCreate( | ||||
$date, $idPointSale, $idUser, $username, $products, $comment, $processCredit = 0) | |||||
$date, $idPointSale, $idUser, $username, $meanPayment, $products, $comment, $processCredit = 0) | |||||
{ | { | ||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | ||||
$order = new Order; | $order = new Order; | ||||
$order->date = date('Y-m-d H:i:s') ; | $order->date = date('Y-m-d H:i:s') ; | ||||
$order->id_point_sale = $idPointSale; | $order->id_point_sale = $idPointSale; | ||||
$order->mean_payment = $meanPayment ; | |||||
$order->id_distribution = $distribution->id; | $order->id_distribution = $distribution->id; | ||||
$order->origin = Order::ORIGIN_ADMIN; | $order->origin = Order::ORIGIN_ADMIN; | ||||
$order->comment = $comment; | $order->comment = $comment; | ||||
* @param string $comment | * @param string $comment | ||||
*/ | */ | ||||
public function actionAjaxUpdate( | public function actionAjaxUpdate( | ||||
$date, $idOrder, $idPointSale, $idUser, $username, $products, $comment = '', $processCredit = 0) | |||||
$date, $idOrder, $idPointSale, $idUser, $username, $meanPayment, $products, $comment = '', $processCredit = 0) | |||||
{ | { | ||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | ||||
$order->id_point_sale = $idPointSale; | $order->id_point_sale = $idPointSale; | ||||
$order->date_update = date('Y-m-d H:i:s'); | $order->date_update = date('Y-m-d H:i:s'); | ||||
$order->mean_payment = $meanPayment; | |||||
$order->comment = $comment; | $order->comment = $comment; | ||||
if ($idUser) { | if ($idUser) { | ||||
return ['success']; | return ['success']; | ||||
} | } | ||||
/** | |||||
* Modifie l'état de la synchronisation Tiller d'une commande. | |||||
* | |||||
* @param int $idOrder | |||||
* @param boolean $boolSynchroTiller | |||||
* @return array | |||||
*/ | |||||
public function actionAjaxChangeSynchroTiller($idOrder, $boolSynchroTiller) | |||||
{ | |||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||||
$order = Order::searchOne([ | |||||
'id' => (int) $idOrder | |||||
]) ; | |||||
if($order) { | |||||
$order->tiller_synchronization = (int) $boolSynchroTiller ; | |||||
$res = $order->save() ; | |||||
return ['success']; | |||||
} | |||||
return ['error']; | |||||
} | |||||
} | } | ||||
de modification et de redistribution accordés par cette licence, il n'est | de modification et de redistribution accordés par cette licence, il n'est | ||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | ||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | seule une responsabilité restreinte pèse sur l'auteur du programme, le | ||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
titulaire des de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | A cet égard l'attention de l'utilisateur est attirée sur les risques | ||||
associés au chargement, à l'utilisation, à la modification et/ou au | associés au chargement, à l'utilisation, à la modification et/ou au | ||||
:date="date" | :date="date" | ||||
:order="orderCreate" | :order="orderCreate" | ||||
:points-sale="pointsSale" | :points-sale="pointsSale" | ||||
:means-payment="meansPayment" | |||||
:users="users" | :users="users" | ||||
:products="products" | :products="products" | ||||
:producer="producer" | :producer="producer" | ||||
</ul> | </ul> | ||||
</div> | </div> | ||||
</td> | </td> | ||||
<td v-if="producer.tiller" class="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="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span> | ||||
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> | <button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> | ||||
:date="date" | :date="date" | ||||
:id-point-sale="idActivePointSale" | :id-point-sale="idActivePointSale" | ||||
:points-sale="pointsSale" | :points-sale="pointsSale" | ||||
:means-payment="meansPayment" | |||||
:users="users" | :users="users" | ||||
:products="products" | :products="products" | ||||
:order="ordersUpdate[key]" | :order="ordersUpdate[key]" | ||||
<div class="form-group"> | <div class="form-group"> | ||||
<label class="control-label" for="select-id-point-sale">Point de vente</label> | <label class="control-label" for="select-id-point-sale">Point de vente</label> | ||||
<select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale"> | <select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale"> | ||||
<option value="0">--</option> | |||||
<option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option> | <option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option> | ||||
</select> | </select> | ||||
</div> | </div> | ||||
<div class="form-group"> | |||||
<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"> | |||||
<option value="0">--</option> | |||||
<option v-for="(wordingMeanPayment, keyMeanPayment) in meansPayment" :value="keyMeanPayment">{{ wordingMeanPayment }}</option> | |||||
</select> | |||||
</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> | ||||
<textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea> | <textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea> |
]) ?> | ]) ?> | ||||
<?= $form->field($creditForm, 'amount')->textInput() ?> | <?= $form->field($creditForm, 'amount')->textInput() ?> | ||||
<?= $form->field($creditForm, 'mean_payment')->dropDownList([ | <?= $form->field($creditForm, 'mean_payment')->dropDownList([ | ||||
CreditHistory::MEAN_PAYMENT_MONEY => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_MONEY), | |||||
CreditHistory::MEAN_PAYMENT_CREDIT_CARD => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CREDIT_CARD), | |||||
CreditHistory::MEAN_PAYMENT_CHEQUE => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CHEQUE), | |||||
CreditHistory::MEAN_PAYMENT_TRANSFER => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_TRANSFER), | |||||
CreditHistory::MEAN_PAYMENT_OTHER => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_OTHER), | |||||
MeanPayment::MONEY => MeanPayment::getStrBy(MeanPayment::MONEY), | |||||
MeanPayment::CREDIT_CARD => MeanPayment::getStrBy(MeanPayment::CREDIT_CARD), | |||||
MeanPayment::CHEQUE => MeanPayment::getStrBy(MeanPayment::CHEQUE), | |||||
MeanPayment::TRANSFER => MeanPayment::getStrBy(MeanPayment::TRANSFER), | |||||
MeanPayment::OTHER => MeanPayment::getStrBy(MeanPayment::OTHER), | |||||
]) ?> | ]) ?> | ||||
<?= $form->field($creditForm, 'comment')->textarea() ?> | <?= $form->field($creditForm, 'comment')->textarea() ?> | ||||
<?= $form->field($creditForm, 'send_mail')->checkbox() ?> | <?= $form->field($creditForm, 'send_mail')->checkbox() ?> |
-webkit-border-radius: 10px; | -webkit-border-radius: 10px; | ||||
border-radius: 10px; | border-radius: 10px; | ||||
} | } | ||||
/* line 206, ../sass/distribution/_index.scss */ | |||||
/* line 207, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.tiller { | |||||
width: 60px; | |||||
} | |||||
/* line 210, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.tiller label { | |||||
font-size: 12px; | |||||
cursor: pointer; | |||||
position: relative; | |||||
top: -2px; | |||||
font-weight: normal; | |||||
} | |||||
/* line 219, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-actions { | .distribution-index #orders table td.column-actions { | ||||
text-align: right; | text-align: right; | ||||
width: 230px; | width: 230px; | ||||
} | } | ||||
/* line 210, ../sass/distribution/_index.scss */ | |||||
/* line 223, ../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 215, ../sass/distribution/_index.scss */ | |||||
/* line 228, ../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 217, ../sass/distribution/_index.scss */ | |||||
/* line 230, ../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 226, ../sass/distribution/_index.scss */ | |||||
/* line 239, ../sass/distribution/_index.scss */ | |||||
.distribution-index #orders table td.column-state-payment { | .distribution-index #orders table td.column-state-payment { | ||||
width: 120px; | width: 120px; | ||||
} | } | ||||
/* line 231, ../sass/distribution/_index.scss */ | |||||
/* line 244, ../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 237, ../sass/distribution/_index.scss */ | |||||
/* line 250, ../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 246, ../sass/distribution/_index.scss */ | |||||
/* line 259, ../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 255, ../sass/distribution/_index.scss */ | |||||
/* line 268, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order .btn-credit { | .distribution-index .modal-form-order .btn-credit { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 261, ../sass/distribution/_index.scss */ | |||||
/* line 274, ../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 265, ../sass/distribution/_index.scss */ | |||||
/* line 278, ../sass/distribution/_index.scss */ | |||||
.distribution-index .modal-form-order table.table-products .product-ordered input { | .distribution-index .modal-form-order table.table-products .product-ordered input { | ||||
font-size: 16px; | font-size: 16px; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 271, ../sass/distribution/_index.scss */ | |||||
/* line 284, ../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 274, ../sass/distribution/_index.scss */ | |||||
/* line 287, ../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 278, ../sass/distribution/_index.scss */ | |||||
/* line 291, ../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 282, ../sass/distribution/_index.scss */ | |||||
/* line 295, ../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 290, ../sass/distribution/_index.scss */ | |||||
/* line 303, ../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 293, ../sass/distribution/_index.scss */ | |||||
/* line 306, ../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 297, ../sass/distribution/_index.scss */ | |||||
/* line 310, ../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 301, ../sass/distribution/_index.scss */ | |||||
/* line 314, ../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 308, ../sass/distribution/_index.scss */ | |||||
/* line 321, ../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 316, ../sass/distribution/_index.scss */ | |||||
/* line 329, ../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 318, ../sass/distribution/_index.scss */ | |||||
/* line 331, ../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 322, ../sass/distribution/_index.scss */ | |||||
/* line 335, ../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; | ||||
} | } |
products: [], | products: [], | ||||
countActiveProducts: 0, | countActiveProducts: 0, | ||||
pointsSale: [], | pointsSale: [], | ||||
meansPayment: [], | |||||
idActivePointSale: 0, | idActivePointSale: 0, | ||||
idDefaultPointSale: 0, | idDefaultPointSale: 0, | ||||
countActivePointsSale: 0, | countActivePointsSale: 0, | ||||
app.producer = response.data.producer ; | app.producer = response.data.producer ; | ||||
app.products = response.data.products ; | app.products = response.data.products ; | ||||
app.initCountActiveProducts() ; | app.initCountActiveProducts() ; | ||||
app.meansPayment = response.data.means_payment ; | |||||
app.oneDistributionWeekActive = response.data.one_distribution_week_active ; | app.oneDistributionWeekActive = response.data.one_distribution_week_active ; | ||||
.then(function(response) { | .then(function(response) { | ||||
app.init(app.idActivePointSale) ; | app.init(app.idActivePointSale) ; | ||||
}) ; | }) ; | ||||
} | |||||
}, | |||||
changeSynchroTiller: function(event) { | |||||
var app = this ; | |||||
var idOrder = event.currentTarget.getAttribute('data-id-order') ; | |||||
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-change-synchro-tiller",{params: { | |||||
idOrder: idOrder, | |||||
boolSynchroTiller: event.currentTarget.checked ? 1 : 0 | |||||
}}) | |||||
.then(function(response) { | |||||
app.init() ; | |||||
}) ; | |||||
}, | |||||
}, | }, | ||||
}); | }); | ||||
}) | }) | ||||
Vue.component('order-form',{ | Vue.component('order-form',{ | ||||
props: ['date', 'pointsSale', 'users', 'products', 'order', 'producer'], | |||||
props: ['date', 'pointsSale','meansPayment', 'users', 'products', 'order', 'producer'], | |||||
data: function() { | data: function() { | ||||
return { | return { | ||||
errors: [], | errors: [], | ||||
idPointSale: this.order.id_point_sale, | idPointSale: this.order.id_point_sale, | ||||
idUser: this.order.id_user, | idUser: this.order.id_user, | ||||
username: this.order.username, | username: this.order.username, | ||||
meanPayment: this.order.mean_payment, | |||||
products: JSON.stringify(this.order.productOrder), | products: JSON.stringify(this.order.productOrder), | ||||
comment: this.order.comment, | comment: this.order.comment, | ||||
processCredit: processCredit | processCredit: processCredit | ||||
+ ('0' + this.date.getDate()).slice(-2), | + ('0' + this.date.getDate()).slice(-2), | ||||
idOrder: this.order.id, | idOrder: this.order.id, | ||||
idPointSale: this.order.id_point_sale, | idPointSale: this.order.id_point_sale, | ||||
meanPayment: this.order.mean_payment, | |||||
idUser: this.order.id_user, | idUser: this.order.id_user, | ||||
username: ''+this.order.username, | username: ''+this.order.username, | ||||
products: JSON.stringify(this.order.productOrder), | products: JSON.stringify(this.order.productOrder), |
table { | table { | ||||
td.tiller { | |||||
width: 60px ; | |||||
label { | |||||
font-size: 12px ; | |||||
cursor: pointer ; | |||||
position: relative ; | |||||
top: -2px ; | |||||
font-weight: normal ; | |||||
} | |||||
} | |||||
td.column-actions { | td.column-actions { | ||||
text-align: right ; | text-align: right ; | ||||
width: 230px ; | width: 230px ; |
<?php | |||||
/** | |||||
Copyright distrib (2018) | |||||
contact@opendistrib.net | |||||
Ce logiciel est un programme informatique servant à aider les producteurs | |||||
à distribuer leur production en circuits courts. | |||||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
sur le site "http://www.cecill.info". | |||||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
de modification et de redistribution accordés par cette licence, il n'est | |||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
associés au chargement, à l'utilisation, à la modification et/ou au | |||||
développement et à la reproduction du logiciel par l'utilisateur étant | |||||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
avertis possédant des connaissances informatiques approfondies. Les | |||||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||||
termes. | |||||
*/ | |||||
namespace common\helpers; | |||||
class MeanPayment { | |||||
const CREDIT = 'credit'; | |||||
const CREDIT_CARD = 'credit-card'; | |||||
const MONEY = 'money'; | |||||
const CHEQUE = 'cheque'; | |||||
const TRANSFER = 'transfer'; | |||||
const OTHER = 'other'; | |||||
/** | |||||
* Retourne le libellé du moyen de paiement. | |||||
* | |||||
* @param string $meanPayment | |||||
* @return string | |||||
*/ | |||||
public static function getStrBy($meanPayment) | |||||
{ | |||||
switch($meanPayment) { | |||||
case self::CREDIT_CARD : return 'Carte bancaire' ; | |||||
case self::MONEY : return 'Espèces' ; | |||||
case self::CHEQUE : return 'Chèque' ; | |||||
case self::TRANSFER : return 'Virement' ; | |||||
case self::OTHER : return 'Autre' ; | |||||
case self::CREDIT : return 'Crédit' ; | |||||
default: return 'Crédit' ; | |||||
} | |||||
} | |||||
/** | |||||
* etourne tous les moyens de paiement sour forme de tableau. | |||||
* | |||||
* @return array | |||||
*/ | |||||
public static function getAll() | |||||
{ | |||||
return [ | |||||
self::CREDIT => self::getStrBy(self::CREDIT), | |||||
self::CREDIT_CARD => self::getStrBy(self::CREDIT_CARD), | |||||
self::MONEY => self::getStrBy(self::MONEY), | |||||
self::CHEQUE => self::getStrBy(self::CHEQUE), | |||||
self::TRANSFER => self::getStrBy(self::TRANSFER), | |||||
self::OTHER => self::getStrBy(self::OTHER), | |||||
self::CREDIT => self::getStrBy(self::CREDIT), | |||||
] ; | |||||
} | |||||
} |
if($this->producer_tiller) { | if($this->producer_tiller) { | ||||
$ordersTiller = $this->getOrders($date) ; | $ordersTiller = $this->getOrders($date) ; | ||||
$ordersOpendistrib = Order::searchAll([ | $ordersOpendistrib = Order::searchAll([ | ||||
'distribution.date' => $date | |||||
'distribution.date' => $date, | |||||
'order.tiller_synchronization' => 1 | |||||
]) ; | ]) ; | ||||
$ordersOpendistribSynchro = [] ; | $ordersOpendistribSynchro = [] ; |
const TYPE_REFUND = 'refund'; | const TYPE_REFUND = 'refund'; | ||||
const TYPE_DEBIT = 'debit'; | const TYPE_DEBIT = 'debit'; | ||||
const MEAN_PAYMENT_CREDIT_CARD = 'credit-card'; | |||||
const MEAN_PAYMENT_MONEY = 'money'; | |||||
const MEAN_PAYMENT_CHEQUE = 'cheque'; | |||||
const MEAN_PAYMENT_TRANSFER = 'transfer'; | |||||
const MEAN_PAYMENT_OTHER = 'other'; | |||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
} elseif ($this->isTypeDebit()) { | } elseif ($this->isTypeDebit()) { | ||||
$userProducer->credit -= $this->amount; | $userProducer->credit -= $this->amount; | ||||
} | } | ||||
$userProducer->save(); | |||||
// set mean payment | |||||
$order = Order::searchOne(['id' => $this->id_order]) ; | |||||
$paymentStatus = $order->getPaymentStatus() ; | |||||
if($paymentStatus == Order::PAYMENT_PAID | |||||
|| $paymentStatus == Order::PAYMENT_SURPLUS) { | |||||
$order->mean_payment = MeanPayment::CREDIT ; | |||||
$order->save() ; | |||||
} | |||||
// seuil limite de crédit | |||||
$newCredit = $userProducer->credit ; | $newCredit = $userProducer->credit ; | ||||
if(!is_null($creditLimitReminder) && | if(!is_null($creditLimitReminder) && | ||||
$oldCredit > $creditLimitReminder && $newCredit <= $creditLimitReminder) { | $oldCredit > $creditLimitReminder && $newCredit <= $creditLimitReminder) { | ||||
->setSubject('[distrib] Seuil limite de crédit dépassé') | ->setSubject('[distrib] Seuil limite de crédit dépassé') | ||||
->send(); | ->send(); | ||||
} | } | ||||
$userProducer->save(); | |||||
} | } | ||||
} | } | ||||
*/ | */ | ||||
public function getStrMeanPayment() | public function getStrMeanPayment() | ||||
{ | { | ||||
return self::getStrMeanPaymentBy($this->mean_payment) ; | |||||
} | |||||
/** | |||||
* Retourne le libellé du moyen de paiement. | |||||
* | |||||
* @param string $meanPayment | |||||
* @return string | |||||
*/ | |||||
public static function getStrMeanPaymentBy($meanPayment) | |||||
{ | |||||
switch($meanPayment) { | |||||
case CreditHistory::MEAN_PAYMENT_MONEY : return 'Espèces' ; | |||||
case CreditHistory::MEAN_PAYMENT_CHEQUE : return 'Chèque' ; | |||||
case CreditHistory::MEAN_PAYMENT_CREDIT_CARD : return 'Carte bancaire' ; | |||||
case CreditHistory::MEAN_PAYMENT_TRANSFER : return 'Virement' ; | |||||
case CreditHistory::MEAN_PAYMENT_OTHER : return 'Autre' ; | |||||
default: return 'Crédit' ; | |||||
} | |||||
return MeanPayment::getStrBy($this->mean_payment) ; | |||||
} | } | ||||
/** | /** |
return [ | return [ | ||||
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], | [['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], | ||||
[['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'], | [['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'], | ||||
[['auto_payment'], 'boolean'], | |||||
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe'] | |||||
[['auto_payment', 'tiller_synchronization'], 'boolean'], | |||||
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe'] | |||||
]; | ]; | ||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\mysql\Schema; | |||||
class m191227_090504_ajout_champs_order_mean_payment extends Migration | |||||
{ | |||||
public function up() | |||||
{ | |||||
$this->addColumn('order', 'mean_payment', Schema::TYPE_STRING) ; | |||||
} | |||||
public function down() | |||||
{ | |||||
$this->dropColumn('order', 'mean_payment') ; | |||||
} | |||||
} |
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\mysql\Schema; | |||||
class m191227_110133_ajout_champs_order_tiller_synchronisation extends Migration | |||||
{ | |||||
public function up() | |||||
{ | |||||
$this->addColumn('order', 'tiller_synchronization', Schema::TYPE_BOOLEAN.' DEFAULT 1') ; | |||||
} | |||||
public function down() | |||||
{ | |||||
$this->dropColumn('order', 'tiller_synchronization') ; | |||||
} | |||||
} |
$creditHistory->type = CreditHistory::TYPE_CREDIT ; | $creditHistory->type = CreditHistory::TYPE_CREDIT ; | ||||
$creditHistory->comment = '' ; | $creditHistory->comment = '' ; | ||||
$creditHistory->amount = $resource->amount ; | $creditHistory->amount = $resource->amount ; | ||||
$creditHistory->mean_payment = CreditHistory::MEAN_PAYMENT_CREDIT_CARD ; | |||||
$creditHistory->mean_payment = MeanPayment::CREDIT_CARD ; | |||||
$creditHistory->save(); | $creditHistory->save(); | ||||
} else if ($resource instanceof \Payplug\Resource\Refund) { | } else if ($resource instanceof \Payplug\Resource\Refund) { |