@php $atual = $sim->resultados->where('regime_calc', 'atual'); $reforma = $sim->resultados->where('regime_calc', 'reforma'); $totalAtual = optional($atual->firstWhere('tributo', 'TOTAL'))->liquido ?? 0; $totalReforma = optional($reforma->firstWhere('tributo', 'TOTAL'))->liquido ?? 0; $diff = $totalReforma - $totalAtual; @endphp

Análise Reforma Tributária #{{ $sim->idreforma }}

{{ optional($sim->pessoa)->razaosocial }} · Período {{ $sim->periodo }} · {{ $sim->consolidado ? 'Consolidado multi-filial' : 'Filial única' }} · {{ $sim->tipo_sped }}

Comparativo

Total atualR$ {{ number_format($totalAtual, 2, ',', '.') }}
Total reformaR$ {{ number_format($totalReforma, 2, ',', '.') }}
DiferençaR$ {{ number_format($diff, 2, ',', '.') }}

Detalhamento

@foreach($sim->resultados->where('tributo', '!=', 'TOTAL') as $res) @endforeach
TributoRegimeLíquido
{{ $res->tributo }} {{ $res->regime_calc }} R$ {{ number_format($res->liquido ?? 0, 2, ',', '.') }}

Origem dos produtos

@foreach($origemLabels as $key => $label) @if($resumoOrigem->has($key)) @endif @endforeach
OrigemQtdValor
{{ $label }} {{ $resumoOrigem[$key]['qtd'] }} R$ {{ number_format($resumoOrigem[$key]['valor'], 2, ',', '.') }}

Produtos (top 100 por valor)

@foreach($sim->produtos->sortByDesc('valor_operacao')->take(100) as $p) @endforeach
Cód.NCMOrigemFilialValor
{{ $p->cod_item ?: '—' }} {{ $p->ncm ?: '—' }} {{ $origemLabels[$p->origem_classificada] ?? $p->origem_classificada }} {{ $p->uf_filial ?: '—' }} R$ {{ number_format($p->valor_operacao, 2, ',', '.') }}