Class: BrBoleto::Remessa::Cnab240::Itau

Inherits:
Base show all
Defined in:
lib/br_boleto/remessa/cnab240/itau.rb

Instance Attribute Summary

Attributes inherited from Base

#lotes, #mensagem_1, #mensagem_2

Attributes inherited from Base

#data_hora_arquivo, #sequencial_remessa

Instance Method Summary collapse

Methods inherited from Base

class_for_lote, #dados_do_arquivo, #monta_lote, #pagamento_valid_distribuicao_boleto_length, #pagamento_valid_emissao_boleto_length, #usa_segmento_R?

Methods included from Helper::TrailerArquivo

#monta_trailer_arquivo, #trailer_arquivo_posicao_001_a_003, #trailer_arquivo_posicao_004_a_007, #trailer_arquivo_posicao_008_a_008, #trailer_arquivo_posicao_009_a_017, #trailer_arquivo_posicao_018_a_023, #trailer_arquivo_posicao_024_a_029, #trailer_arquivo_posicao_030_a_035, #trailer_arquivo_posicao_036_a_240

Methods included from Helper::TrailerLote

#monta_trailer_lote, #trailer_lote_posicao_001_a_003, #trailer_lote_posicao_004_a_007, #trailer_lote_posicao_008_a_008, #trailer_lote_posicao_009_a_017, #trailer_lote_posicao_018_a_023, #trailer_lote_posicao_024_a_240

Methods included from Helper::SegmentoS

#monta_segmento_s, #segmento_s_posicao_001_a_003, #segmento_s_posicao_004_a_007, #segmento_s_posicao_008_a_008, #segmento_s_posicao_009_a_013, #segmento_s_posicao_014_a_014, #segmento_s_posicao_015_a_015, #segmento_s_posicao_016_a_017, #segmento_s_posicao_018_a_018, #segmento_s_posicao_019_a_020_tipo_impressao_1_ou_2, #segmento_s_posicao_019_a_058_tipo_impressao_3, #segmento_s_posicao_021_a_160_tipo_impressao_1_ou_2, #segmento_s_posicao_059_a_098_tipo_impressao_3, #segmento_s_posicao_099_a_138_tipo_impressao_3, #segmento_s_posicao_139_a_178_tipo_impressao_3, #segmento_s_posicao_161_a_162_tipo_impressao_1_ou_2, #segmento_s_posicao_163_a_240_tipo_impressao_1_ou_2, #segmento_s_posicao_179_a_218_tipo_impressao_3, #segmento_s_posicao_219_a_240_tipo_impressao_3, #segmento_s_tipo_impressao_1_ou_2, #segmento_s_tipo_impressao_3

Methods included from Helper::SegmentoR

#monta_segmento_r, #segmento_r_posicao_001_a_003, #segmento_r_posicao_004_a_007, #segmento_r_posicao_008_a_008, #segmento_r_posicao_009_a_013, #segmento_r_posicao_014_a_014, #segmento_r_posicao_015_a_015, #segmento_r_posicao_016_a_017, #segmento_r_posicao_018_a_018, #segmento_r_posicao_019_a_026, #segmento_r_posicao_027_a_041, #segmento_r_posicao_042_a_042, #segmento_r_posicao_043_a_050, #segmento_r_posicao_051_a_065, #segmento_r_posicao_066_a_066, #segmento_r_posicao_067_a_074, #segmento_r_posicao_075_a_089, #segmento_r_posicao_090_a_099, #segmento_r_posicao_100_a_139, #segmento_r_posicao_140_a_179, #segmento_r_posicao_180_a_199, #segmento_r_posicao_200_a_207, #segmento_r_posicao_208_a_210, #segmento_r_posicao_211_a_215, #segmento_r_posicao_216_a_216, #segmento_r_posicao_217_a_228, #segmento_r_posicao_229_a_229, #segmento_r_posicao_230_a_230, #segmento_r_posicao_231_a_231, #segmento_r_posicao_232_a_240

Methods included from Helper::SegmentoQ

