@if(($x=$o->invoices() ->where('active',TRUE) ->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()) @foreach ($x as $io) @endforeach
ID Date Issue Date Due Total Due Apply
{{ $io->sid }} {{ $io->invoice_date->format('Y-m-d') }} {{ $io->due_at->format('Y-m-d') }} {{ number_format($io->total,2) }} {{ number_format($io->due,2) }}
@else

No invoices due.

@endif