2021-07-02 04:35:43 +00:00
|
|
|
<div class="form-group mb-0">
|
|
|
|
<label for="checkout_id">Invoices Due</label>
|
2021-07-23 07:25:26 +00:00
|
|
|
@if(($x=$o->invoices()
|
|
|
|
->where('active',TRUE)
|
2022-06-13 05:46:38 +00:00
|
|
|
->orderBy('due_at')
|
2024-07-09 10:17:30 +00:00
|
|
|
->with(['items.taxes','payment_items.payment','account'])
|
2021-07-23 07:25:26 +00:00
|
|
|
->get()
|
|
|
|
->filter(function($item) use ($pid) { return $item->due > 0 || $item->payments->search(function($item) use ($pid) { return $item->id == $pid; }) !== FALSE; }))->count())
|
2021-07-02 04:35:43 +00:00
|
|
|
<table class="table table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>ID</th>
|
|
|
|
<th>Date Issue</th>
|
|
|
|
<th>Date Due</th>
|
|
|
|
<th>Total</th>
|
|
|
|
<th>Due</th>
|
2021-07-23 07:25:26 +00:00
|
|
|
<th class="text-right">Apply</th>
|
2021-07-02 04:35:43 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
@foreach ($x as $io)
|
|
|
|
<tr>
|
|
|
|
<td><a href="{{ url('u/invoice',[$io->id]) }}">{{ $io->sid }}</a></td>
|
2024-07-09 10:17:30 +00:00
|
|
|
<td>{{ $io->created_at->format('Y-m-d') }}</td>
|
2022-06-13 05:46:38 +00:00
|
|
|
<td>{{ $io->due_at->format('Y-m-d') }}</td>
|
2021-07-02 04:35:43 +00:00
|
|
|
<td>{{ number_format($io->total,2) }}</td>
|
|
|
|
<td>{{ number_format($io->due,2) }}</td>
|
2021-07-23 07:25:26 +00:00
|
|
|
<td class="text-right">
|
2024-07-09 10:17:30 +00:00
|
|
|
<input type="text" class="text-right invoice" name="invoices[{{ $io->id }}][id]" value="{{ number_format(($x=$io->payment_items->filter(function($item) use ($pid) { return $item->payment_id == $pid; })) ? $x->sum('amount') : 0,2) }}">
|
2021-07-23 07:25:26 +00:00
|
|
|
</td>
|
2021-07-02 04:35:43 +00:00
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
@else
|
|
|
|
<p>No invoices due.</p>
|
|
|
|
@endif
|
|
|
|
</div>
|