#monta_segmento_q, #segmento_q_posicao_001_a_003, #segmento_q_posicao_004_a_007, #segmento_q_posicao_008_a_008, #segmento_q_posicao_009_a_013, #segmento_q_posicao_014_a_014, #segmento_q_posicao_015_a_015, #segmento_q_posicao_016_a_017, #segmento_q_posicao_018_a_018, #segmento_q_posicao_019_a_033, #segmento_q_posicao_034_a_073, #segmento_q_posicao_074_a_113, #segmento_q_posicao_114_a_128, #segmento_q_posicao_129_a_133, #segmento_q_posicao_134_a_136, #segmento_q_posicao_137_a_151, #segmento_q_posicao_152_a_153, #segmento_q_posicao_154_a_154, #segmento_q_posicao_155_a_169, #segmento_q_posicao_170_a_209, #segmento_q_posicao_210_a_212, #segmento_q_posicao_213_a_232, #segmento_q_posicao_233_a_240

Methods included from Helper::SegmentoP

#monta_segmento_p, #segmento_p_posicao_001_a_003, #segmento_p_posicao_004_a_007, #segmento_p_posicao_008_a_008, #segmento_p_posicao_009_a_013, #segmento_p_posicao_014_a_014, #segmento_p_posicao_015_a_015, #segmento_p_posicao_016_a_017, #segmento_p_posicao_018_a_022, #segmento_p_posicao_024_a_057, #segmento_p_posicao_063_a_077, #segmento_p_posicao_078_a_085, #segmento_p_posicao_086_a_100, #segmento_p_posicao_101_a_105, #segmento_p_posicao_107_a_108, #segmento_p_posicao_109_a_109, #segmento_p_posicao_110_a_117, #segmento_p_posicao_119_a_126, #segmento_p_posicao_127_a_141, #segmento_p_posicao_142_a_142, #segmento_p_posicao_143_a_150, #segmento_p_posicao_151_a_165, #segmento_p_posicao_166_a_180, #segmento_p_posicao_181_a_195, #segmento_p_posicao_196_a_220, #segmento_p_posicao_221_a_221, #segmento_p_posicao_222_a_223, #segmento_p_posicao_224_a_224, #segmento_p_posicao_225_a_227, #segmento_p_posicao_230_a_239, #segmento_p_posicao_240_a_240

Methods included from Helper::HeaderLote

#header_lote_posicao_001_a_003, #header_lote_posicao_004_a_007, #header_lote_posicao_008_a_008, #header_lote_posicao_009_a_009, #header_lote_posicao_010_a_011, #header_lote_posicao_012_a_013, #header_lote_posicao_014_a_016, #header_lote_posicao_017_a_017, #header_lote_posicao_018_a_018, #header_lote_posicao_019_a_033, #header_lote_posicao_034_a_053, #header_lote_posicao_054_a_073, #header_lote_posicao_074_a_103, #header_lote_posicao_104_a_143, #header_lote_posicao_144_a_183, #header_lote_posicao_184_a_191, #header_lote_posicao_192_a_199, #header_lote_posicao_200_a_207, #header_lote_posicao_208_a_240, #monta_header_lote

Methods included from Helper::HeaderArquivo

#header_arquivo_posicao_001_a_003, #header_arquivo_posicao_004_a_007, #header_arquivo_posicao_008_a_008, #header_arquivo_posicao_009_a_017, #header_arquivo_posicao_018_a_018, #header_arquivo_posicao_019_a_032, #header_arquivo_posicao_033_a_052, #header_arquivo_posicao_053_a_072, #header_arquivo_posicao_073_a_102, #header_arquivo_posicao_103_a_132, #header_arquivo_posicao_133_a_142, #header_arquivo_posicao_143_a_143, #header_arquivo_posicao_144_a_151, #header_arquivo_posicao_152_a_157, #header_arquivo_posicao_158_a_163, #header_arquivo_posicao_164_a_166, #header_arquivo_posicao_167_a_171, #header_arquivo_posicao_212_a_240, #monta_header_arquivo

Methods inherited from Base

#data_geracao, #hora_geracao, #pagamento_valid_cod_desconto_length, #pagamento_valid_distribuicao_boleto_length, #pagamento_valid_emissao_boleto_length, #pagamento_valid_tipo_impressao_required, #persisted?

