@php
$creditData = $types->firstWhere('type', 'credit');
$debitData = $types->firstWhere('type', 'debit');
$totalCredit = $creditData->total ?? 0;
$totalDebit = $debitData->total ?? 0;
$balance = $totalCredit - $totalDebit;
$creditCount = $creditData->count ?? 0;
$debitCount = $debitData->count ?? 0;
$totalTransactions = $creditCount + $debitCount;
@endphp
CRÉDITOS
R$ {{ number_format($totalCredit, 2, ',', '.') }}
{{ $creditCount }} transações
DÉBITOS
R$ {{ number_format($totalDebit, 2, ',', '.') }}
{{ $debitCount }} transações
SALDO LÍQUIDO
R$ {{ number_format(abs($balance), 2, ',', '.') }}
Total de Transações
{{ $totalTransactions }}
Média por Transação
R$ {{ number_format($totalTransactions > 0 ? ($totalCredit + $totalDebit) / $totalTransactions : 0, 2, ',', '.') }}
@if($totalCredits > 0 || $totalDebits > 0)
Participação no Total
@php
$participationCredits = $totalCredits > 0 ? ($totalCredit / $totalCredits) * 100 : 0;
$participationDebits = $totalDebits > 0 ? ($totalDebit / $totalDebits) * 100 : 0;
@endphp
{{ number_format($participationCredits, 1) }}% dos créditos
{{ number_format($participationDebits, 1) }}% dos débitos
@endif