@extends('layouts.app') @section('title', 'Relatório de Análise por Categorias') @section('header')

Análise por Categorias

Análise detalhada das movimentações financeiras por categoria

@endsection @section('header-actions')
@endsection @section('content')
Filtros de Período
Limpar
@if($categorySummary->count() > 0)
Total de Categorias

{{ $categorySummary->count() }}

Categorizadas
Total de Créditos
@php $totalCredits = $categorySummary->flatten()->where('type', 'credit')->sum('total'); @endphp

R$ {{ number_format($totalCredits, 2, ',', '.') }}

No período
Total de Débitos
@php $totalDebits = $categorySummary->flatten()->where('type', 'debit')->sum('total'); @endphp

R$ {{ number_format($totalDebits, 2, ',', '.') }}

No período
Saldo Líquido
@php $netBalance = $totalCredits - $totalDebits; @endphp

R$ {{ number_format($netBalance, 2, ',', '.') }}

Resultado
Visualização dos Dados
Escolha como visualizar as informações
@foreach($categorySummary as $category => $types)
{{ $category ?: 'Sem categoria' }}
@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
@endforeach
@else

Nenhuma categoria encontrada

Não há transações categorizadas no período selecionado.
Ajuste os filtros ou verifique se existem transações cadastradas.

Ver Transações
@endif @endsection @push('styles') @endpush @push('scripts') @endpush