Class: BrBoleto::Remessa::Cnab240::Sicredi

Inherits:
Base show all
Defined in:
lib/br_boleto/remessa/cnab240/sicredi.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?, #usa_segmento_S?

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_019_a_026, #segmento_r_posicao_027_a_041, #segmento_r_posicao_043_a_050, #segmento_r_posicao_051_a_065, #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_058_a_058, #segmento_p_posicao_060_a_060, #segmento_p_posicao_061_a_061, #segmento_p_posicao_062_a_062, #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_106_a_106, #segmento_p_posicao_107_a_108, #segmento_p_posicao_109_a_109, #segmento_p_posicao_110_a_117, #segmento_p_posicao_118_a_118, #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_228_a_229, #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_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_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

DESCRIÇÃO TAMANHO POSIÇÃO


Cód. Cedente (convênio) 20 33-52 TOTAL = 20 posições



16
17
18
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 16

def codigo_convenio
  ''.adjust_size_to(20)
end

#complemento_header_arquivoObject

Uso exclusivo FEBRABAN/CNAB Para o Sicredi esse espaço deve ter ‘Brancos’ TOTAL = 29 posições



61
62
63
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 61

def complemento_header_arquivo
  ''.rjust(29, ' ')
end

#complemento_p(pagamento) ⇒ Object

segmento_p_posicao_024_a_057 DESCRIÇÃO TAMANHO POSIÇÃO


Número da Conta Corrente 12 24 - 35 DV da Conta 01 36 - 36 Branco 01 37 - 37

Nosso número 20 38 - 57

TOTAL = 34 posições



103
104
105
106
107
108
109
110
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 103

def complemento_p(pagamento)
complemento = ''
  complemento << "#{conta.conta_corrente}".adjust_size_to(12, '0', :right)
  complemento << "#{conta.conta_corrente_dv}".adjust_size_to(1, '0', :right)
  complemento << ''.adjust_size_to(1)
  complemento << "#{pagamento.nosso_numero}".adjust_size_to(20)
  complemento.adjust_size_to(34, '0')
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 Qtd. Títulos em Cobrança 006 070 - 075 Qtd. Títulos em Carteiras 017 076 - 092 Qtd. de Títulos em Cobrança 006 093 - 098 Val. Tot. dos Títulos em Carteiras 017 099 - 115

  1. Aviso de Lançamento 008 116 - 123

Uso FEBRABAN 117 124 - 240

TOTAL = 217 posições



195
196
197
198
199
200
201
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 195

def complemento_trailer_lote(lote, nr_lote)
  complemento = ''
  complemento << ''.rjust(92, '0')  # Valores só serão utilizados para informação do arquivo retorno
  complemento << ''.rjust(8, ' ')   # O Sicredi atualmente não utiliza este campo
  complemento << ''.rjust(117, ' ') # USO EXCLUSIVO FEBRABAN
  complemento
end

#conta_classObject



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

def conta_class
  BrBoleto::Conta::Sicredi
end

#convenio_lote(lote) ⇒ Object

DESCRIÇÃO TAMANHO POSIÇÃO


Cód. Cedente (convênio) 20 34-53 TOTAL = 20 posições



78
79
80
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 78

def convenio_lote(lote)
  ''.rjust(20, ' ')
end

#header_arquivo_posicao_167_a_171Object

Densidade de gravação (BPI), do arquivo encaminhado.



40
41
42
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 40

def header_arquivo_posicao_167_a_171
  '01600'
end

#header_arquivo_posicao_172_a_191Object

Para uso reservado do Banco Para o Sicredi esse espaço deve ter ‘Brancos’ 20 posições



47
48
49
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 47

def header_arquivo_posicao_172_a_191
  ''.rjust(20, ' ')
end

#header_arquivo_posicao_192_a_211Object

Para uso reservado da Empresa Para o Sicredi esse espaço deve ter ‘Brancos’ 20 posições



54
55
56
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 54

def header_arquivo_posicao_192_a_211
  ''.rjust(20, ' ')
end

#header_lote_posicao_012_a_013Object

Uso exclusivo FEBRABAN/CNAB Para o Sicredi esse espaço deve ter ‘Brancos’ 2 posições



70
71
72
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 70

def header_lote_posicao_012_a_013
  ''.rjust(2, ' ')
end

#informacoes_da_contaObject

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


agencia 05 53 - 57 digito Verif. agencia 01 58 - 58 Número da Conta Corrente 12 59 - 70 DV da Conta 01 71 - 71 Branco 01 72 - 72

TOTAL = 20 posições



30
31
32
33
34
35
36
37
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 30

def informacoes_da_conta
  informacoes =  "#{conta.agencia}".adjust_size_to(5, '0', :right)
  informacoes << ''.adjust_size_to(1)
  informacoes << "#{conta.conta_corrente}".adjust_size_to(12, '0', :right)
  informacoes << "#{conta.conta_corrente_dv}".adjust_size_to(1, '0', :right)
  informacoes << ''.adjust_size_to(1)
  informacoes.adjust_size_to(20, '0')
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



119
120
121
122
123
124
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 119

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

#segmento_p_posicao_023_a_023Object

Dígito Verificador da Agência



85
86
87
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 85

def segmento_p_posicao_023_a_023
  ''.adjust_size_to(1)
end

#segmento_p_posicao_059_a_059(pagamento) ⇒ Object

Forma de Cadastr. do Título no Banco



90
91
92
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 90

def segmento_p_posicao_059_a_059(pagamento)
  '1'
end

#segmento_p_posicao_119_a_126(pagamento) ⇒ Object

Data do Juros de Mora Para o SICREDI é um Registro do tipo filler com ‘Zeros’ obrigatório 8 posições



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

def segmento_p_posicao_119_a_126(pagamento)
  ''.adjust_size_to(8, '0')
end

#segmento_p_posicao_224_a_224Object

Código para Baixa/Devolução Sicredi utiliza sempre domínio ‘1’ para esse campo ( ‘1’ => Baixar / devolver ). 1 posição



137
138
139
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 137

def segmento_p_posicao_224_a_224
  '1'  
end

#segmento_p_posicao_225_a_227Object

Número de Dias para Baixa/Devolução Sicredi utiliza sempre, nesse campo, 60 dias para baixa/devolução. 3 posoções



145
146
147
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 145

def segmento_p_posicao_225_a_227
  '060'
end

#segmento_r_posicao_018_a_018(pagamento) ⇒ Object

Código do desconto 2 1 posição



153
154
155
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 153

def segmento_r_posicao_018_a_018(pagamento)
  '2'
end

#segmento_r_posicao_042_a_042(pagamento) ⇒ Object

Código do desconto 3 1 posição



159
160
161
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 159

def segmento_r_posicao_042_a_042(pagamento)
  '2'
end

#segmento_r_posicao_066_a_066(pagamento) ⇒ Object

Codigo da multa O Sicredi apenas aceita o campo multa preenchido com ‘2’ - Percentual. 1 posição



166
167
168
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 166

def segmento_r_posicao_066_a_066(pagamento)
  '2'
end

#segmento_r_posicao_067_a_074(pagamento) ⇒ Object

Data da multa Para o SICREDI é um Registro do tipo filler com ‘Zeros’ obrigatório 8 posição



173
174
175
# File 'lib/br_boleto/remessa/cnab240/sicredi.rb', line 173

def segmento_r_posicao_067_a_074(pagamento)
  "".adjust_size_to(8, '0')
end