Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Alterar nomenclatura na impressão do boleto #7

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/brcobranca/arquivos/templates/modelo_carne.eps
Binary file not shown.
1,112 changes: 1,112 additions & 0 deletions lib/brcobranca/arquivos/templates/modelo_carne_old.eps

Large diffs are not rendered by default.

Binary file modified lib/brcobranca/arquivos/templates/modelo_generico.eps
Binary file not shown.
Binary file modified lib/brcobranca/arquivos/templates/modelo_generico2.eps
Binary file not shown.
9,967 changes: 9,967 additions & 0 deletions lib/brcobranca/arquivos/templates/modelo_generico2_old.eps

Large diffs are not rendered by default.

Binary file not shown.
4 changes: 2 additions & 2 deletions lib/brcobranca/boleto/template/rghost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ def modelo_generico_rodape(doc, boleto)
move_more(doc, 0, -0.4)
doc.show boleto.sacado_endereco.to_s

move_more(doc, 1.2, -0.93)
move_more(doc, 1.7, -0.93)
doc.show "#{boleto.avalista} - #{boleto.avalista_documento}" if boleto.avalista && boleto.avalista_documento
# FIM Segunda parte do BOLETO
end
end
end
end
end
end
31 changes: 15 additions & 16 deletions lib/brcobranca/boleto/template/rghost2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
gem 'rghost'
require 'rghost'
end

begin
require 'rghost_barcode'
rescue LoadError
require 'rubygems' unless ENV['NO_RUBYGEMS']
gem 'rghost_barcode'
require 'rghost_barcode'
end

module Brcobranca
module Boleto
module Template
Expand All @@ -26,8 +26,8 @@ module Rghost2
RGhost::Config::GS[:external_encoding] = Brcobranca.configuration.external_encoding
RGhost::Config::GS[:default_params] << '-dNOSAFER'
RGhost::Config::GS[:unit]=Units::Cm


# Gera o boleto em usando o formato desejado [:pdf, :jpg, :tif, :png, :ps, :laserjet, ... etc]
#
# @return [Stream]
Expand All @@ -36,7 +36,7 @@ module Rghost2
def to(formato, options = {})
modelo_generico(self, options.merge!(formato: formato))
end

# Gera o boleto em usando o formato desejado [:pdf, :jpg, :tif, :png, :ps, :laserjet, ... etc]
#
# @return [Stream]
Expand All @@ -45,7 +45,7 @@ def to(formato, options = {})
def lote(boletos, options = {})
modelo_generico_multipage(boletos, options)
end

# Cria o métodos dinâmicos (to_pdf, to_gif e etc) com todos os fomátos válidos.
#
# @return [Stream]
Expand All @@ -60,9 +60,9 @@ def method_missing(m, *args)
super
end
end

private

# Retorna um stream pronto para gravação em arquivo.
#
# @return [Stream]
Expand All @@ -83,7 +83,7 @@ def modelo_generico(boleto, options = {})
resolucao = (options.delete(:resolucao) || Brcobranca.configuration.resolucao)
doc.render_stream(formato.to_sym, resolution: resolucao)
end

# Retorna um stream para multiplos boletos pronto para gravação em arquivo.
#
# @return [Stream]
Expand All @@ -108,12 +108,12 @@ def modelo_generico_multipage(boletos, options = {})
resolucao = (options.delete(:resolucao) || Brcobranca.configuration.resolucao)
doc.render_stream(formato.to_sym, resolution: resolucao)
end

# Define o template a ser usado no boleto
def modelo_generico_template(doc, _boleto, template_path)
doc.define_template(:template, template_path, x: '0.732 cm', y: '3.48 cm')
doc.use_template :template

doc.define_tags do
tag :menor, name: "LiberationMono", size: 8
tag :menor2, name: "LiberationMono", size: 6
Expand All @@ -122,7 +122,7 @@ def modelo_generico_template(doc, _boleto, template_path)
tag :maior, name: "Helvetica-Bold", size: 13.5
end
end

# Monta Recibo do Beneficiário
def modelo_recibo_beneficiario(doc, boleto)
doc.moveto x: 4.28, y: 26.87
Expand All @@ -142,7 +142,7 @@ def modelo_recibo_beneficiario(doc, boleto)
doc.moveto x: 4.28, y: 22.95
doc.show boleto.valor_documento.to_currency, tag: :menor
end

# Monta Recibo do Pagador boleto
def modelo_generico_cabecalho(doc, boleto)
monta_logotipo(doc, boleto, 0.782, 19.717, 0.85)
Expand All @@ -168,7 +168,7 @@ def modelo_generico_cabecalho(doc, boleto)
doc.moveto x: 1.109, y: 17.089
doc.show truncar(boleto.sacado, 109), tag: :menor
end

# Monta o corpo e rodapé do layout do boleto
def modelo_generico_rodape(doc, boleto)
monta_logotipo(doc, boleto, 0.782, 13.9, 0.85)
Expand Down Expand Up @@ -210,7 +210,7 @@ def modelo_generico_rodape(doc, boleto)
doc.text_area pagador, width: 18, text_align: :left, x: 2.04611, y: 5.8, row_height: '0.4 cm'
avalista = "#{truncar(boleto.avalista,46)} - CPF/CNPJ: #{boleto.avalista_documento.formata_documento.to_s}" if boleto.avalista && boleto.avalista_documento
if avalista
doc.text_area "<menor2>#{avalista}</menor2>", width: 12.312, text_align: :left, x: 2.04611, y: 4.3, row_height: '0.4 cm'
doc.text_area "<menor2>#{avalista}</menor2>", width: 12.312, text_align: :left, x: 2.3, y: 4.3, row_height: '0.4 cm'
end
# Gerando codigo de barra com rghost_barcode
if boleto.codigo_barras
Expand Down Expand Up @@ -252,4 +252,3 @@ def monta_logotipo(doc, boleto, x, y, scale)
end
end
end

2 changes: 1 addition & 1 deletion lib/brcobranca/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Brcobranca
VERSION = '10.2.2'
VERSION = '10.2.3'
end
Loading