Atualização 2 da dos Arquivos PDF Holerite e relatório

This commit is contained in:
2026-06-17 15:21:29 -03:00
parent 69448ddabd
commit 5b2de23cfe
3 changed files with 1811 additions and 1368 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -43,10 +43,15 @@ module Pdf
end
def rodape
# canvas usa coordenadas absolutas da página, então o rodapé é desenhado
# DENTRO da margem inferior (y=36), abaixo da área de conteúdo. Antes ele
# ficava em y=20 do bounds — dentro do fluxo do conteúdo — e o texto da
# tabela acabava sobrepondo o "documento interno".
@pdf.repeat(:all) do
@pdf.bounding_box [0, 20], width: @pdf.bounds.width do
@pdf.canvas do
@pdf.fill_color CINZA
@pdf.text "Gerado em #{Time.current.strftime('%d/%m/%Y %H:%M')} · Reem Transporte — documento interno",
@pdf.text_box "Gerado em #{Time.current.strftime('%d/%m/%Y %H:%M')} · Reem Transporte — documento interno",
at: [40, 36], width: @pdf.bounds.width - 80,
size: 8, align: :center
@pdf.fill_color '000000'
end

View File

@@ -37,14 +37,15 @@ module Pdf
secao "PROVENTOS E DESCONTOS"
resumo = @entregas.group(:tipo).count
# Lista os quatro pilares sempre (Normal, Retirada, Bônus, Desconto),
# mesmo zerados, para o motorista ver o descritivo completo.
por_tipo = ConsolidacaoEntrega::TIPO_CORES.map do |tipo, cfg|
qtd = resumo[tipo] || 0
next if qtd.zero?
valor = @entregas.where(tipo: tipo).sum(:valor_aplicado)
valor = qtd.zero? ? 0 : @entregas.where(tipo: tipo).sum(:valor_aplicado)
unit = qtd.zero? ? 0 : (valor / qtd)
sinal = tipo == 'desconto' ? '-' : '+'
[cfg[:label], qtd.to_s, moeda(unit), "#{sinal} #{moeda(valor)}"]
end.compact
end
linhas = [['Descrição', 'Qtd', 'Unit.', 'Valor']] + por_tipo
@pdf.table(linhas, header: true, width: @pdf.bounds.width,