update payments and vat mentions
This commit is contained in:
@@ -50,9 +50,6 @@ class OrderController extends Controller
|
||||
'delivery_types' => DeliveryTypes::getWithPrice(Baskets::getWeight()),
|
||||
];
|
||||
|
||||
// dump($data);
|
||||
// exit;
|
||||
|
||||
return view('Shop.Orders.order', $data);
|
||||
} else {
|
||||
return redirect()->route('home');
|
||||
@@ -64,7 +61,7 @@ class OrderController extends Controller
|
||||
$data = $request->all();
|
||||
$data['customer_id'] = Customers::getId();
|
||||
$data['sale_channel_id'] = $data['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||
$data['basket'] = Baskets::getBasketSummary($data['sale_channel_id']);
|
||||
$data['basket'] = Baskets::getBasketSummary($data['sale_channel_id'], $data['delivery_type_id'] ?? false);
|
||||
$order = Orders::saveOrder($data);
|
||||
if ($order) {
|
||||
if ($data['payment_type'] == '1') {
|
||||
|
||||
@@ -30,6 +30,11 @@ class PriceListValue extends Model
|
||||
);
|
||||
}
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo(Tax::class, 'tax_id');
|
||||
}
|
||||
|
||||
public function scopeByPriceList($query, $id)
|
||||
{
|
||||
return $query->where($this->table.'.price_list_id', $id);
|
||||
|
||||
@@ -64,6 +64,7 @@ class Baskets
|
||||
'offer_id' => (int) $item->id,
|
||||
'name' => $offer->article->name.' ('.$offer->variation->name.')',
|
||||
'quantity' => (int) $item->quantity,
|
||||
'vat' => $prices ? (float) $prices->vat->value : false,
|
||||
'price' => $prices ? (float) $prices->price : false,
|
||||
'tax' => $prices ? $prices->price_taxed - $prices->price : false,
|
||||
'price_taxed' => $prices ? (float) $prices->price_taxed : false,
|
||||
|
||||
@@ -13,7 +13,7 @@ class DeliveryTypeCalculations
|
||||
{
|
||||
$price = DeliveryTypeCalculation::byDeliveryType($deliveryTypeId)->byWeight($weight)->first();
|
||||
|
||||
return $price ? $price->price : false;
|
||||
return $price ? (float) $price->price : false;
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Repositories\Shop;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Core\DateStats;
|
||||
use App\Traits\Model\Basic;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Orders
|
||||
@@ -41,7 +42,7 @@ class Orders
|
||||
$data += self::getSummaryOfBasket($basket);
|
||||
$order = self::store($data);
|
||||
$detail = $order ? OrderDetails::saveBasket($order->id, $basket['detail']) : false;
|
||||
unset($data['comment'], $data['agree'], $data['delivery_address_id'], $data['sale_channel_id']);
|
||||
$data = Arr::except($data, ['comment', 'agree', 'delivery_address_id', 'sale_channel_id', 'delivery_id', 'delivery_type_id']);
|
||||
$invoice = $detail ? Invoices::saveInvoice($order->id, $data + $invoice) : false;
|
||||
|
||||
return $invoice ? $order : false;
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Factures',
|
||||
'subtitle' => 'Edition d\'une facture',
|
||||
'breadcrumb' => ['Articles'],
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
{{ Form::open(['route' => 'Admin.Shop.Invoices.update', 'id' => 'invoice-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" value="{{ $invoice['id'] }}">
|
||||
<x-card>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h4> </h4>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
@include('components.form.buttons.button-save')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<h3>
|
||||
{{ $invoice['order']['customer']['last_name'] }}
|
||||
{{ $invoice['order']['customer']['first_name'] }}
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6>
|
||||
@if ($invoice['order']['delivery_address'])
|
||||
{{ $invoice['order']['delivery_address']['address'] }}<br />
|
||||
@isset($invoice['order']['delivery_address']['address2'])
|
||||
{{ $invoice['order']['delivery_address']['address2'] }}<br />
|
||||
@endisset
|
||||
{{ $invoice['order']['delivery_address']['zipcode'] }}
|
||||
{{ $invoice['order']['delivery_address']['city'] }}<br />
|
||||
@endif
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="row mb-3">
|
||||
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
|
||||
Facture N° {{ $invoice['ref'] }}<br />
|
||||
du {{ Carbon\Carbon::parse($invoice['created_at'])->isoFormat('LLLL') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
@include('components.form.select', [
|
||||
'label' => 'Statut',
|
||||
'name' => 'status',
|
||||
'list' => $statuses ?? [],
|
||||
'value' => $invoice['status'],
|
||||
'class' => 'select2',
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@include('components.form.select', [
|
||||
'label' => 'Règlement',
|
||||
'name' => 'payment_type',
|
||||
'list' => $payment_types ?? [],
|
||||
'value' => $invoice['order']['payment_type'],
|
||||
'class' => 'select2',
|
||||
'disabled' => false,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
@include('Admin.Shop.Orders.partials.detail', [
|
||||
'detail_type' => 'facture',
|
||||
'order' => $invoice['order'],
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</x-card>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<x-card>
|
||||
<h4>Règlements</h4>
|
||||
</x-card>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,12 +1,17 @@
|
||||
f{{ Form::open(['route' => 'Admin.Shop.InvoicePayments.store', 'id' => 'invoice_payment-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" id="id" value="{{ $invoice_payment['id'] ?? false }}">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<div class="col-12">
|
||||
@include('components.form.datepicker', [
|
||||
'label' => 'Date',
|
||||
'name' => 'date',
|
||||
'value' => $invoice_payment['date'] ?? null,
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
@include('components.form.select', [
|
||||
'label' => 'Règlement',
|
||||
'name' => 'payment_type',
|
||||
@@ -17,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<div class="col-12">
|
||||
@include('components.form.inputs.money', [
|
||||
'label' => 'Montant',
|
||||
'name' => 'amount',
|
||||
@@ -25,3 +30,17 @@
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
@include('components.form.input', [
|
||||
'label' => 'Référence',
|
||||
'name' => 'reference',
|
||||
'value' => $invoice_payment['reference'] ?? null,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
initDatepicker();
|
||||
</script>
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
@section('content')
|
||||
<x-card>
|
||||
@include('components.datatable', [
|
||||
'route' => route('Admin.Shop.InvoicePayments.index'),
|
||||
'model' => 'invoice_payments',
|
||||
])
|
||||
@include('Admin.Shop.InvoicePayments.list')
|
||||
</x-card>
|
||||
@endsection
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="col-9">
|
||||
<h5>
|
||||
<a href="{{ route('Admin.Shop.Orders.edit', ['id' => $invoice['order_id']]) }}" class="btn btn-success">
|
||||
<i class="fa fa-truck"></i>
|
||||
<i class="fa fa-fw fa-truck"></i>
|
||||
</a>
|
||||
Facture N° {{ $invoice['ref'] }}
|
||||
<span class="small">
|
||||
@@ -20,12 +20,11 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<h5>
|
||||
@if ($invoice['order']['customer']['company'])
|
||||
Société : {{ $invoice['order']['customer']['company'] }}<br />
|
||||
@endif
|
||||
{{ $invoice['order']['customer']['first_name'] }}
|
||||
{{ $invoice['order']['customer']['last_name'] }}
|
||||
@if ($invoice['order']['customer']['company'])
|
||||
<br>
|
||||
{{ $invoice['order']['customer']['company'] }}
|
||||
@endif
|
||||
</h5>
|
||||
|
||||
@if ($invoice['order']['delivery_address'])
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
</table>
|
||||
@endif
|
||||
|
||||
@include('load.form.datepicker')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#add_payment').click(function() {
|
||||
@@ -37,14 +39,14 @@
|
||||
var url_open = "{{ route('Admin.Shop.InvoicePayments.create') }}";
|
||||
var url_save = "{{ route('Admin.Shop.InvoicePayments.store') }}";
|
||||
openModal("Ajouter un paiement", '#invoice_payment-form', url_open, url_save,
|
||||
"InvoicePaymentRefresh();");
|
||||
"InvoicePaymentRefresh();", 'sm');
|
||||
}
|
||||
|
||||
function InvoicePaymentEdit(id) {
|
||||
var url_open = "{{ route('Admin.Shop.InvoicePayments.edit') }}/" + id;
|
||||
var url_save = "{{ route('Admin.Shop.InvoicePayments.store') }}";
|
||||
openModal("Editer un paiement", '#invoice_payment-form', url_open, url_save,
|
||||
"InvoicePaymentRefresh();");
|
||||
"InvoicePaymentRefresh();", 'sm');
|
||||
}
|
||||
|
||||
function InvoicePaymentRefresh() {
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('article_families.title'),
|
||||
'subtitle' => __('article_families.create.title'),
|
||||
'breadcrumb' => [__('article_families.title'), __('article_families.create.title')]
|
||||
'title' => __('article_families.title'),
|
||||
'subtitle' => __('article_families.create.title'),
|
||||
'breadcrumb' => [__('article_families.title'), __('article_families.create.title')],
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
{{ Form::open([
|
||||
'route' => 'Admin.Shop.ArticleFamilies.store',
|
||||
'id' => 'article-family-form',
|
||||
'autocomplete' => 'off',
|
||||
'files' => true,
|
||||
]) }}
|
||||
|
||||
{{ Form::open(['route' => 'Admin.Shop.ArticleFamilies.store', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Admin.Shop.Articles.index") }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route('Admin.Shop.Articles.index') }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.form.buttons.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Admin.Shop.ArticleFamilies.form')
|
||||
</form>
|
||||
<span class="btn-group pull-right">
|
||||
<x-save />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Admin.Shop.ArticleFamilies.form')
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<h5>
|
||||
<a href="{{ route('Admin.Shop.Invoices.edit', ['id' => $order['invoice']['id']]) }}"
|
||||
class="btn btn-success">
|
||||
<i class="fa fa-file-invoice"></i>
|
||||
<i class="fa fa-fw fa-file-invoice"></i>
|
||||
</a>
|
||||
Commande : {{ $order['ref'] }}
|
||||
<span class="small">
|
||||
@@ -29,11 +29,10 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<h5>
|
||||
{{ $order['customer']['first_name'] }} {{ $order['customer']['last_name'] }}
|
||||
@if ($order['customer']['company'])
|
||||
<br>
|
||||
{{ $order['customer']['company'] }}
|
||||
Société : {{ $order['customer']['company'] }}<br />
|
||||
@endif
|
||||
{{ $order['customer']['first_name'] }} {{ $order['customer']['last_name'] }}
|
||||
</h5>
|
||||
|
||||
<h6>
|
||||
@@ -49,6 +48,13 @@
|
||||
</x-card>
|
||||
@endif
|
||||
|
||||
@if ($order['comment'])
|
||||
<x-card title="Commentaire" class="mt-3">
|
||||
{{ $order['comment'] }}
|
||||
</x-card>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="row mb-3">
|
||||
@@ -103,6 +109,7 @@
|
||||
</div>
|
||||
</x-card>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<x-card title="Détail de la {{ $detail_type }}">
|
||||
<x-card title="Détail de la {{ $detail_type }}" classBody="p-0">
|
||||
<table class="table table-bordered table-hover w-100 ">
|
||||
<thead class="thead-light">
|
||||
<th>Nom</th>
|
||||
<th>Quantité</th>
|
||||
<th>PU HT</th>
|
||||
<th>Total HT</th>
|
||||
<th>TVA</th>
|
||||
<th>PU TTC</th>
|
||||
<th>Montant TVA</th>
|
||||
<th>Total TTC</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -14,8 +15,9 @@
|
||||
<td>{{ $detail['name'] }}</td>
|
||||
<td class="text-right">{{ $detail['quantity'] }}</td>
|
||||
<td class="text-right">{{ $detail['price'] }}</td>
|
||||
<td class="text-right">{{ $detail['tax'] }}</td>
|
||||
<td class="text-right">{{ $detail['price_taxed'] }}</td>
|
||||
<td class="text-right">{{ $detail['total'] }}</td>
|
||||
<td class="text-right">{{ $detail['vat'] }}</td>
|
||||
<td class="text-right">{{ $detail['total_tax'] }}</td>
|
||||
<td class="text-right">{{ $detail['total_taxed'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -25,8 +27,11 @@
|
||||
<td style="font-size: 1.2em; font-weight: bold;">Total</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td style="font-size: 1.2em; font-weight: bold;" class="text-right">
|
||||
{{ $order['total'] }}
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right">{{ $order['taxes'] }}</td>
|
||||
<td style="font-size: 1.2em; font-weight: bold;" class="text-right">
|
||||
{{ $order['total_taxed'] }}
|
||||
</td>
|
||||
@@ -38,6 +43,7 @@
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td style="font-size: 1.1em; font-weight: bold;" class="text-right">
|
||||
{{ $order['shipping'] }}
|
||||
</td>
|
||||
@@ -46,8 +52,9 @@
|
||||
<td style="font-size: 1.4em; font-weight: bold;">Total à payer</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right">{{ $order['taxes'] }}</td>
|
||||
<td class="text-right">{{ $order['total'] }}</td>
|
||||
<td></td>
|
||||
<td class="text-right">{{ $order['taxes'] }}</td>
|
||||
<td style="font-size: 1.4em; font-weight: bold;" class="text-right">
|
||||
{{ $order['total_shipped'] }}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user