|
|
|
|
|
|
|
|
|
|
|
|
|
|
use common\logic\Document\Document\Wrapper\DocumentManager; |
|
|
use common\logic\Document\Document\Wrapper\DocumentManager; |
|
|
use common\logic\Producer\Producer\Wrapper\ProducerManager; |
|
|
use common\logic\Producer\Producer\Wrapper\ProducerManager; |
|
|
use common\logic\User\User\Model\User; |
|
|
|
|
|
use common\logic\User\User\Wrapper\UserManager; |
|
|
use common\logic\User\User\Wrapper\UserManager; |
|
|
use yii\helpers\Html; |
|
|
use yii\helpers\Html; |
|
|
use yii\widgets\ActiveForm; |
|
|
use yii\widgets\ActiveForm; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php if ($action == 'create' && $documentClass == 'Invoice'): ?> |
|
|
<?php if ($action == 'create' && $documentClass == 'Invoice'): ?> |
|
|
<template v-if="idUser > 0"> |
|
|
<template v-if="idUser > 0"> |
|
|
<strong>Bons de livraison</strong> |
|
|
|
|
|
<table v-if="deliveryNoteCreateArray && deliveryNoteCreateArray.length > 0" class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th></th> |
|
|
|
|
|
<th>Libellé</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="deliveryNote in deliveryNoteCreateArray"> |
|
|
|
|
|
<td><input type="checkbox" name="Invoice[deliveryNotes][]" :value="deliveryNote.id"/></td> |
|
|
|
|
|
<td>{{ deliveryNote.name }}</td> |
|
|
|
|
|
<td>{{ formatPrice(deliveryNote.total) }}</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucun bon de livraison pour cet utilisateur.</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="deliveryNoteCreateArray && deliveryNoteCreateArray.length > 0"> |
|
|
|
|
|
<strong>Bons de livraison</strong> |
|
|
|
|
|
<table v-if="deliveryNoteCreateArray && deliveryNoteCreateArray.length > 0" |
|
|
|
|
|
class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th></th> |
|
|
|
|
|
<th>Libellé</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="deliveryNote in deliveryNoteCreateArray"> |
|
|
|
|
|
<td><input type="checkbox" name="Invoice[deliveryNotes][]" |
|
|
|
|
|
:value="deliveryNote.id"/></td> |
|
|
|
|
|
<td>{{ deliveryNote.name }}</td> |
|
|
|
|
|
<td>{{ formatPrice(deliveryNote.total) }}</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucun bon de livraison pour cet utilisateur.</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else-if="ordersCreateArray && ordersCreateArray.length > 0"> |
|
|
|
|
|
<strong>Commandes</strong> |
|
|
|
|
|
<table v-if="ordersCreateArray && ordersCreateArray.length > 0" |
|
|
|
|
|
class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th></th> |
|
|
|
|
|
<th>Date</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="order in ordersCreateArray"> |
|
|
|
|
|
<td><input type="checkbox" name="Invoice[ordersOnCreate][]" :value="order.id"/></td> |
|
|
|
|
|
<td>{{ order.name }}</td> |
|
|
|
|
|
<td>{{ formatPrice(order.amount_with_tax) }}</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucune commande pour cet utilisateur.</div> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
<?php endif; ?> |
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<?php if ($action == 'update'): ?> |
|
|
|
|
|
|
|
|
<?php if ($action == 'update'): ?> |
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-green"><i class="fa fa-sticky-note-o"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-green"><i class="fa fa-sticky-note-o"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
<span class="info-box-text"> |
|
|
<span class="info-box-text"> |
|
|
<?= $typeDocument ?> |
|
|
<?= $typeDocument ?> |
|
|
<span v-html="document.html_label"></span> |
|
|
<span v-html="document.html_label"></span> |
|
|
<span v-if="document.is_sent" class="label label-success">Envoyé</span> |
|
|
<span v-if="document.is_sent" class="label label-success">Envoyé</span> |
|
|
</span> |
|
|
</span> |
|
|
<span class="info-box-number">{{ document.reference }}</span> |
|
|
|
|
|
<span class="info-box-text">Date</span> |
|
|
|
|
|
<span class="info-box-number">{{ document.date }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<span class="info-box-number">{{ document.reference }}</span> |
|
|
|
|
|
<span class="info-box-text">Date</span> |
|
|
|
|
|
<span class="info-box-number">{{ document.date }}</span> |
|
|
</div> |
|
|
</div> |
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<span class="info-box-text">Total<span v-if="taxRateProducer != 0"> (TTC)</span></span> |
|
|
|
|
|
<span class="info-box-number">{{ formatPrice(total_with_tax) }}</span> |
|
|
|
|
|
<p v-if="invoiceUrl"> |
|
|
|
|
|
<a class="btn btn-sm btn-default" :href="invoiceUrl"> |
|
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span> Voir la facture |
|
|
|
|
|
</a> |
|
|
|
|
|
</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<span class="info-box-text">Total<span v-if="taxRateProducer != 0"> (TTC)</span></span> |
|
|
|
|
|
<span class="info-box-number">{{ formatPrice(total_with_tax) }}</span> |
|
|
|
|
|
<p v-if="invoiceUrl"> |
|
|
|
|
|
<a class="btn btn-sm btn-default" :href="invoiceUrl"> |
|
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span> Voir la facture |
|
|
|
|
|
</a> |
|
|
|
|
|
</p> |
|
|
</div> |
|
|
</div> |
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-yellow"><i class="fa fa-calendar"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<span class="info-box-text">Commandes</span> |
|
|
|
|
|
<?php foreach($model->orders as $order): ?> |
|
|
|
|
|
<?php if($order->distribution): ?> |
|
|
|
|
|
<a class="btn btn-sm btn-default" href="<?= Yii::$app->urlManager->createUrl(['distribution/index', 'idOrderUpdate' => $order->id]); ?>"> |
|
|
|
|
|
<?= date('d/m/Y', strtotime($order->distribution->date)) ?> |
|
|
|
|
|
</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
<?php endforeach; ?> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-yellow"><i class="fa fa-calendar"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<span class="info-box-text">Commandes</span> |
|
|
|
|
|
<?php foreach ($model->orders as $order): ?> |
|
|
|
|
|
<?php if ($order->distribution): ?> |
|
|
|
|
|
<a class="btn btn-sm btn-default" |
|
|
|
|
|
href="<?= Yii::$app->urlManager->createUrl(['distribution/index', 'idOrderUpdate' => $order->id]); ?>"> |
|
|
|
|
|
<?= date('d/m/Y', strtotime($order->distribution->date)) ?> |
|
|
|
|
|
</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
<?php endforeach; ?> |
|
|
</div> |
|
|
</div> |
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-blue"><i class="fa fa-download"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/download', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-download-alt"></span> Télécharger (PDF)</a> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div id="" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-blue"><i class="fa fa-download"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/download', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-download-alt"></span> Télécharger |
|
|
|
|
|
(PDF)</a> |
|
|
|
|
|
|
|
|
<?php if($documentManager->isStatusValid($model)): ?> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/regenerate', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-repeat"></span> Regénérer (PDF)</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
<?php if ($documentManager->isStatusValid($model)): ?> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/regenerate', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-repeat"></span> Regénérer |
|
|
|
|
|
(PDF)</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
<?php if ($documentClass == 'Invoice' && $producerManager->getConfig('option_export_evoliz')): ?> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/export-csv-evoliz', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-save-file"></span> Export Evoliz |
|
|
|
|
|
(CSV)</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<?php if ($documentClass == 'Invoice' && $producerManager->getConfig('option_export_evoliz')): ?> |
|
|
|
|
|
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/export-csv-evoliz', 'id' => $model->id]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-save-file"></span> Export Evoliz |
|
|
|
|
|
(CSV)</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
</div> |
|
|
</div> |
|
|
<div v-if="document.status == 'draft' || !document.is_sent" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-red"><i class="fa fa-flash"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-if="document.status == 'draft' || !document.is_sent" class="info-box"> |
|
|
|
|
|
<span class="info-box-icon bg-red"><i class="fa fa-flash"></i></span> |
|
|
|
|
|
<div class="info-box-content"> |
|
|
|
|
|
|
|
|
<a v-if="document.status == 'draft'" href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/validate', 'id' => $model->id, 'backUpdateForm' => 1]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-ok"></span> Valider le document</a> |
|
|
|
|
|
|
|
|
<a v-if="document.status == 'draft'" |
|
|
|
|
|
href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/validate', 'id' => $model->id, 'backUpdateForm' => 1]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-ok"></span> Valider le document</a> |
|
|
|
|
|
|
|
|
<?php if (isset($model->user) && strlen($model->user->email) > 0): ?> |
|
|
|
|
|
<a v-if="!document.is_sent" href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/send', 'id' => $model->id, 'backUpdateForm' => 1]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-send"></span> Envoyer le |
|
|
|
|
|
document</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<?php if (isset($model->user) && strlen($model->user->email) > 0): ?> |
|
|
|
|
|
<a v-if="!document.is_sent" |
|
|
|
|
|
href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/send', 'id' => $model->id, 'backUpdateForm' => 1]) ?>" |
|
|
|
|
|
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-send"></span> Envoyer le |
|
|
|
|
|
document</a> |
|
|
|
|
|
<?php endif; ?> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="clr"></div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="clr"></div> |
|
|
|
|
|
|
|
|
<?php if ($action == 'update' && $documentClass == 'Invoice'): ?> |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-md-6" v-if="(deliveryNoteUpdateArray && deliveryNoteUpdateArray.length > 0) || (deliveryNoteCreateArray && deliveryNoteCreateArray.length > 0)"> |
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Bons de livraison |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<table v-if="deliveryNoteUpdateArray && deliveryNoteUpdateArray.length > 0" class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Libellé</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
<th v-if="document.status == 'draft'"></th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="deliveryNote in deliveryNoteUpdateArray"> |
|
|
|
|
|
<td><a :href="deliveryNote.url">{{ deliveryNote.name }}</a></td> |
|
|
|
|
|
<td>{{ formatPrice(deliveryNote.total) }}</td> |
|
|
|
|
|
<td v-if="document.status == 'draft'"><a class="btn btn-default" href="javascript:void(0);" @click="deleteDeliveryNoteFromInvoice" :data-id="deliveryNote.id"><span class="glyphicon glyphicon-trash"></span></a></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucun bon de livraison associé.</div> |
|
|
|
|
|
|
|
|
<?php if ($action == 'update' && $documentClass == 'Invoice'): ?> |
|
|
|
|
|
<div v-if="(deliveryNoteUpdateArray && deliveryNoteUpdateArray.length > 0) || (deliveryNoteCreateArray && deliveryNoteCreateArray.length > 0)"> |
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Bons de livraison |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<table v-if="deliveryNoteUpdateArray && deliveryNoteUpdateArray.length > 0" |
|
|
|
|
|
class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Libellé</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
<th v-if="document.status == 'draft'"></th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="deliveryNote in deliveryNoteUpdateArray"> |
|
|
|
|
|
<td><a :href="deliveryNote.url">{{ deliveryNote.name }}</a></td> |
|
|
|
|
|
<td>{{ formatPrice(deliveryNote.total) }}</td> |
|
|
|
|
|
<td v-if="document.status == 'draft'"><a class="btn btn-default" href="javascript:void(0);" |
|
|
|
|
|
@click="deleteDeliveryNoteFromInvoice" |
|
|
|
|
|
:data-id="deliveryNote.id"><span |
|
|
|
|
|
class="glyphicon glyphicon-trash"></span></a></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucun bon de livraison associé.</div> |
|
|
|
|
|
|
|
|
<div v-if="document.status == 'draft'" id="delivery-note-add"> |
|
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
|
<select class="form-control" v-model="deliveryNoteAddId"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="deliveryNote in deliveryNoteCreateArray" :value="deliveryNote.id"> |
|
|
|
|
|
{{ deliveryNote.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" @click="submitDeliveryNoteAddToInvoice">Ajouter</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div v-if="document.status == 'draft'" id="delivery-note-add"> |
|
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
|
<select class="form-control" v-model="deliveryNoteAddId"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="deliveryNote in deliveryNoteCreateArray" :value="deliveryNote.id"> |
|
|
|
|
|
{{ deliveryNote.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" @click="submitDeliveryNoteAddToInvoice"> |
|
|
|
|
|
Ajouter |
|
|
|
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="col-md-6" v-else> |
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Commandes |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<table v-if="ordersUpdateArray && ordersUpdateArray.length > 0" class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Date</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
<th v-if="document.status == 'draft'"></th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="order in ordersUpdateArray"> |
|
|
|
|
|
<td>{{ order.name }}</td> |
|
|
|
|
|
<td>{{ formatPrice(order.amount_with_tax) }}</td> |
|
|
|
|
|
<td v-if="document.status == 'draft'"> |
|
|
|
|
|
<a class="btn btn-default" href="javascript:void(0);" @click="deleteOrderFromInvoice" :data-id="order.id"> |
|
|
|
|
|
<span class="glyphicon glyphicon-trash"></span> |
|
|
|
|
|
</a> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucune commande associée.</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else> |
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Commandes |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<table v-if="ordersUpdateArray && ordersUpdateArray.length > 0" class="table table-bordered"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Date</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Montant (TTC)</th> |
|
|
|
|
|
<th v-else>Montant</th> |
|
|
|
|
|
<th v-if="document.status == 'draft'"></th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<tr v-for="order in ordersUpdateArray"> |
|
|
|
|
|
<td>{{ order.name }}</td> |
|
|
|
|
|
<td>{{ formatPrice(order.amount_with_tax) }}</td> |
|
|
|
|
|
<td v-if="document.status == 'draft'"> |
|
|
|
|
|
<a class="btn btn-default" href="javascript:void(0);" @click="deleteOrderFromInvoice" |
|
|
|
|
|
:data-id="order.id"> |
|
|
|
|
|
<span class="glyphicon glyphicon-trash"></span> |
|
|
|
|
|
</a> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-warning">Aucune commande associée.</div> |
|
|
|
|
|
|
|
|
<div v-if="document.status == 'draft'" id="order-add"> |
|
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
|
<select class="form-control" v-model="orderAddId"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="order in ordersCreateArray" :value="order.id"> |
|
|
|
|
|
{{ order.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" @click="submitOrderAddToInvoice">Ajouter</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div v-if="document.status == 'draft'" id="order-add"> |
|
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
|
<select class="form-control" v-model="orderAddId"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="order in ordersCreateArray" :value="order.id"> |
|
|
|
|
|
{{ order.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" @click="submitOrderAddToInvoice">Ajouter</button> |
|
|
|
|
|
<button class="btn btn-danger" value="Ignorer" @click="submitOrderIgnoreWhenInvoicing">Ignorer</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="clr"></div> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="clr"></div> |
|
|
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
<div class=""> |
|
|
|
|
|
<div class="panel panel-default" id="block-add-product"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Ajouter un produit |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<strong>Produit</strong> |
|
|
|
|
|
<select class="form-control" v-model="productAddId" |
|
|
|
|
|
@change="changeProductAdd"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="product in productsArray" :value="product.id"> |
|
|
|
|
|
{{ product.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
<div class="panel panel-default" id="block-add-product"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Ajouter un produit |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
<strong>Produit</strong> |
|
|
|
|
|
<select class="form-control" v-model="productAddId" |
|
|
|
|
|
@change="changeProductAdd"> |
|
|
|
|
|
<option value="0" selected="selected">--</option> |
|
|
|
|
|
<option v-for="product in productsArray" :value="product.id"> |
|
|
|
|
|
{{ product.name }} |
|
|
|
|
|
</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<template v-if="productAddId > 0"> |
|
|
|
|
|
<div class="col-md-3"> |
|
|
|
|
|
<strong>Prix unitaire</strong> |
|
|
|
|
|
<div class="input-group"> |
|
|
|
|
|
<input type="text" class="form-control input-price" |
|
|
|
|
|
v-model="productAddPrice" @change="formatProductAddPrice"/> |
|
|
|
|
|
<span class="input-group-addon"><span |
|
|
|
|
|
class="glyphicon glyphicon-euro"></span> <span v-if="taxRateProducer != 0">HT</span></span> |
|
|
</div> |
|
|
</div> |
|
|
<template v-if="productAddId > 0"> |
|
|
|
|
|
<div class="col-md-3"> |
|
|
|
|
|
<strong>Prix unitaire</strong> |
|
|
|
|
|
<div class="input-group"> |
|
|
|
|
|
<input type="text" class="form-control input-price" |
|
|
|
|
|
v-model="productAddPrice" @change="formatProductAddPrice"/> |
|
|
|
|
|
<span class="input-group-addon"><span |
|
|
|
|
|
class="glyphicon glyphicon-euro"></span> <span v-if="taxRateProducer != 0">HT</span></span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-3 total"> |
|
|
|
|
|
<strong>Quantité</strong> |
|
|
|
|
|
<div class="input-group input-group-quantity"> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-3 total"> |
|
|
|
|
|
<strong>Quantité</strong> |
|
|
|
|
|
<div class="input-group input-group-quantity"> |
|
|
<span class="input-group-btn"> |
|
|
<span class="input-group-btn"> |
|
|
<button class="btn btn-default" type="button" |
|
|
<button class="btn btn-default" type="button" |
|
|
@click="changeQuantityProductAdd(-1)">-</button> |
|
|
@click="changeQuantityProductAdd(-1)">-</button> |
|
|
</span> |
|
|
</span> |
|
|
<input type="text" class="form-control input-quantity" |
|
|
|
|
|
v-model="productAddQuantity" @change="formatProductAddQuantity"/> |
|
|
|
|
|
<span class="input-group-addon">{{ getProductById(productAddId).wording_unit }}</span> |
|
|
|
|
|
<span class="input-group-btn"> |
|
|
|
|
|
|
|
|
<input type="text" class="form-control input-quantity" |
|
|
|
|
|
v-model="productAddQuantity" @change="formatProductAddQuantity"/> |
|
|
|
|
|
<span class="input-group-addon">{{ getProductById(productAddId).wording_unit }}</span> |
|
|
|
|
|
<span class="input-group-btn"> |
|
|
<button class="btn btn-default" |
|
|
<button class="btn btn-default" |
|
|
type="button" |
|
|
type="button" |
|
|
@click="changeQuantityProductAdd(1)">+</button> |
|
|
@click="changeQuantityProductAdd(1)">+</button> |
|
|
</span> |
|
|
</span> |
|
|
</div> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" |
|
|
|
|
|
@click="submitProductAdd">Ajouter |
|
|
|
|
|
</button> |
|
|
|
|
|
<div class="clr"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<!--<div class="col-md-3 total"> |
|
|
|
|
|
<strong>Total</strong> |
|
|
|
|
|
<div class="input-group"> |
|
|
|
|
|
<input type="text" class="form-control input-price" readonly |
|
|
|
|
|
:value="formatPrice(productAddPrice * productAddQuantity)"/> |
|
|
|
|
|
<span class="input-group-addon"><span |
|
|
|
|
|
class="glyphicon glyphicon-euro"></span> <span v-if="taxRateProducer != 0">HT</span></span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div>--> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<button class="btn btn-primary" value="Ajouter" |
|
|
|
|
|
@click="submitProductAdd">Ajouter |
|
|
|
|
|
</button> |
|
|
<div class="clr"></div> |
|
|
<div class="clr"></div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Produits |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<div id="block-list-products"> |
|
|
|
|
|
<table class="table table-bordered" v-if="Object.keys(ordersArray).length > 0"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Nom</th> |
|
|
|
|
|
<th>Prix (unité)</th> |
|
|
|
|
|
<th>Quantité</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">TVA</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Total HT</th> |
|
|
|
|
|
<th v-else>Total</th> |
|
|
|
|
|
<th>Supprimer</th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<template v-for="order in ordersArray"> |
|
|
|
|
|
<tr v-for="productOrder in order.productOrder"> |
|
|
|
|
|
<td class="col-md-4"> |
|
|
|
|
|
<div class="product-name">{{ getProductById(productOrder.id_product).name }} |
|
|
|
|
|
</div> |
|
|
|
|
|
<ul class="product-order-meta"> |
|
|
|
|
|
<li v-if="order.distribution_date">Commande : <a class="btn btn-sm btn-default" :href="productOrder.url_order">{{ order.distribution_date }}</a></li> |
|
|
|
|
|
<li>Utilisateur : {{ order.username }}</li> |
|
|
|
|
|
<li v-if="order.point_sale_name">Point de vente : {{ order.point_sale_name }}</li> |
|
|
|
|
|
</ul> |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2"> |
|
|
|
|
|
{{ formatPrice(getProductOrderPrice(productOrder)) }} |
|
|
|
|
|
<template v-if="document.status == 'draft' && getProductOrderPrice(productOrder) != getBestProductPrice(productOrder.id_product, productOrder.quantity)"> |
|
|
|
|
|
<i class="fa fa-exclamation-triangle" title="Prix différent de celui défini au niveau du produit"></i> |
|
|
|
|
|
</template> |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2">{{ productOrder.quantity }}</td> |
|
|
|
|
|
<td class="col-md-1" v-if="taxRateProducer != 0"> |
|
|
|
|
|
{{ getProductById(productOrder.id_product).tax_rate * 100 }} % |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2"> |
|
|
|
|
|
{{ formatPrice(productOrder.quantity * getProductOrderPrice(productOrder)) }} |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-1"> |
|
|
|
|
|
<a class="btn btn-default" @click="deleteProductOrder(productOrder.id)"> |
|
|
|
|
|
<span class="glyphicon glyphicon-trash"></span> |
|
|
|
|
|
</a> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-if="taxRateProducer != 0"> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Total HT</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total) }} HT</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Montant TVA</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total_with_tax - total) }}</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Total TTC</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total_with_tax) }} TTC</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="3"><strong>Total</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total) }}</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
<div class="clr"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-info"> |
|
|
|
|
|
Aucun produit. |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
|
|
<div class="panel-heading"> |
|
|
|
|
|
Produits |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="panel-body"> |
|
|
|
|
|
<div id="block-list-products"> |
|
|
|
|
|
<table class="table table-bordered" v-if="Object.keys(ordersArray).length > 0"> |
|
|
|
|
|
<thead> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<th>Nom</th> |
|
|
|
|
|
<th>Prix (unité)</th> |
|
|
|
|
|
<th>Quantité</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">TVA</th> |
|
|
|
|
|
<th v-if="taxRateProducer != 0">Total HT</th> |
|
|
|
|
|
<th v-else>Total</th> |
|
|
|
|
|
<th>Supprimer</th> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</thead> |
|
|
|
|
|
<tbody> |
|
|
|
|
|
<template v-for="order in ordersArray"> |
|
|
|
|
|
<tr v-for="productOrder in order.productOrder"> |
|
|
|
|
|
<td class="col-md-4"> |
|
|
|
|
|
<div class="product-name">{{ getProductById(productOrder.id_product).name }} |
|
|
|
|
|
</div> |
|
|
|
|
|
<ul class="product-order-meta"> |
|
|
|
|
|
<li v-if="order.distribution_date">Commande : <a class="btn btn-sm btn-default" |
|
|
|
|
|
:href="productOrder.url_order">{{ |
|
|
|
|
|
order.distribution_date }}</a></li> |
|
|
|
|
|
<li>Utilisateur : {{ order.username }}</li> |
|
|
|
|
|
<li v-if="order.point_sale_name">Point de vente : {{ order.point_sale_name }}</li> |
|
|
|
|
|
</ul> |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2"> |
|
|
|
|
|
{{ formatPrice(getProductOrderPrice(productOrder)) }} |
|
|
|
|
|
<template |
|
|
|
|
|
v-if="document.status == 'draft' && getProductOrderPrice(productOrder) != getBestProductPrice(productOrder.id_product, productOrder.quantity)"> |
|
|
|
|
|
<i class="fa fa-exclamation-triangle" |
|
|
|
|
|
title="Prix différent de celui défini au niveau du produit"></i> |
|
|
|
|
|
</template> |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2">{{ productOrder.quantity }}</td> |
|
|
|
|
|
<td class="col-md-1" v-if="taxRateProducer != 0"> |
|
|
|
|
|
{{ getProductById(productOrder.id_product).tax_rate * 100 }} % |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-2"> |
|
|
|
|
|
{{ formatPrice(productOrder.quantity * getProductOrderPrice(productOrder)) }} |
|
|
|
|
|
</td> |
|
|
|
|
|
<td class="col-md-1"> |
|
|
|
|
|
<a class="btn btn-default" @click="deleteProductOrder(productOrder.id)"> |
|
|
|
|
|
<span class="glyphicon glyphicon-trash"></span> |
|
|
|
|
|
</a> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-if="taxRateProducer != 0"> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Total HT</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total) }} HT</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Montant TVA</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total_with_tax - total) }}</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="4"><strong>Total TTC</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total_with_tax) }} TTC</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="3"><strong>Total</strong></td> |
|
|
|
|
|
<td><strong>{{ formatPrice(total) }}</strong></td> |
|
|
|
|
|
<td></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</template> |
|
|
|
|
|
</tbody> |
|
|
|
|
|
</table> |
|
|
|
|
|
<div v-else class="alert alert-info"> |
|
|
|
|
|
Aucun produit. |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<?php endif; ?> |