Methods included from HaveConta

#conta, #conta=

Methods inherited from ActiveModelBase

#assign_attributes, #default_values, #initialize

Constructor Details

This class inherits a constructor from BrBoleto::ActiveModelBase

Instance Method Details

#codigo_convenioObject

COMPLEMENTO DE REGISTRO Para o Itau esse espaço deve ter ‘Brancos’ 20 posições



71
72
73
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 71

def codigo_convenio
  ''.adjust_size_to(20)
end

#complemento_header_arquivoObject



62
63
64
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 62

def complemento_header_arquivo
  "#{header_posicao_226_a_228}#{header_posicao_229_a_240}"
end

#complemento_p(pagamento) ⇒ Object

segmento_p_posicao_024_a_057 DESCRIÇÃO TAMANHO POSIÇÃO


COMPLEMENTO DE REGISTRO (ZEROS) 07 24 - 30 NÚMERO DA CONTA CORRENTE 05 31 - 35 COMPLEMENTO DE REGISTRO (BRANCO) 01 36 - 36 DV AG./CONTA EMPRESA 01 37 - 37 NÚMERO DA CARTEIRA 03 38 - 40 NÚMERO DOCUMENTO 08 41 - 48 NOSSO NÚMERO DV 01 49 - 49 COMPLEMENTO DE REGISTRO (BRANCOS) 08 50 - 57

TOTAL = 34 posições



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 99

def complemento_p(pagamento)
  complemento = ''.adjust_size_to(7, '0', :right)
  complemento << "#{conta.conta_corrente}".adjust_size_to(5, '0', :right)
  complemento << ''.rjust(1)
  complemento << "#{conta.conta_corrente_dv}".adjust_size_to(1, '0', :right)
  complemento << "#{conta.carteira}".adjust_size_to(3, '0', :right)
  complemento << "#{pagamento.numero_documento}".adjust_size_to(8, '0', :right)
  complemento << "#{pagamento.nosso_numero}".split('').last
  complemento << ''.rjust(8)
  complemento
end

#complemento_trailer_lote(lote, nr_lote) ⇒ Object

trailer_lote_posicao_024_a_240(lote, nr_lote) DESCRIÇÃO TAMANHO POSIÇÃO


Qtd. Títulos em Cobrança 006 024 - 029 Val. Tot. Títulos em Carteiras 017 030 - 046 Qtd. Títulos em Cobrança 006 047 - 052 Val. Tot. Títulos em Carteiras 017 053 - 069 Complemento De Registro (Zeros) 046 070 - 115 Aviso Bancário (Brancos) 008 116 - 123 Uso FEBRABAN 117 124 - 240

TOTAL = 217 posições



180
181
182
183
184
185
186
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 180

def complemento_trailer_lote(lote, nr_lote)
  complemento = ''
  complemento << ''.rjust(92, '0')  # VALORES UTILIZADOS APENAS PARA ARQUIVO DE RETORNO
  complemento << ''.rjust(8, ' ')   # REFERÊNCIA DO AVISO BANCÁRIO
  complemento << ''.rjust(117, ' ') # USO EXCLUSIVO FEBRABAN
  complemento
end

#conta_classObject



6
7
8
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 6

def conta_class
  BrBoleto::Conta::Itau
end

#convenio_lote(lote) ⇒ Object



74
75
76
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 74

def convenio_lote(lote)
  codigo_convenio
end

#header_arquivo_posicao_172_a_191Object



41
42
43
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 41

def header_arquivo_posicao_172_a_191
  header_arquivo_posicao_172_a_225
end

#header_arquivo_posicao_172_a_225Object

Espaço reservado para o Banco Para o Itau esse espaço deve ter ‘Brancos’ 54 posições



38
39
40
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 38

def header_arquivo_posicao_172_a_225
  ''.rjust(54)
end

#header_arquivo_posicao_192_a_211Object



44
45
46
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 44

def header_arquivo_posicao_192_a_211
  ''
end

#header_posicao_226_a_228Object

Posição 226 a 228 do Header do Arquivo Para o Itau esse espaço deve ter ‘Zeros’ 3 posições



51
52
53
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 51

