@if ($type === 'receipts') Contas a Receber @else Contas a Pagar @endif

{{ $institution->fantasia }}

{{ $institution->fullAddress() }}
@if ($type === 'receipts')

Demonstrativo de Contas a Receber

@else

Demonstrativo de Contas a Pagar

@endif
@if (!is_null($periodo_inicial) || !is_null($periodo_final)) Período: {{ date('d/m/Y', strtotime($periodo_inicial)) }}  até  {{ date('d/m/Y', strtotime($periodo_final)) }} @endif

@if ($type == 'receipts') @else @endif @foreach ($accounts as $item) @endforeach @php $accounts = $accounts->where('status', '<>', 'Cancelado') @endphp
#Receber dePagar aVenc. Descrição Parcela Status Valor Data Pagamento Valor Pago
{{ $loop->iteration }} {{ $item->person->full_name_with_document }} {{ date('d/m/Y', strtotime($item->due_date)) }} {{ $item->description }} {{ $item->parcel . '/' . $item->total_installments }} {{ $item->status }} @if ($item->status !== 'Cancelado') @if ($type === 'receipts') {{ number_format($item->value_to_receivable, 2, ',', '.') }} @else {{ number_format($item->value_to_pay, 2, ',', '.') }} @endif @else 0,00 @endif {{ $item->payment_date ? date('d/m/Y', strtotime($item->payment_date)) : '' }} @if ($item->status !== 'Cancelado') @if ($type == 'receipts') {{ number_format($item->value_received, 2, ',', '.') }} @else {{ number_format($item->value_paid, 2, ',', '.') }} @endif @else 0,00 @endif
Total do Período: @if ($type == 'receipts') {{ number_format($accounts->sum('value_to_receivable'), 2, ',', '.') }} @else {{ number_format($accounts->sum('value_to_pay'), 2, ',', '.') }} @endif @if ($type == 'receipts') {{ number_format($accounts->sum('value_received'), 2, ',', '.') }} @else {{ number_format($accounts->sum('value_paid'), 2, ',', '.') }} @endif