Skip to content

Instantly share code, notes, and snippets.

@danielweinmann
Created December 20, 2010 05:58
Show Gist options
  • Save danielweinmann/748077 to your computer and use it in GitHub Desktop.
Save danielweinmann/748077 to your computer and use it in GitHub Desktop.
/lib/boletos.rb
module Boletos
def gera_boleto
codigobanco = "356";
codigo_banco_com_dv = "356-5";
nummoeda = "9";
fator_vencimento = fator_vencimento(@dadosboleto[:data_vencimento])
valor = formata_numero(@dadosboleto[:valor_boleto],10,0,"valor");
agencia = formata_numero(@dadosboleto[:agencia],4,0);
conta = formata_numero(@dadosboleto[:conta],7,0);
carteira = @dadosboleto[:carteira];
nossonumero = formata_numero(@dadosboleto[:nosso_numero],13,0);
digitao_cobranca = modulo_10("#{nossonumero}#{agencia}#{conta}");
# raise "#{nossonumero}#{agencia}#{conta}!!!#{digitao_cobranca.to_s}"
linha = dvBarra("#{codigobanco}#{nummoeda}0#{fator_vencimento}#{valor}#{agencia}#{conta}#{digitao_cobranca}#{nossonumero}");
# raise "#{codigobanco}||#{nummoeda}||0||#{fator_vencimento}||#{valor}||#{agencia}||#{conta}||#{digitao_cobranca}||#{nossonumero}";
agencia_codigo = "#{agencia}/#{conta}/#{digitao_cobranca}"
@dadosboleto[:codigo_barras] = linha
@dadosboleto[:linha_digitavel] = monta_linha_digitavel(linha)
@dadosboleto[:agencia_codigo] = agencia_codigo
@dadosboleto[:nosso_numero] = nossonumero
@dadosboleto[:codigo_banco_com_dv] = codigo_banco_com_dv
end
def dvBarra numero
pesos = "43290876543298765432987654329876543298765432";
if numero.size == 44
soma = 0
0.upto(numero.length) do |i|
m = numero[i,1].to_i * pesos[i,1].to_i
soma += m
end
num_temp = 11 - (soma % 11)
num_temp = 1 if (num_temp >= 10)
numero[4] = num_temp.to_s
end
numero
end
#Fator vencimento, phpboleto
def fator_vencimento(d)
d - Date.new(1997,10,07)
end
#retira as virgulas
#formata o numero
#preenche com zeros
def formata_numero(numero,loop,insert,tipo = "geral")
numero = numero.to_s
insert = insert.to_s
if (tipo == "geral")
numero = numero.gsub(",","")
while numero.size < loop
numero = insert + numero
end
end
if tipo == "valor"
numero = numero.gsub(",","")
while numero.size<loop
numero = insert + numero
end
end
if tipo == "convenio"
while numero.size<loop
numero = insert + numero
end
end
return numero
end
#modulo 10 retirada do phpBoleto
def modulo_10(num)
numtotal10 = 0
fator = 2
num.size.downto(1) do |i|
n = num[i-1,1]
temp = n.to_i * fator
numtotal10 += temp.to_s.split(//).inject(0) { |sum,x| sum+x.to_i }
fator = fator == 2 ? 1 : 2
end
resto = numtotal10 % 10
resto == 0 ? 0 : 10 - resto
end
def modulo_11(num, base=9, r=0)
soma = 0
fator = 2
numeros = {}
parcial = {}
for i in (0..num.size).to_a.reverse
i += 1
numeros[i] = num[i-1,1].to_i
parcial[i] = numeros[i].to_i * fator
soma += parcial[i].to_i
if fator == base
fator = 1
end
fator += 1
end
if r == 0
soma *= 10
digito = soma % 11
if digito == 10
digito = "X"
end
if num.size == 43
# então estamos checando a linha digitável
if digito == "0" or digito == "X" or digito > 9
digito = 1
end
end
return digito
elsif r == 1
resto = soma % 11
return resto
end
end
def monta_linha_digitavel(linha)
# Posição Conteúdo
# 1 a 3 Número do banco
# 4 Código da Moeda - 9 para Real
# 5 Digito verificador do Código de Barras
# 6 a 19 Valor (12 inteeeiros e 2 decimais)
# 20 a 44 Campo Livre definido por cada banco
# 1. Campo - composto pelo código do banco, código da moéda, as cinco primeiras posições
# do campo livre e DV (modulo10) deste campo
p1 = linha[0, 4]
p2 = linha[19, 5]
p3 = modulo_10("#{p1}#{p2}")
p4 = "#{p1}#{p2}#{p3}"
p5 = p4[0, 5]
p6 = p4[5,p4.size]
campo1 = "#{p5}.#{p6}"
# 2. Campo - composto pelas posiçoes 6 a 15 do campo livre
# e livre e DV (modulo10) deste campo
p1 = linha[24, 10]
p2 = modulo_10(p1)
p3 = "#{p1}#{p2}"
p4 = p3[0, 5]
p5 = p3[5,p3.size]
campo2 = "#{p4}.#{p5}"
# 3. Campo composto pelas posicoes 16 a 25 do campo livre
# e livre e DV (modulo10) deste campo
p1 = linha[34, 10]
p2 = modulo_10(p1)
p3 = "#{p1}#{p2}"
p4 = p3[0, 5]
p5 = p3[5,p3.size]
campo3 = "#{p4}.#{p5}"
# 4. Campo - digito verificador do codigo de barras
# raise linha[4, 1].to_s
campo4 = linha[4, 1]
# 5. Campo composto pelo valor nominal pelo valor nominal do documento, sem
# indicacao de zeros a esquerda e sem edicao (sem ponto e virgula). Quando se
# tratar de valor zerado, a representacao deve ser 000 (tres zeros).
campo5 = linha[5, 14]
return "#{campo1} #{campo2} #{campo3} #{campo4} #{campo5}"
end
=begin
// 2. Campo - composto pelas posiçoes 6 a 15 do campo livre
// e livre e DV (modulo10) deste campo
// 3. Campo composto pelas posicoes 16 a 25 do campo livre
// e livre e DV (modulo10) deste campo
$p1 = substr($codigo, 34, 10);
$p2 = modulo_10($p1);
$p3 = "$p1$p2";
$p4 = substr($p3, 0, 5);
$p5 = substr($p3, 5);
$campo3 = "$p4.$p5";
// 4. Campo - digito verificador do codigo de barras
$campo4 = substr($codigo, 4, 1);
// 5. Campo composto pelo fator vencimento e valor nominal do documento, sem
// indicacao de zeros a esquerda e sem edicao (sem ponto e virgula). Quando se
// tratar de valor zerado, a representacao deve ser 000 (tres zeros).
$p1 = substr($codigo, 5, 4);
$p2 = substr($codigo, 9, 10);
$campo5 = "$p1$p2";
return "$campo1 $campo2 $campo3 $campo4 $campo5";
=end
end
<%
=begin
// +----------------------------------------------------------------------+
// | BoletoPhp - Versão Beta |
// +----------------------------------------------------------------------+
// | Este arquivo está disponível sob a Licença GPL disponível pela Web |
// | em http://pt.wikipedia.org/wiki/GNU_General_Public_License |
// | Você deve ter recebido uma cópia da GNU Public License junto com |
// | esse pacote; se não, escreva para: |
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Originado do Projeto BBBoletoFree que tiveram colaborações de Daniel |
// | William Schultz e Leandro Maniezo que por sua vez foi derivado do |
// | PHPBoleto de João Prado Maia e Pablo Martins F. Costa |
// | |
// | Se vc quer colaborar, nos ajude a desenvolver p/ os demais bancos :-)|
// | Acesse o site do Projeto BoletoPhp: www.boletophp.com.br |
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Equipe Coordenação Projeto BoletoPhp: <boletophp@boletophp.com.br> |
// | Desenvolvimento Boleto CEF: Elizeu Alcantara |
// +----------------------------------------------------------------------+
=end
%>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>
<HTML>
<HEAD>
<TITLE><%= @dadosboleto[:identificacao] %></TITLE>
<META http-equiv=Content-Type content=text/html charset=ISO-8859-1>
<meta name="Generator" content="Projeto BoletoPHP - www.boletophp.com.br - Licença GPL" />
<style type=text/css>
<!--.cp { font: bold 10px Arial; color: black}
<!--.ti { font: 9px Arial, Helvetica, sans-serif}
<!--.ld { font: bold 15px Arial; color: #000000}
<!--.ct { FONT: 9px "Arial Narrow"; COLOR: #000033}
<!--.cn { FONT: 9px Arial; COLOR: black }
<!--.bc { font: bold 20px Arial; color: #000000 }
<!--.ld2 { font: bold 12px Arial; color: #000000 }
--></style>
</head>
<BODY text=#000000 bgColor=#ffffff topMargin=0 rightMargin=0>
<table width=666 cellspacing=0 cellpadding=0 border=0><tr><td valign=top class=cp><DIV ALIGN="CENTER">Instruções
de Impressão</DIV></TD></TR><TR><TD valign=top class=cp><DIV ALIGN="left">
<p>
<li>Imprima em impressora jato de tinta (ink jet) ou laser em qualidade normal ou alta (Não use modo econômico).<br>
<li>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) e margens mínimas à esquerda e à direita do formulário.<br>
<li>Corte na linha indicada. Não rasure, risque, fure ou dobre a região onde se encontra o código de barras.<br>
<li>Caso não apareça o código de barras no final, clique em F5 para atualizar esta tela.
<li>Caso tenha problemas ao imprimir, copie a seqüencia numérica abaixo e pague no caixa eletrônico ou no internet banking:<br><br>
<span class="ld2">
&nbsp;&nbsp;&nbsp;&nbsp;Linha Digitável: &nbsp;<%= @dadosboleto[:linha_digitavel] %><br>
&nbsp;&nbsp;&nbsp;&nbsp;Valor: &nbsp;&nbsp;R$ <%= @dadosboleto[:valor_boleto] %><br>
</span>
</DIV></td></tr></table><br><table cellspacing=0 cellpadding=0 width=666 border=0><TBODY><TR><TD class=ct width=666><img height=1 src=/images/real/6.png width=665 border=0></TD></TR><TR><TD class=ct width=666><div align=right><b class=cp>Recibo
do Sacado</b></div></TD></tr></tbody></table><table width=666 cellspacing=5 cellpadding=0 border=0><tr><td width=41></TD></tr></table>
<!--
<table width=666 cellspacing=5 cellpadding=0 border=0 align=Default>
<tr>
<td width=41><IMG SRC="/images/logo_2.png"></td>
<td class=ti width=455><%= @dadosboleto[:identificacao] %> <%= @dadosboleto[:cpf_cnpj] %><br>
<%= @dadosboleto[:endereco] %><br>
<%= @dadosboleto[:cidade_uf] %><br>
</td>
<td align=RIGHT width=150 class=ti>&nbsp;</td>
</tr>
</table>
-->
<BR><table cellspacing=0 cellpadding=0 width=666 border=0><tr><td class=cp width=150>
<span class="campo"><IMG
src="/images/real/logoreal.jpg" width="150" height="40"
border=0></span></td>
<td width=3 valign=bottom><img height=22 src=/images/real/3.png width=2 border=0></td><td class=cpt width=58 valign=bottom><div align=center><font class=bc><%= @dadosboleto[:codigo_banco_com_dv] %></font></div></td><td width=3 valign=bottom><img height=22 src=/images/real/3.png width=2 border=0></td><td class=ld align=right width=453 valign=bottom><span class=ld>
<span class="campotitulo">
<%= @dadosboleto[:linha_digitavel] %>
</span></span></td>
</tr><tbody><tr><td colspan=5><img height=2 src=/images/real/2.png width=666 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=298 height=13>Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=126 height=13>Agência/Código
do Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=34 height=13>Espécie</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=53 height=13>Quantidade</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=120 height=13>Nosso
número</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=298 height=12>
<span class="campo"><%= @dadosboleto[:cedente] %></span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=126 height=12>
<span class="campo">
<%= @dadosboleto[:agencia_codigo] %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=34 height=12><span class="campo">
<%= @dadosboleto[:especie] %>
</span>
</td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=53 height=12><span class="campo">
<%= @dadosboleto[:quantidade] %>
</span>
</td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=120 height=12>
<span class="campo">
<%= @dadosboleto[:nosso_numero] %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=298 height=1><img height=1 src=/images/real/2.png width=298 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=126 height=1><img height=1 src=/images/real/2.png width=126 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=34 height=1><img height=1 src=/images/real/2.png width=34 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=53 height=1><img height=1 src=/images/real/2.png width=53 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=120 height=1><img height=1 src=/images/real/2.png width=120 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top colspan=3 height=13>Número
do documento</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=132 height=13>CPF/CNPJ</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=134 height=13>Vencimento</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>Valor
documento</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top colspan=3 height=12>
<span class="campo">
<%= @dadosboleto[:numero_documento] %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=132 height=12>
<span class="campo">
<%= @dadosboleto[:cpf_cnpj] %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=134 height=12>
<span class="campo">
<%= @dadosboleto[:data_vencimento].to_s_br %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
<span class="campo">
<%= @dadosboleto[:valor_boleto] %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=/images/real/2.png width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=72 height=1><img height=1 src=/images/real/2.png width=72 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=132 height=1><img height=1 src=/images/real/2.png width=132 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=134 height=1><img height=1 src=/images/real/2.png width=134 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=113 height=13>(-)
Desconto / Abatimentos</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=112 height=13>(-)
Outras deduções</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=113 height=13>(+)
Mora / Multa</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=113 height=13>(+)
Outros acréscimos</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
Valor cobrado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=113 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=112 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=113 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=113 height=12></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=/images/real/2.png width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=112 height=1><img height=1 src=/images/real/2.png width=112 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=/images/real/2.png width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=/images/real/2.png width=113 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=659 height=13>Sacado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=659 height=12>
<span class="campo">
<%= @dadosboleto[:sacado] %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=659 height=1><img height=1 src=/images/real/2.png width=659 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct width=7 height=12></td><td class=ct width=564 >Demonstrativo</td><td class=ct width=7 height=12></td><td class=ct width=88 >Autenticação
mecânica</td></tr><tr><td width=7 ></td><td class=cp width=564 >
<span class="campo">
<%= @dadosboleto[:demonstrativo1] %><br>
<%= @dadosboleto[:demonstrativo2] %><br>
<%= @dadosboleto[:demonstrativo3] %><br>
</span>
</td><td width=7 ></td><td width=88 ></td></tr></tbody></table><table cellspacing=0 cellpadding=0 width=666 border=0><tbody><tr><td width=7></td><td width=500 class=cp>
<br><br><br>
</td><td width=159></td></tr></tbody></table><table cellspacing=0 cellpadding=0 width=666 border=0><tr><td class=ct width=666></td></tr><tbody><tr><td class=ct width=666>
<div align=right>Corte na linha pontilhada</div></td></tr><tr><td class=ct width=666><img height=1 src=/images/real/6.png width=665 border=0></td></tr></tbody></table><br><table cellspacing=0 cellpadding=0 width=666 border=0><tr><td class=cp width=150>
<span class="campo"><IMG
src="/images/real/logoreal.jpg" width="150" height="40"
border=0></span></td>
<td width=3 valign=bottom><img height=22 src=/images/real/3.png width=2 border=0></td><td class=cpt width=58 valign=bottom><div align=center><font class=bc><%= @dadosboleto[:codigo_banco_com_dv] %></font></div></td><td width=3 valign=bottom><img height=22 src=/images/real/3.png width=2 border=0></td><td class=ld align=right width=453 valign=bottom><span class=ld>
<span class="campotitulo">
<%= @dadosboleto[:linha_digitavel] %>
</span></span></td>
</tr><tbody><tr><td colspan=5><img height=2 src=/images/real/2.png width=666 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=472 height=13>Local
de pagamento</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>Vencimento</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=472 height=12>Pagável
em qualquer Banco até o vencimento</td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
<span class="campo">
<%= @dadosboleto[:data_vencimento].to_s_br %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=/images/real/2.png width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=472 height=13>Cedente</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>Agência/Código
cedente</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=472 height=12>
<span class="campo">
<%= @dadosboleto[:cedente] %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
<span class="campo">
<%= @dadosboleto[:agencia_codigo] %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=/images/real/2.png width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13>
<img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=113 height=13>Data
do documento</td><td class=ct valign=top width=7 height=13> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=153 height=13>N<u>o</u>
documento</td><td class=ct valign=top width=7 height=13> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=62 height=13>Espécie
doc.</td><td class=ct valign=top width=7 height=13> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=34 height=13>Aceite</td><td class=ct valign=top width=7 height=13>
<img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=82 height=13>Data
processamento</td><td class=ct valign=top width=7 height=13> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>Nosso
número</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=113 height=12><div align=left>
<span class="campo">
<%= @dadosboleto[:data_documento].to_s_br %>
</span></div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=153 height=12>
<span class="campo">
<%= @dadosboleto[:numero_documento] %>
</span></td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=62 height=12><div align=left><span class="campo">
<%= @dadosboleto[:especie_doc] %>
</span>
</div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=34 height=12><div align=left><span class="campo">
<%= @dadosboleto[:aceite] %>
</span>
</div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=82 height=12><div align=left>
<span class="campo">
<%= @dadosboleto[:data_processamento].to_s_br %>
</span></div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
<span class="campo">
<%= @dadosboleto[:nosso_numero] %>
</span></td>
</tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=113 height=1><img height=1 src=/images/real/2.png width=113 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=153 height=1><img height=1 src=/images/real/2.png width=153 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=62 height=1><img height=1 src=/images/real/2.png width=62 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=34 height=1><img height=1 src=/images/real/2.png width=34 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=82 height=1><img height=1 src=/images/real/2.png width=82 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1>
<img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr>
<td class=ct valign=top width=7 height=13> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top COLSPAN="3" height=13>Uso
do banco</td><td class=ct valign=top height=13 width=7> <img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=83 height=13>Carteira</td><td class=ct valign=top height=13 width=7>
<img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=53 height=13>Espécie</td><td class=ct valign=top height=13 width=7>
<img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=123 height=13>Quantidade</td><td class=ct valign=top height=13 width=7>
<img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=72 height=13>
Valor Documento</td><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
Valor documento</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td valign=top class=cp height=12 COLSPAN="3"><div align=left>
</div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=83>
<div align=left> <span class="campo">
<%= @dadosboleto[:carteira] %>
</span></div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=53><div align=left><span class="campo">
<%= @dadosboleto[:especie] %>
</span>
</div></td><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=123><span class="campo">
<%= @dadosboleto[:quantidade] %>
</span>
</td>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=72>
<span class="campo">
<%= @dadosboleto[:valor_unitario] %>
</span></td>
<td class=cp valign=top width=7 height=12> <img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12>
<span class="campo">
<%= @dadosboleto[:valor_boleto] %>
</span></td>
</tr><tr><td valign=top width=7 height=1> <img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=75 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=31 height=1><img height=1 src=/images/real/2.png width=31 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=83 height=1><img height=1 src=/images/real/2.png width=83 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=53 height=1><img height=1 src=/images/real/2.png width=53 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=123 height=1><img height=1 src=/images/real/2.png width=123 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=72 height=1><img height=1 src=/images/real/2.png width=72 border=0></td><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody>
</table><table cellspacing=0 cellpadding=0 width=666 border=0><tbody><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody>
<tr> <td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td></tr><tr>
<td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td></tr><tr>
<td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=1 border=0></td></tr></tbody></table></td><td valign=top width=468 rowspan=5><font class=ct>Instruções
(Texto de responsabilidade do cedente)</font><br><br><span class=cp> <FONT class=campo>
<%= @dadosboleto[:instrucoes1] %><br>
<%= @dadosboleto[:instrucoes2] %><br>
<%= @dadosboleto[:instrucoes3] %><br>
<%= @dadosboleto[:instrucoes4] %></FONT><br><br>
</span></td>
<td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(-)
Desconto / Abatimentos</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr>
<td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10>
<table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td></tr><tr><td valign=top width=7 height=1>
<img height=1 src=/images/real/2.png width=1 border=0></td></tr></tbody></table></td><td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(-)
Outras deduções</td></tr><tr><td class=cp valign=top width=7 height=12> <img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10>
<table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13>
<img height=13 src=/images/real/1.png width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=1 border=0></td></tr></tbody></table></td><td align=right width=188>
<table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(+)
Mora / Multa</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr>
<td valign=top width=7 height=1> <img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1>
<img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr>
<td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=1 border=0></td></tr></tbody></table></td><td align=right width=188>
<table cellspacing=0 cellpadding=0 border=0><tbody><tr> <td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(+)
Outros acréscimos</td></tr><tr> <td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table></td></tr><tr><td align=right width=10><table cellspacing=0 cellpadding=0 border=0 align=left><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td></tr></tbody></table></td><td align=right width=188><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>(=)
Valor cobrado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top align=right width=180 height=12></td></tr></tbody>
</table></td></tr></tbody></table><table cellspacing=0 cellpadding=0 width=666 border=0><tbody><tr><td valign=top width=666 height=1><img height=1 src=/images/real/2.png width=666 border=0></td></tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=659 height=13>Sacado</td></tr><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=659 height=12><span class="campo">
<%= @dadosboleto[:sacado] %>
</span>
</td>
</tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=cp valign=top width=7 height=12><img height=12 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=659 height=12><span class="campo">
<%= @dadosboleto[:endereco1] %>
</span>
</td>
</tr></tbody></table><table cellspacing=0 cellpadding=0 border=0><tbody><tr><td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=cp valign=top width=472 height=13>
<span class="campo">
<%= @dadosboleto[:endereco2] %>
</span></td>
<td class=ct valign=top width=7 height=13><img height=13 src=/images/real/1.png width=1 border=0></td><td class=ct valign=top width=180 height=13>Cód.
baixa</td></tr><tr><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=472 height=1><img height=1 src=/images/real/2.png width=472 border=0></td><td valign=top width=7 height=1><img height=1 src=/images/real/2.png width=7 border=0></td><td valign=top width=180 height=1><img height=1 src=/images/real/2.png width=180 border=0></td></tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 border=0 width=666><TBODY><TR><TD class=ct width=7 height=12></TD><TD class=ct width=409 >Sacador/Avalista</TD><TD class=ct width=250 ><div align=right>Autenticação
mecânica - <b class=cp>Ficha de Compensação</b></div></TD></TR><TR><TD class=ct colspan=3 ></TD></tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 width=666 border=0><TBODY><TR><TD vAlign=bottom align=left height=50><%= fbarcode( @dadosboleto[:codigo_barras]) %>
</TD>
</tr></tbody></table><TABLE cellSpacing=0 cellPadding=0 width=666 border=0><TR><TD class=ct width=666></TD></TR><TBODY><TR><TD class=ct width=666><div align=right>Corte
na linha pontilhada</div></TD></TR><TR><TD class=ct width=666><img height=1 src=/images/real/6.png width=665 border=0></TD></tr></tbody></table>
</BODY></HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment