@php
$cfg = is_array($empresa->configuracoes ?? null) ? $empresa->configuracoes : [];
$contextoFatura = $contextoFatura ?? [];
$isMedicaoFatura = (bool) ($contextoFatura['is_medicao'] ?? false);
$itensFatura = collect($contextoFatura['itens'] ?? []);
$parcelas = collect($contextoFatura['parcelas'] ?? []);
$primeiroVencimento = optional($parcelas->sortBy('numero_parcela')->first())->data_vencimento ?? $faturamento->data_vencimento;
$formatarData = static fn($data) => !empty($data)
? \Illuminate\Support\Carbon::parse((string) $data)->format('d/m/Y')
: '-';
$periodoFaturaRotulo = $contextoFatura['periodo_rotulo'] ?? (
optional($faturamento->locacao->data_inicio)->format('d/m/Y') . ' até ' . optional($faturamento->locacao->data_fim)->format('d/m/Y')
);
$diasPeriodoFatura = $contextoFatura['dias_periodo'] ?? null;
$logoSrc = \App\Helpers\PdfAssetHelper::resolveCompanyConfigImage($empresa, 'logo_url', true);
@endphp
DADOS DO CLIENTE
@if($faturamento->locacao->cliente)
Nome/Razão Social:
{{ $faturamento->locacao->cliente->nome ?? $faturamento->locacao->cliente->razao_social ?? '-' }}
@if($faturamento->locacao->cliente->cpf ?? $faturamento->locacao->cliente->cnpj ?? null)
CPF/CNPJ:
{{ $faturamento->locacao->cliente->cpf ?? $faturamento->locacao->cliente->cnpj ?? '-' }}
@endif
@if($faturamento->locacao->cliente->endereco ?? null)
Endereço:
{{ $faturamento->locacao->cliente->endereco }}
@endif
@if($faturamento->locacao->cliente->telefone ?? null)
Telefone:
{{ $faturamento->locacao->cliente->telefone }}
@endif
@endif
DADOS DA LOCAÇÃO
Contrato:
#{{ $faturamento->locacao->numero_contrato ?? $faturamento->locacao->id_locacao }}
Período:
{{ $periodoFaturaRotulo }}
@if($isMedicaoFatura)
Tipo de Fatura:
Medição @if($diasPeriodoFatura) ({{ $diasPeriodoFatura }} dia(s)) @endif
@endif
@if($faturamento->locacao->local_evento ?? null)
Local do Evento:
{{ $faturamento->locacao->local_evento }}
@endif
@if($itensFatura->count() > 0)
ITENS DA LOCAÇÃO - PRODUTOS
| Qtd |
Produto |
@if($isMedicaoFatura)
Dias |
@endif
Valor Unit. |
Subtotal |
@foreach($itensFatura as $item)
| {{ $item['quantidade'] ?? 1 }} |
{{ $item['produto'] ?? 'Produto' }} |
@if($isMedicaoFatura)
{{ $item['dias'] ?? '-' }} |
@endif
R$ {{ number_format((float) ($item['valor_unitario'] ?? 0), 2, ',', '.') }} |
R$ {{ number_format((float) ($item['subtotal'] ?? 0), 2, ',', '.') }} |
@endforeach
@endif
@if($faturamento->locacao->servicos && $faturamento->locacao->servicos->count() > 0)
SERVIÇOS ADICIONAIS
| Qtd |
Serviço |
Valor Unit. |
Subtotal |
@foreach($faturamento->locacao->servicos as $servico)
| {{ $servico->quantidade ?? 1 }} |
{{ $servico->descricao ?? 'Serviço' }} |
R$ {{ number_format($servico->valor ?? 0, 2, ',', '.') }} |
R$ {{ number_format(($servico->quantidade ?? 1) * ($servico->valor ?? 0), 2, ',', '.') }} |
@endforeach
@endif
@if($faturamento->locacao->valor_desconto ?? 0 > 0)
| Desconto: |
- R$ {{ number_format($faturamento->locacao->valor_desconto, 2, ',', '.') }} |
@endif
@if($faturamento->locacao->valor_acrescimo ?? 0 > 0)
| Acréscimo: |
R$ {{ number_format($faturamento->locacao->valor_acrescimo, 2, ',', '.') }} |
@endif
@if($faturamento->locacao->valor_frete ?? 0 > 0)
| Frete: |
R$ {{ number_format($faturamento->locacao->valor_frete, 2, ',', '.') }} |
@endif
| VALOR TOTAL: |
R$ {{ number_format($faturamento->valor_total, 2, ',', '.') }} |
INFORMAÇÕES DE PAGAMENTO
{{ $parcelas->count() > 1 ? '1º Vencimento:' : 'Vencimento:' }}
{{ $formatarData($primeiroVencimento) }}
Status:
@php
$status = $faturamento->contaReceber->status ?? 'pendente';
$statusClass = $status === 'pago' ? 'status-pago' : 'status-pendente';
$statusLabel = $status === 'pago' ? 'PAGO' : 'PENDENTE';
@endphp
{{ $statusLabel }}
@if($faturamento->locacao->forma_pagamento ?? null)
Forma de Pagamento:
{{ $faturamento->locacao->forma_pagamento }}
@endif
@if($parcelas->count() > 0)
VENCIMENTOS DAS CONTAS
| Parcela |
Documento/Referência |
Vencimento |
Valor |
@foreach($parcelas as $parcela)
| {{ $parcela->numero_parcela ?? 1 }}/{{ $parcela->total_parcelas ?? 1 }} |
{{ $parcela->documento ?? '-' }} |
{{ $formatarData($parcela->data_vencimento ?? null) }} |
R$ {{ number_format((float) ($parcela->valor_total ?? 0), 2, ',', '.') }} |
@endforeach
| Total das Parcelas: |
R$ {{ number_format($parcelas->sum('valor_total'), 2, ',', '.') }} |
@if($parcelas->count() > 1)
* Esta fatura foi parcelada em {{ $parcelas->count() }} vezes. Cada parcela possui data de vencimento própria conforme tabela acima.
@endif
@endif
@if($faturamento->observacoes || $faturamento->locacao->observacoes)
OBSERVAÇÕES
{{ $faturamento->observacoes ?? $faturamento->locacao->observacoes }}
@endif