Move invoice blades around. Added invoices in credit view
Some checks failed
Create Docker Image / Build Docker Image (x86_64) (push) Failing after 28s
Create Docker Image / Final Docker Image Manifest (push) Has been skipped

This commit is contained in:
Deon George 2024-07-06 19:28:14 +10:00
parent f458bb19c5
commit 844d509834
10 changed files with 93 additions and 22 deletions

View File

@ -281,7 +281,7 @@ class Account extends Model implements IDs
DB::raw('SUM(amount) AS payments'),
DB::raw('SUM(fees_amt) AS payment_fees'),
])
->join('payment_items',['payment_items.payment_id'=>'payments.id'])
->leftjoin('payment_items',['payment_items.payment_id'=>'payments.id'])
->where('payments.active',TRUE)
->where('payment_items.active',TRUE)
->groupBy(['payment_items.invoice_id'])
@ -299,6 +299,7 @@ class Account extends Model implements IDs
->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id'])
->rightjoin('invoices',['invoices.id'=>'invoice_items.invoice_id'])
->where('invoice_items.active',TRUE)
->where('invoice_item_taxes.active',TRUE)
->where('invoices.active',TRUE)
->groupBy(['invoice_items.invoice_id']),
),'p')

View File

@ -7,7 +7,7 @@
<div class="card-body">
@if(($list=$o->invoiceSummaryDue()->get())->count())
@include('theme.backend.adminlte.invoice.widget.due')
@include('theme.backend.adminlte.invoice.widget.due',['type'=>'account'])
@else
<p>No invoice due</p>

View File

@ -96,7 +96,7 @@
@if($o==$user)
@canany('reseller','wholesaler')
<div class="tab-pane" id="tab-reseller" role="tabpanel">
@include('theme.backend.adminlte.r.home.widget.home')
@include('theme.backend.adminlte.widget.admin.reseller')
</div>
@endcanany
@endif

View File

@ -0,0 +1,58 @@
<!-- Show outstanding invoices -->
<table class="table table-bordered w-100" id="invoices_credit_{{$type}}">
<thead>
<tr>
<th>Account</th>
<th>#</th>
<th>Due</th>
<th class="text-right">Items</th>
<th class="text-right">Discounts</th>
<th class="text-right">Total</th>
<th class="text-right">Payments</th>
<th class="text-right">Balance</th>
</tr>
</thead>
<tbody>
@foreach($list as $oo)
<tr>
<td>{{ $oo->account->name }}</td>
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
<td>{{ $oo->due_at->format('Y-m-d') }}</td>
<td class="text-right">${{ number_format($oo->_item+$oo->_tax,2) }}</td>
<td class="text-right">${{ number_format($oo->_discount,2) }}</td>
<td class="text-right">${{ number_format($oo->_total,2) }}</td>
<td class="text-right">${{ number_format($oo->_payment,2) }}</td>
<td class="text-right">${{ number_format($oo->_balance,2) }}</td>
</tr>
@endforeach
</tbody>
</table>
@section('page-styles')
@css(datatables,bootstrap4|rowgroup)
@append
@section('page-scripts')
@js(datatables,bootstrap4|rowgroup)
<script type="text/javascript">
@if($list->count())
$(document).ready(function() {
$('#invoices_credit_{{$type}}').DataTable({
// If we have more than 1 account id, order by account
order: [[0,'asc'],[2,'asc'],[1,'desc']],
rowGroup: {
dataSrc: 0,
},
columnDefs: [
{
targets: [0],
visible: false,
}
],
});
});
@endif
</script>
@append

View File

@ -1,4 +1,3 @@
<!-- $o=App\Models\User -->
<!-- Show outstanding invoices for all clients -->
<div class="card card-warning">
<div class="card-header">
@ -7,7 +6,7 @@
<div class="card-body">
@if(($list=\App\Models\Account::InvoicesDue())->count())
@include('theme.backend.adminlte.invoice.widget.due')
@include('theme.backend.adminlte.invoice.widget.due',['type'=>'all'])
@else
<p>No invoice due</p>

View File

@ -1,6 +1,6 @@
<!-- $o = Account::class -->
<!-- $list = Collection[Invoice::class] -->
<!-- Show outstanding invoices -->
<table class="table table-bordered w-100" id="invoices_due_{{ $o->id }}">
<table class="table table-bordered w-100" id="invoices_due_{{$type}}">
<thead>
<tr>
<th>Account</th>
@ -12,8 +12,8 @@
</thead>
<tbody>
@foreach ($list as $oo)
<tr @if ($oo->due_at->isPast()) class="table-danger" @endif>
@foreach($list as $oo)
<tr @if($oo->due_at->isPast()) class="table-danger" @endif>
<td>{{ $oo->account->name }}</td>
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
<td>{{ $oo->due_at->format('Y-m-d') }}</td>
@ -32,9 +32,9 @@
@js(datatables,bootstrap4|rowgroup)
<script type="text/javascript">
@if ($list->count())
@if($list->count())
$(document).ready(function() {
$('#invoices_due_{{ $o->id }}').DataTable({
$('#invoices_due_{{$type}}').DataTable({
// If we have more than 1 account id, order by account
order: [[0,'asc'],[2,'asc'],[1,'desc']],
rowGroup: {

View File

@ -1,11 +0,0 @@
<div class="row">
<div class="col-4">
@include('theme.backend.adminlte.r.account.widgets.list')
</div>
<div class="col-8">
@include('theme.backend.adminlte.r.service.widget.movement')
@include('theme.backend.adminlte.r.invoice.widgets.due')
</div>
</div>

View File

@ -0,0 +1,24 @@
<div class="row">
<div class="col-4">
@include('theme.backend.adminlte.account.widget.admin.list')
</div>
<div class="col-8">
@include('theme.backend.adminlte.service.widget.admin.movement')
@include('theme.backend.adminlte.invoice.widget.admin.due')
@can('wholesaler')
<!-- Show outstanding invoices for all clients -->
<div class="card card-secondary">
<div class="card-header">
<h3 class="card-title">Invoices In Credit</h3>
</div>
<div class="card-body">
@include('theme.backend.adminlte.invoice.widget.admin.credit',['list'=>\App\Models\Account::InvoicesCredit(),'type'=>'account'])
</div>
</div>
@endcan
</div>
</div>