Correção do QRCODE holerite

This commit is contained in:
2026-06-18 20:21:58 -03:00
parent 13d6c243c3
commit 6d246cadb8
3 changed files with 24 additions and 11 deletions

View File

@@ -89,7 +89,7 @@ module Pdf
# Bloco de assinaturas lado a lado: motorista (esquerda) e administrador
# (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.start_new_page if @pdf.cursor < 100
@pdf.move_down 36
metade = (@pdf.bounds.width - 40) / 2.0

View File

@@ -75,7 +75,8 @@ 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 48
# >= altura da caixa (50) para a próxima linha não a sobrepor.
@pdf.move_down 56
# Detalhamento: total de entregas e veículos atendidos no período
total_entregas = @entregas.count
@@ -113,7 +114,8 @@ 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 20
# >= altura da caixa (26) para o conteúdo seguinte não a sobrepor.
@pdf.move_down 32
end
# Monta a URL respeitando o esquema do APP_HOST. Se vier sem http(s)://
@@ -137,13 +139,18 @@ module Pdf
arquivo.rewind
secao "ACESSO RÁPIDO AO SEU PAINEL"
@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" \
qr_lado = 95
topo = @pdf.cursor
# Posição absoluta (at:) NÃO move o cursor — evita o cálculo frágil de
# move_up/move_down que sobrepunha o QR ao texto/assinaturas. Depois
# avançamos o cursor manualmente pela altura da imagem (quadrada).
@pdf.image arquivo.path, at: [0, topo], width: qr_lado
@pdf.text_box "Escaneie este QR Code com a câmera do celular para entrar " \
"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: [120, @pdf.cursor], width: @pdf.bounds.width - 120, size: 9
@pdf.move_down 85
at: [qr_lado + 20, topo], width: @pdf.bounds.width - qr_lado - 20, size: 9
@pdf.move_down qr_lado + 8
ensure
arquivo&.close
arquivo&.unlink