Correção do PDF QRCODE holerite

This commit is contained in:
2026-06-18 20:15:05 -03:00
parent 92ba679a81
commit 13d6c243c3
3 changed files with 36 additions and 11 deletions

View File

@@ -90,7 +90,7 @@ module Pdf
# (direita). Garante espaço criando nova página se o rodapé estiver perto.
def assinaturas(motorista: nil)
@pdf.start_new_page if @pdf.cursor < 120
@pdf.move_down 60
@pdf.move_down 36
metade = (@pdf.bounds.width - 40) / 2.0
topo = @pdf.cursor

View File

@@ -34,7 +34,7 @@ module Pdf
['Período', "#{@consolidacao.data_inicio.strftime('%d/%m/%Y')} a #{@consolidacao.data_fim.strftime('%d/%m/%Y')}"],
['Emissão', Time.current.strftime('%d/%m/%Y')]
]
@pdf.table(info, width: @pdf.bounds.width, cell_style: { size: 10, padding: [5, 8] }) do |t|
@pdf.table(info, width: @pdf.bounds.width, cell_style: { size: 10, padding: [4, 8] }) do |t|
t.columns(0).font_style = :bold
t.columns(0).background_color = 'F3F4F6'
t.columns(0).width = 120
@@ -57,7 +57,7 @@ module Pdf
linhas = [['Descrição', 'Qtd', 'Unit.', 'Valor']] + por_tipo
@pdf.table(linhas, header: true, width: @pdf.bounds.width,
cell_style: { size: 10, padding: [6, 8] }) do |t|
cell_style: { size: 10, padding: [4, 8] }) do |t|
t.row(0).background_color = PRETO
t.row(0).text_color = 'FFFFFF'
t.row(0).font_style = :bold
@@ -67,7 +67,7 @@ module Pdf
total = @entregas.sum { |e| e.desconto? ? -e.valor_aplicado : e.valor_aplicado }
# Caixa do total — destaque laranja
@pdf.move_down 16
@pdf.move_down 12
@pdf.fill_color LARANJA
@pdf.fill_rounded_rectangle [0, @pdf.cursor], @pdf.bounds.width, 50, 8
@pdf.fill_color '000000'
@@ -75,7 +75,7 @@ module Pdf
at: [16, @pdf.cursor - 10], size: 10, style: :bold
@pdf.text_box moeda(total),
at: [16, @pdf.cursor - 24], size: 22, style: :bold
@pdf.move_down 58
@pdf.move_down 48
# Detalhamento: total de entregas e veículos atendidos no período
total_entregas = @entregas.count
@@ -84,7 +84,7 @@ module Pdf
@pdf.text "Total de entregas: #{total_entregas}", size: 9
@pdf.text "Veículos atendidos: #{veiculos.any? ? veiculos.join(', ') : '—'}", size: 9
@pdf.fill_color '000000'
@pdf.move_down 6
@pdf.move_down 4
# QR Code de login rápido. O Prawn não pagina imagem sozinho: se faltar
# espaço, garantimos uma nova página para o QR não sumir no rodapé.
@@ -113,7 +113,7 @@ module Pdf
@pdf.fill_color(pago ? 'FFFFFF' : '374151')
@pdf.text_box texto, at: [12, @pdf.cursor - 8], width: 238, size: 10, style: :bold
@pdf.fill_color '000000'
@pdf.move_down 34
@pdf.move_down 20
end
# Monta a URL respeitando o esquema do APP_HOST. Se vier sem http(s)://
@@ -137,13 +137,13 @@ module Pdf
arquivo.rewind
secao "ACESSO RÁPIDO AO SEU PAINEL"
@pdf.image arquivo.path, width: 110, position: :left
@pdf.move_up 95
@pdf.image arquivo.path, width: 92, position: :left
@pdf.move_up 80
@pdf.text_box "Escaneie este QR Code com a câmera do celular para entrar\n" \
"no seu painel e acompanhar seus pagamentos.\n\n" \
"Ou acesse: #{@app_host.to_s.sub(%r{\Ahttps?://}, '').chomp('/')}/motorista\ne use seu PIN de 4 dígitos.",
at: [130, @pdf.cursor], width: @pdf.bounds.width - 130, size: 9
@pdf.move_down 100
at: [120, @pdf.cursor], width: @pdf.bounds.width - 120, size: 9
@pdf.move_down 85
ensure
arquivo&.close
arquivo&.unlink