def header_posicao_226_a_228
  ''.rjust(3, '0')
end

#header_posicao_229_a_240Object

Posição 229 a 240 do Header do Arquivo Para o Itau esse espaço deve ter ‘Brancos’ 12 posições



58
59
60
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 58

def header_posicao_229_a_240
  ''.rjust(12)
end

#informacoes_da_contaObject

Informação da conta DESCRIÇÃO TAMANHO POSIÇÃO


Complemento Registro (Zero) 01 53 - 53 Agencia 04 54 - 57 Complemento Registro (Branco) 01 58 - 58 Complemento Registro (Zeros) 07 59 - 65 Conta Corrente 05 66 - 70 Complemento Registro (Branco) 01 71 - 71 DV da Conta 01 72 - 72

TOTAL = 20 posições



24
25
26
27
28
29
30
31
32
33
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 24

def informacoes_da_conta
  informacoes =  ''.rjust(1, '0')
  informacoes << "#{conta.agencia}".adjust_size_to(4, '0', :right)
  informacoes << ''.rjust(1)
  informacoes << ''.rjust(7, '0')
  informacoes << "#{conta.conta_corrente}".adjust_size_to(5, '0', :right)
  informacoes << ''.rjust(1)
  informacoes << "#{conta.conta_corrente_dv}".adjust_size_to(1, '0')
  informacoes
end

#segmento_p_numero_do_documento(pagamento) ⇒ Object

segmento_p_posicao_063_a_077 DESCRIÇÃO TAMANHO POSIÇÃO


Número Doc. 10 63 - 72 Brancos 05 73 - 77 TOTAL = 15 posições



139
140
141
142
143
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 139

def segmento_p_numero_do_documento(pagamento)
  segmento = "#{pagamento.numero_documento}".adjust_size_to(10, '0', :right)
  segmento << ''.rjust(5)
  segmento
end

#segmento_p_posicao_023_a_023Object

Complemento de Registro - Conteúdo deve estar em ‘Branco’ 1 posição



82
83
84
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 82

def segmento_p_posicao_023_a_023
  " "
end

#segmento_p_posicao_058_a_058Object



117
118
119
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 117

def segmento_p_posicao_058_a_058
  segmento_p_posicao_058_a_062
end

#segmento_p_posicao_058_a_062Object

Segmento P posição 059 a 062 Para o Itau esse espaço deve ter ‘Zeros’ 5 posições



114
115
116
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 114

def segmento_p_posicao_058_a_062
  ''.rjust(5, '0')
end

#segmento_p_posicao_059_a_059(pagamento) ⇒ Object



120
121
122
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 120

def segmento_p_posicao_059_a_059(pagamento)
  ''
end

#segmento_p_posicao_060_a_060Object



123
124
125
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 123

def segmento_p_posicao_060_a_060
  ''
end

#segmento_p_posicao_061_a_061(pagamento) ⇒ Object



126
127
128
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 126

def segmento_p_posicao_061_a_061(pagamento)
  ''
end

#segmento_p_posicao_062_a_062(pagamento) ⇒ Object



129
130
131
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 129

def segmento_p_posicao_062_a_062(pagamento)
  ''
end

#segmento_p_posicao_106_a_106Object

Dígito Verificador da Agência cobradora - Conteúdo deve ser ‘Zero’ 1 posição



147
148
149
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 147

def segmento_p_posicao_106_a_106
  "0"
end

#segmento_p_posicao_118_a_118(pagamento) ⇒ Object

Código do Juros de Mora Para o Itau esse espaço deve ter ‘Zero’ 1 posição



154
155
156
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 154

def segmento_p_posicao_118_a_118(pagamento) 
  '0'
end

#segmento_p_posicao_228_a_229(pagamento) ⇒ Object

Código da Moeda Para o Itau esse espaço deve ter ‘Zeros’ 2 posições



161
162
163
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 161

def segmento_p_posicao_228_a_229(pagamento)
  '00'
end

#usa_segmento_S?Boolean

Por padrão o ITAU não utiliza o Segmento S



190
191
192
# File 'lib/br_boleto/remessa/cnab240/itau.rb', line 190

def usa_segmento_S?
  false
end