{% macro decimal_br(valor, casas=2) -%}{{ valor|formatar_decimal_br_milhar(casas) }}{%- endmacro %} {% macro moeda_br(valor, casas=2) -%}{{ valor|formatar_moeda_br(casas) }}{%- endmacro %}

{{ empresa.razao_social if empresa else 'EMPRESA' }}

CNPJ: {{ empresa.cnpj if empresa else 'N/A' }}

{% if empresa %}

{{ empresa.logradouro or '' }}{% if empresa.numero %}, {{ empresa.numero }}{% endif %} - {{ empresa.municipio or '' }}/{{ empresa.uf or '' }}

{% endif %}

Emissão: {{ data_emissao.strftime('%d/%m/%Y %H:%M:%S') }}

Página 1 de 1

RELATÓRIO DE FECHAMENTO DE CAIXA

Movimentação Financeira - Caixa #{{ caixa.numero_caixa }}

Abertura {{ formatar_datetime_operacional(caixa.data_abertura, '%d/%m/%Y %H:%M', caixa.empresa) }}
Fechamento {% if caixa.data_fechamento %}{{ formatar_datetime_operacional(caixa.data_fechamento, '%d/%m/%Y %H:%M', caixa.empresa) }}{% else %}Em aberto{% endif %}
Operador {{ caixa.usuario.username if caixa.usuario and caixa.usuario.username else (caixa.usuario.email if caixa.usuario else 'N/A') }}
Situação {% if caixa.status == 'aberto' %} ABERTO {% else %} FECHADO {% endif %}
Total de Vendas
{{ estatisticas_vendas.total }}
Vendas Finalizadas
{{ estatisticas_vendas.finalizadas }}
{{ moeda_br(estatisticas_vendas.valor_finalizadas) }}
Vendas em Aberto
{{ estatisticas_vendas.abertas }}
{{ moeda_br(estatisticas_vendas.valor_abertas) }}
Vendas Canceladas
{{ estatisticas_vendas.canceladas }}
{{ moeda_br(estatisticas_vendas.valor_canceladas) }}
Fundo Inicial
{{ moeda_br(caixa.valor_abertura or 0) }}
Saldo em Caixa
{{ moeda_br(totais.saldo_caixa) }}
{% if caixa.status == 'fechado' %}
📋 RESUMO DO FECHAMENTO
Vendas Reais
{{ moeda_br(estatisticas_vendas.valor_finalizadas) }}
Valor Esperado
{{ moeda_br(caixa.valor_esperado or 0) }}
Valor Contado
{{ moeda_br(caixa.valor_informado or 0) }}
Diferença
{% set diferenca_arred = (caixa.diferenca or 0)|round(2) %}
{{ moeda_br(diferenca_arred) }}
Situação
{% set diferenca_arred = (caixa.diferenca or 0)|round(2) %} {% if diferenca_arred < 0 %}
⚠️ FALTA
{% elif diferenca_arred > 0 %}
✅ SOBRA
{% else %}
✓ CONFERIDO
{% endif %}
{% endif %}
📊 MOVIMENTO DE CAIXA POR FORMA DE PAGAMENTO
O campo Fundo Inicial representa apenas o troco de abertura e não compõe as vendas.
{% for forma in formas_movimento %} {% endfor %}
Cód. Forma de Pagamento Venda Bruta Trocas/Dev. Venda Líquida Receb. Carnês Sangria/Sup. Fundo Inicial Total Saldo em Caixa Diferença
{{ forma.codigo }} {{ forma.nome }} {{ decimal_br(forma.total_bruto) }} {{ decimal_br(forma.trocas) }} {{ decimal_br(forma.total_liquido) }} {{ decimal_br(forma.recebimento_carnes) }} {{ decimal_br(forma.sangria_suprimento) }} {{ decimal_br(forma.fundo_inicial) }} {{ decimal_br(forma.total) }} {{ decimal_br(forma.saldo_caixa) }} {{ decimal_br(forma.diferenca) }}
TOTAL GERAL {{ decimal_br(totais.total_bruto) }} {{ decimal_br(totais.trocas) }} {{ decimal_br(totais.total_liquido) }} {{ decimal_br(totais.recebimento_carnes) }} {{ decimal_br(totais.sangria_suprimento) }} {{ decimal_br(totais.fundo_inicial) }} {{ decimal_br(totais.total) }} {{ decimal_br(totais.saldo_caixa) }} {{ decimal_br(totais.diferenca) }}
{% if movimentos %}
💰 SUPRIMENTOS E SANGRIAS (movimentações avulsas — não representa o saldo total do caixa)
{% set total_mov = {'entrada': 0, 'saida': 0} %} {% for mov in movimentos|sort(attribute='data_hora') %} {% endfor %}
Hora Operador Descrição Tipo Espécie Valor
{{ formatar_datetime_operacional(mov.data_hora, '%H:%M:%S', caixa.empresa) }} {{ mov.usuario.username if mov.usuario and mov.usuario.username else (mov.usuario.email if mov.usuario else (caixa.usuario.username if caixa.usuario else 'N/A')) }} {{ mov.descricao or mov.observacoes or ('FUNDO INICIAL' if loop.first and mov.tipo == 'suprimento' else mov.tipo|upper) }} {% if mov.tipo == 'suprimento' %} ENTRADA {% set _ = total_mov.update({'entrada': total_mov.entrada + mov.valor}) %} {% else %} SAÍDA {% set _ = total_mov.update({'saida': total_mov.saida + mov.valor}) %} {% endif %} {{ mov.forma_pagamento|upper if mov.forma_pagamento else 'DINHEIRO' }} {% if mov.tipo == 'sangria' %}-{% endif %}{{ moeda_br(mov.valor) }}
Entradas: {{ moeda_br(total_mov.entrada) }}
Saídas: -{{ moeda_br(total_mov.saida) }}
Líquido movimentos: {{ moeda_br(total_mov.entrada - total_mov.saida) }}
{% endif %}
{% if auto_print %} {% endif %}