Fix payment entry

This commit is contained in:
Deon George
2022-06-13 15:46:38 +10:00
parent 9e889008bf
commit 49a4830d89
10 changed files with 42 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
<label for="checkout_id">Invoices Due</label>
@if(($x=$o->invoices()
->where('active',TRUE)
->orderBy('due_date')
->orderBy('due_at')
->with(['items.taxes','paymentitems.payment','account'])
->get()
->filter(function($item) use ($pid) { return $item->due > 0 || $item->payments->search(function($item) use ($pid) { return $item->id == $pid; }) !== FALSE; }))->count())
@@ -23,11 +23,11 @@
<tr>
<td><a href="{{ url('u/invoice',[$io->id]) }}">{{ $io->sid }}</a></td>
<td>{{ $io->invoice_date->format('Y-m-d') }}</td>
<td>{{ $io->due_date->format('Y-m-d') }}</td>
<td>{{ $io->due_at->format('Y-m-d') }}</td>
<td>{{ number_format($io->total,2) }}</td>
<td>{{ number_format($io->due,2) }}</td>
<td class="text-right">
<input type="text" class="text-right invoice" name="invoices[{{ $io->id }}]" value="{{ number_format(($x=$io->paymentitems->filter(function($item) use ($pid) { return $item->payment_id == $pid; })) ? $x->sum('amount') : 0,2) }}">
<input type="text" class="text-right invoice" name="invoices[{{ $io->id }}][id]" value="{{ number_format(($x=$io->paymentitems->filter(function($item) use ($pid) { return $item->payment_id == $pid; })) ? $x->sum('amount') : 0,2) }}">
</td>
</tr>
@endforeach