FF read(final File file, String encoding) {
+
+ Objects.checkNotNull(file, "Arquivo TXT a ser importado nulo!");
+ Strings.checkNotBlank(encoding, "Encoding inválido!");
+
+ try {
+
+ getFlatFile().read(FileUtils.readLines(file, encoding));
+
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+
+ return (FF) this;
+ }
+
+ /**
+ *
+ * Escreve um arquivo do layout da instancia com enconding UTF-8.
+ *
+ *
+ * @return arquivo texto
+ * @throws IOException
+ */
+ public File write() throws IOException {
+
+ Objects.checkNotNull(getFlatFile(), "Arquivo TXT a ser importado nulo!");
+
+ File f = File.createTempFile(this.getClass().getName() + ""
+ + new Date().getTime(), "_jnfmtmp.txt");
+
+ FileUtils.writeLines(f, getFlatFile().write());
+
+ return f;
+ }
+
+ /**
+ *
+ * Escreve um arquivo do layout da instancia.
+ *
+ * @param encoding - Econding em que o arquivo será escrito
+ * @return arquivo texto
+ * @throws IOException
+ */
+ public File write(String encoding) throws IOException {
+
+ if (getFlatFile() != null) {
+
+ File f = File.createTempFile(this.getClass().getName() + ""
+ + new Date().getTime(), "_jnfmtmp.txt");
+
+ FileUtils.writeLines(f, getFlatFile().write(), encoding);
+
+ return f;
+
+ } else{
+
+ throw new IllegalArgumentException(new NullPointerException(
+ "Arquivo TXT a ser importado nulo!"));
+ }
+ }
+
+ /**
+ *
+ * Escreve um arquivo do layout da instancia.
+ *
+ * @param arquivoRemessaFisico
+ * @throws IOException
+ */
+ protected void write(File arquivoRemessaFisico) throws IOException{
+
+ if(arquivoRemessaFisico == null){
+ throw new IllegalArgumentException(new NullPointerException(
+ "Arquivo TXT a ser importado nulo!"));
+ }
+
+ FileUtils.writeLines(arquivoRemessaFisico, getFlatFile().write(), "\r\n");
+ }
+
+ protected void writeLines(File arquivoRemessaFisico) throws IOException{
+
+ if(arquivoRemessaFisico == null){
+ throw new IllegalArgumentException(new NullPointerException(
+ "Arquivo TXT a ser importado nulo!"));
+ }
+
+ FileUtils.writeLines(arquivoRemessaFisico, this.lines, "\r\n");
+ }
+
+ protected void writeLines() throws IOException{
+ this.lines.addAll(getFlatFile().write());
+
+ flatFile = null;
+ configure();
+ }
+
+ /**
+ *
+ * @param arquivoRemessaFisico
+ * @param arquivoRemessa
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ public List gerarRemessa(File arquivoRemessaFisico, ArquivoRemessa arquivoRemessa) throws FileNotFoundException, IOException{
+
+ //log.info("Gerando Remessa: " + cfgFile.name());
+ //log.info("INICIO - Bloco de Header...");
+
+ for(ArquivoRemessaItemInteface arquivoRemessaItem : arquivoRemessa.getItens()){
+ createHeader(arquivoRemessaItem.getCabecalhoRemessa());
+ //log.info("FIM - Bloco de Header...");
+
+ //log.info("INICIO - Bloco de Titulos...");
+ for (DetalheObrigatorio titulo : arquivoRemessaItem.getTitulos()) {
+ createTransacaoTitulos(titulo);
+ }
+ //log.info("FIM - Bloco de Titulos...");
+
+ //log.info("INICIO - Bloco de Trailler...");
+ createTrailler(arquivoRemessaItem.getRodapeRemessa());
+ //log.info("FIM - Bloco de Trailler...");
+
+ //log.info("INICIO - Gerando arquivo...");
+ writeLines();
+ //log.info("FIM - Gerando arquivo...");
+ }
+
+ writeLines(arquivoRemessaFisico);
+
+ return this.lines;
+ }
+
+
+ public ArquivoRetorno lerRetorno(File arquivoRetornoFisico) throws FileNotFoundException, IOException{
+
+ //log.info("Gerando Retorno: " + cfgFile.name());
+ //log.info("INICIO - Bloco de Header...");
+
+ read(arquivoRetornoFisico);
+
+ return loadInfo();
+ }
+
+ private ArquivoRetorno loadInfo() {
+
+ ArquivoRetorno arquivoRetorno = new ArquivoRetorno();
+
+ Record header = getFlatFile().getRecord("Header");
+
+ ArquivoRetornoItem arquivoRetornoItem = new ArquivoRetornoItem();
+
+ arquivoRetornoItem.setCabecalhoRetorno(readHeader(header));
+
+ Collection registrosDeTransacoes = getFlatFile().getRecords(
+ "TransacaoTitulo");
+
+ List titulos = readTransacaoTitulos(registrosDeTransacoes);
+
+ for(DetalheRetorno titulo : titulos){
+ arquivoRetornoItem.addTitulo(titulo);
+ }
+
+
+ Record trailler = getFlatFile().getRecord("Trailler");
+
+ arquivoRetornoItem.setRodapeRetorno(readTrailler(trailler));
+
+ arquivoRetorno.addItem(arquivoRetornoItem);
+
+ return arquivoRetorno;
+ }
+
+
+ protected abstract void createHeader(CabecalhoRemessa cabecalhoRemessaParam);
+
+ protected abstract void createTransacaoTitulos(DetalheObrigatorio tituloParam);
+
+ protected abstract Record createDadosBoletos(DadosBoleto boleto);
+
+ protected abstract Record createRateioDeCredito(RateioDeCredito rateioDeCredito);
+
+ protected abstract void createTrailler(RodapeRemessa trailler);
+
+ protected abstract CabecalhoRetorno readHeader(Record header);
+
+ protected abstract List readTransacaoTitulos(Collection registrosDeTransacoes);
+
+ protected abstract RodapeRetorno readTrailler(Record trailler);
+}
diff --git a/src/com/rjconsultores/ventaboletos/layouts/BradescoFlatFile.java b/src/com/rjconsultores/ventaboletos/layouts/BradescoFlatFile.java
new file mode 100644
index 000000000..89a65b090
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/BradescoFlatFile.java
@@ -0,0 +1,142 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jrimum.texgit.Record;
+
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRemessa;
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRetorno;
+import com.rjconsultores.ventaboletos.blocos.DadosBoleto;
+import com.rjconsultores.ventaboletos.blocos.RodapeRemessa;
+import com.rjconsultores.ventaboletos.blocos.RodapeRetorno;
+import com.rjconsultores.ventaboletos.blocos.DetalheObrigatorio;
+import com.rjconsultores.ventaboletos.blocos.DetalheRetorno;
+import com.rjconsultores.ventaboletos.blocos.RateioDeCredito;
+import com.rjconsultores.ventaboletos.blocos.bradesco.CabecalhoRemessaBradesco;
+import com.rjconsultores.ventaboletos.blocos.bradesco.DetalheObrigatorioBradesco;
+import com.rjconsultores.ventaboletos.enuns.BancoLayout;
+import com.rjconsultores.ventaboletos.utils.FormataUtil;
+
+public class BradescoFlatFile extends AbstractFlatFile implements RemessaInterface {
+
+ public BradescoFlatFile() {
+ super(BancoLayout.BRADESCO_Envio);
+ }
+
+ @Override
+ protected void createHeader(CabecalhoRemessa cabecalhoRemessaParam) {
+
+ Record header = getFlatFile().createRecord("Header");
+
+ CabecalhoRemessaBradesco cabecalhoRemessa = (CabecalhoRemessaBradesco) cabecalhoRemessaParam;
+
+ //header.setValue("IdentificacaoRemessa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoRemessa(), 1));
+ //header.setValue("LiteralRemessa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getLiteralRemessa(), 7));
+ //header.setValue("CodigoServico", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getCodigoServico(), 2));
+ //header.setValue("LiteralServico", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getLiteralServico(), 8));
+ header.setValue("CodigoDaEmpresa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getCodigoEmpresa().toString(), 20));
+ header.setValue("NomeDaEmpresa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNomeEmpresa(), 30));
+ //header.setValue("CodigoCompensacao", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getCodigoBanco().toString(), 3));
+ //header.setValue("NomeBanco", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNomeBanco(), 8));
+ header.setValue("DataGravacaoArquivo", FormataUtil.formataData(cabecalhoRemessa.getDataGravacao()));
+ //header.setValue("IdentificacaoSistema", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoSistema(), 2));
+ header.setValue("NumeroSequencialRemessa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNumeroSequencialRemessa().toString(), 7));
+ header.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNumeroSequencialRegistro().toString(), 6));
+
+ getFlatFile().addRecord(header);
+ }
+
+ @Override
+ protected void createTransacaoTitulos(DetalheObrigatorio tituloParam) {
+
+ Record transacaoTitulos = getFlatFile().createRecord("TransacaoTitulo");
+
+ DetalheObrigatorioBradesco titulo = (DetalheObrigatorioBradesco) tituloParam;
+
+ transacaoTitulos.setValue("DadosIgnorados1", FormataUtil.formatarValorPorTamanho(" ", 36));
+ transacaoTitulos.setValue("NumeroControleDoParticipante", FormataUtil.formatarValorPorTamanho(titulo.getNumeroControleDoParticipante(), 25));
+ transacaoTitulos.setValue("Filler1", FormataUtil.formatarValorPorTamanho("0", 8));
+ transacaoTitulos.setValue("NossoNumeroComDigito", FormataUtil.formatarValorPorTamanho(titulo.getNossoNumeroComDigito(), 12));
+ transacaoTitulos.setValue("DadosIgnorados2", FormataUtil.formatarValorPorTamanho("", 25));
+ transacaoTitulos.setValue("QtdPagamento", FormataUtil.formatarValorPorTamanho(titulo.getQtdPagamento().toString(), 25));
+ //transacaoTitulos.setValue("CodigoDeOcorrencia", FormataUtil.formatarValorPorTamanho(titulo.getCodigoDeOcorrencia().toString(), 2));
+ transacaoTitulos.setValue("NumeroDoDocumento", FormataUtil.formatarValorPorTamanho(titulo.getNumeroDoDocumento(), 10));
+ transacaoTitulos.setValue("Vencimento", FormataUtil.formataData(titulo.getVencimento()));
+ transacaoTitulos.setValue("Valor", titulo.getValor());
+ //transacaoTitulos.setValue("BancoCobranca", FormataUtil.formatarValorPorTamanho("0", 3));
+ //transacaoTitulos.setValue("AgenciaAgencia", FormataUtil.formatarValorPorTamanho("0", 5));
+ transacaoTitulos.setValue("EspecieDeTitulo", FormataUtil.formatarValorPorTamanho(titulo.getEspecieDeTitulo(), 2));
+ //transacaoTitulos.setValue("Identificação", FormataUtil.formatarValorPorTamanho("N", 1));
+ transacaoTitulos.setValue("Emissao", FormataUtil.formataData(titulo.getEmissao()));
+ transacaoTitulos.setValue("Instrucao1", FormataUtil.formatarValorPorTamanho(titulo.getInstrucao1(), 2));
+ transacaoTitulos.setValue("Instrucao2", FormataUtil.formatarValorPorTamanho(titulo.getInstrucao2(), 2));
+ transacaoTitulos.setValue("ValorAtraso", titulo.getValorAtraso());
+ transacaoTitulos.setValue("DataLimiteDesconto", FormataUtil.formataData(titulo.getDataLimiteDesconto()));
+ transacaoTitulos.setValue("ValorDesconto", titulo.getValorDesconto());
+ transacaoTitulos.setValue("ValorIOF", titulo.getValorIOF());
+ transacaoTitulos.setValue("ValorAbatimentoConcedido", titulo.getValorAbatimentoConcedido());
+ transacaoTitulos.setValue("TipoInscricaoPagador", FormataUtil.formatarValorPorTamanho(titulo.getTipoInscricaoPagador().toString(), 2));
+ transacaoTitulos.setValue("NumeroInscricaoPagador", FormataUtil.formatarValorPorTamanho(titulo.getNumeroInscricaoPagador().toString(), 14));
+ transacaoTitulos.setValue("NomePagador", FormataUtil.formatarValorPorTamanho(titulo.getNomePagador(), 40));
+ transacaoTitulos.setValue("EnderecoCompletoPagador", FormataUtil.formatarValorPorTamanho(titulo.getEnderecoCompletoPagado(), 40));
+ transacaoTitulos.setValue("Mensagem1", FormataUtil.formatarValorPorTamanho(titulo.getMensagem1(), 12));
+ transacaoTitulos.setValue("CEP_Prefixo", FormataUtil.formatarValorPorTamanho(titulo.getCEP_Prefixo().toString(), 5));
+ transacaoTitulos.setValue("CEP_Sufixo", FormataUtil.formatarValorPorTamanho(titulo.getCEP_Sufixo().toString(), 3));
+ transacaoTitulos.setValue("Sacador_Avalista_Mensagem2", FormataUtil.formatarValorPorTamanho(titulo.getSacador_Avalista_Mensagem2(), 60));
+ transacaoTitulos.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(titulo.getNumeroSequencialRegistro().toString(), 6));
+
+ DadosBoleto dadosBoleto = titulo.getDadosBoleto();
+
+ try{
+ if(dadosBoleto != null){
+ transacaoTitulos.addInnerRecord(createDadosBoletos(dadosBoleto));
+ }
+ }catch(UnsupportedOperationException e){ }
+
+ RateioDeCredito rateioDeCredito = titulo.getRateioDeCredito();
+
+ try{
+ if(dadosBoleto != null){
+ transacaoTitulos.addInnerRecord(createRateioDeCredito(rateioDeCredito));
+ }
+ }catch(UnsupportedOperationException e){ }
+
+ getFlatFile().addRecord(transacaoTitulos);
+ }
+
+ @Override
+ protected Record createDadosBoletos(DadosBoleto boleto) {
+ throw new UnsupportedOperationException("Não necessário...");
+ }
+
+ @Override
+ protected Record createRateioDeCredito(RateioDeCredito rateioDeCredito) {
+ throw new UnsupportedOperationException("Não necessário...");
+ }
+
+ @Override
+ protected void createTrailler(RodapeRemessa trailler){
+
+ Record trailer = getFlatFile().createRecord("Trailler");
+
+ trailer.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(trailler.getNumeroSequencialRegistro().toString(), 6));
+
+ getFlatFile().addRecord(trailer);
+ }
+
+ @Override
+ protected CabecalhoRetorno readHeader(Record header) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+
+ @Override
+ protected List readTransacaoTitulos(Collection registrosDeTransacoes) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+
+ @Override
+ protected RodapeRetorno readTrailler(Record trailler) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/layouts/BradescoProcessaRetorno.java b/src/com/rjconsultores/ventaboletos/layouts/BradescoProcessaRetorno.java
new file mode 100644
index 000000000..a3e65fc01
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/BradescoProcessaRetorno.java
@@ -0,0 +1,138 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.jrimum.texgit.Record;
+
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRemessa;
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRetorno;
+import com.rjconsultores.ventaboletos.blocos.DadosBoleto;
+import com.rjconsultores.ventaboletos.blocos.DetalheObrigatorio;
+import com.rjconsultores.ventaboletos.blocos.DetalheRetorno;
+import com.rjconsultores.ventaboletos.blocos.RateioDeCredito;
+import com.rjconsultores.ventaboletos.blocos.RodapeRemessa;
+import com.rjconsultores.ventaboletos.blocos.RodapeRetorno;
+import com.rjconsultores.ventaboletos.enuns.BancoLayout;
+import com.rjconsultores.ventaboletos.enuns.MotivoOcorrenciaBradesco;
+import com.rjconsultores.ventaboletos.enuns.OcorrenciaBradesco;
+
+public class BradescoProcessaRetorno extends AbstractFlatFile implements RetornoInteface {
+
+ protected BradescoProcessaRetorno() {
+ super(BancoLayout.BRADESCO_Retorno);
+ }
+
+ @Override
+ protected void createHeader(CabecalhoRemessa cabecalhoRemessaParam) {
+ throw new UnsupportedOperationException("Somente classe de Envio.");
+ }
+
+ @Override
+ protected void createTransacaoTitulos(DetalheObrigatorio tituloParam) {
+ throw new UnsupportedOperationException("Somente classe de Envio.");
+ }
+
+ @Override
+ protected Record createDadosBoletos(DadosBoleto boleto) {
+ throw new UnsupportedOperationException("Somente classe de Envio.");
+ }
+
+ @Override
+ protected Record createRateioDeCredito(RateioDeCredito rateioDeCredito) {
+ throw new UnsupportedOperationException("Somente classe de Envio.");
+ }
+
+ @Override
+ protected void createTrailler(RodapeRemessa trailler) {
+ throw new UnsupportedOperationException("Somente classe de Envio.");
+ }
+
+ @Override
+ protected CabecalhoRetorno readHeader(Record header) {
+
+ CabecalhoRetorno cabecalhoRetorno = new CabecalhoRetorno();
+ String codEmpresa = header.getValue("CodigoDaEmpresa");
+ String numeroDoAvisoBancario = header.getValue("NumeroDoAvisoBancario");
+
+ cabecalhoRetorno.setCodEmpresa(codEmpresa);
+ cabecalhoRetorno.setNumeroDoAvisoBancario(numeroDoAvisoBancario);
+
+ return cabecalhoRetorno;
+ }
+
+ @Override
+ protected List readTransacaoTitulos(Collection registrosDeTransacoes) {
+
+ List retornos = new ArrayList();
+
+ for (Record record : registrosDeTransacoes) {
+
+ DetalheRetorno detalheRetorno = new DetalheRetorno();
+
+ String numeroControleDoParticipante = record.getValue("NumeroControleDoParticipante");
+ String codigoDeOcorrencia = record.getValue("CodigoDeOcorrencia");
+ String codigoDeMotivo1 = record.getValue("CodigoDeMotivo1");
+ String codigoDeMotivo2 = record.getValue("CodigoDeMotivo2");
+ String codigoDeMotivo3 = record.getValue("CodigoDeMotivo3");
+ String codigoDeMotivo4 = record.getValue("CodigoDeMotivo4");
+ String codigoDeMotivo5 = record.getValue("CodigoDeMotivo5");
+
+ OcorrenciaBradesco ocorrencia = OcorrenciaBradesco.getInstance(codigoDeOcorrencia);
+ detalheRetorno.setNumeroControleDoParticipante(numeroControleDoParticipante);
+ detalheRetorno.setOcorrencia(ocorrencia);
+
+ if(checkIsNullOrBlank(codigoDeMotivo1)){
+ MotivoOcorrenciaBradesco motivoOcorrencia = MotivoOcorrenciaBradesco.getInstance(ocorrencia, codigoDeMotivo1);
+ detalheRetorno.addMotivoOcorrencia(motivoOcorrencia);
+ }
+
+ if(checkIsNullOrBlank(codigoDeMotivo2)){
+ MotivoOcorrenciaBradesco motivoOcorrencia = MotivoOcorrenciaBradesco.getInstance(ocorrencia, codigoDeMotivo2);
+ detalheRetorno.addMotivoOcorrencia(motivoOcorrencia);
+ }
+
+ if(checkIsNullOrBlank(codigoDeMotivo3)){
+ MotivoOcorrenciaBradesco motivoOcorrencia = MotivoOcorrenciaBradesco.getInstance(ocorrencia, codigoDeMotivo3);
+ detalheRetorno.addMotivoOcorrencia(motivoOcorrencia);
+ }
+
+ if(checkIsNullOrBlank(codigoDeMotivo4)){
+ MotivoOcorrenciaBradesco motivoOcorrencia = MotivoOcorrenciaBradesco.getInstance(ocorrencia, codigoDeMotivo4);
+ detalheRetorno.addMotivoOcorrencia(motivoOcorrencia);
+ }
+
+ if(checkIsNullOrBlank(codigoDeMotivo5)){
+ MotivoOcorrenciaBradesco motivoOcorrencia = MotivoOcorrenciaBradesco.getInstance(ocorrencia, codigoDeMotivo5);
+ detalheRetorno.addMotivoOcorrencia(motivoOcorrencia);
+ }
+
+
+ retornos.add(detalheRetorno);
+ }
+
+ return retornos;
+ }
+
+ private boolean checkIsNullOrBlank(String value){
+
+ if(value != null){
+ return StringUtils.isEmpty(value);
+ }
+
+ return Boolean.TRUE;
+ }
+
+ @Override
+ protected RodapeRetorno readTrailler(Record trailler) {
+
+ RodapeRetorno rodapeRetorno = new RodapeRetorno();
+
+
+ return rodapeRetorno;
+
+
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/layouts/CNABFactory.java b/src/com/rjconsultores/ventaboletos/layouts/CNABFactory.java
new file mode 100644
index 000000000..4abbe4e35
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/CNABFactory.java
@@ -0,0 +1,37 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import com.rjconsultores.ventaboletos.enuns.BancoLayout;
+
+public class CNABFactory {
+
+
+ public static RemessaInterface createRemessa(BancoLayout bancoLayout){
+
+ switch (bancoLayout) {
+ case BRADESCO_Envio:
+ return new BradescoFlatFile();
+ case ITAU_Envio:
+ return new ItauFlatFile();
+ default:
+ break;
+ }
+
+
+ return null;
+ }
+
+ public static RetornoInteface createRetorno(BancoLayout bancoLayout){
+
+ switch (bancoLayout) {
+ case BRADESCO_Retorno:
+ return new BradescoProcessaRetorno();
+ case ITAU_Retorno:
+ return null;
+ default:
+ break;
+ }
+
+
+ return null;
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/layouts/ItauFlatFile.java b/src/com/rjconsultores/ventaboletos/layouts/ItauFlatFile.java
new file mode 100644
index 000000000..fb6f0dafe
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/ItauFlatFile.java
@@ -0,0 +1,160 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jrimum.texgit.Record;
+
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRemessa;
+import com.rjconsultores.ventaboletos.blocos.CabecalhoRetorno;
+import com.rjconsultores.ventaboletos.blocos.DadosBoleto;
+import com.rjconsultores.ventaboletos.blocos.DetalheObrigatorio;
+import com.rjconsultores.ventaboletos.blocos.DetalheRetorno;
+import com.rjconsultores.ventaboletos.blocos.RateioDeCredito;
+import com.rjconsultores.ventaboletos.blocos.RodapeRemessa;
+import com.rjconsultores.ventaboletos.blocos.RodapeRetorno;
+import com.rjconsultores.ventaboletos.blocos.itau.CabecalhoRemessaItau;
+import com.rjconsultores.ventaboletos.blocos.itau.DetalheObrigatorioItau;
+import com.rjconsultores.ventaboletos.enuns.BancoLayout;
+import com.rjconsultores.ventaboletos.utils.FormataUtil;
+
+public class ItauFlatFile extends AbstractFlatFile implements RemessaInterface {
+
+ public ItauFlatFile() {
+ super(BancoLayout.ITAU_Envio);
+ }
+
+ @Override
+ protected void createHeader(CabecalhoRemessa cabecalhoRemessaParam) {
+
+ Record header = getFlatFile().createRecord("Header");
+
+ CabecalhoRemessaItau cabecalhoRemessa = (CabecalhoRemessaItau) cabecalhoRemessaParam;
+
+ //header.setValue("IdentificacaoRemessa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoRemessa(), 1));
+ //header.setValue("LiteralRemessa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getLiteralRemessa(), 7));
+ //header.setValue("CodigoDeServico", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getCodigoDeServico(), 2));
+ //header.setValue("LiteralServico", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getLiteralServico(), 15));
+ //header.setValue("Agencia", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoRemessa(), 4));
+ //header.setValue("Zeros", "00");
+ header.setValue("Conta", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getConta().toString(), 5));
+ header.setValue("DacConta", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getDacConta().toString(), 1));
+ header.setValue("Brancos1", FormataUtil.formatarValorPorTamanho(" ", 8));
+ header.setValue("NomeEmpresa", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNomeEmpresa().toString(), 30));
+ //header.setValue("CodigoCompensacao", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoRemessa(), 3));
+ //header.setValue("NomeBanco", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getIdentificacaoRemessa(), 15));
+ header.setValue("DataGeracao", FormataUtil.formataData(cabecalhoRemessa.getDataGeracao()));
+ header.setValue("Brancos2", FormataUtil.formatarValorPorTamanho(" ", 294));
+ header.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(cabecalhoRemessa.getNumeroSequencialRegistro().toString(), 6));
+
+ getFlatFile().addRecord(header);
+
+ }
+
+ @Override
+ protected void createTransacaoTitulos(DetalheObrigatorio tituloParam) {
+
+ Record transacaoTitulos = getFlatFile().createRecord("TransacaoTitulo");
+
+ DetalheObrigatorioItau titulo = (DetalheObrigatorioItau) tituloParam;
+
+ //transacaoTitulos.setValue("CodigoInscricao", FormataUtil.formatarValorPorTamanho(titulo.getCodigoInscricao().toString(), 2));
+ transacaoTitulos.setValue("NumeroInscricao", FormataUtil.formatarValorPorTamanho(titulo.getNumeroInscricao().toString(), 14));
+ transacaoTitulos.setValue("Agencia", FormataUtil.formatarValorPorTamanho(titulo.getAgencia().toString(), 4));
+ transacaoTitulos.setValue("Zeros", "00");
+ transacaoTitulos.setValue("Conta", FormataUtil.formatarValorPorTamanho(titulo.getConta().toString(), 5));
+ transacaoTitulos.setValue("DacConta", FormataUtil.formatarValorPorTamanho(titulo.getDacConta().toString(), 1));
+ transacaoTitulos.setValue("Brancos1", FormataUtil.formatarValorPorTamanho(" ", 4));
+ transacaoTitulos.setValue("InstrucaoAlegacao", FormataUtil.formatarValorPorTamanho(titulo.getInstrucaoAlegacao().toString(), 4));
+ transacaoTitulos.setValue("UsoDaEmpresa", FormataUtil.formatarValorPorTamanho(titulo.getUsoDaEmpresa(), 25));
+ transacaoTitulos.setValue("NossoNumeroSemDigito", FormataUtil.formatarValorPorTamanho(titulo.getNossoNumero().toString(), 8));
+ transacaoTitulos.setValue("QtdMoeda", titulo.getQtdMoeda());
+ transacaoTitulos.setValue("NrCarteira", FormataUtil.formatarValorPorTamanho(titulo.getNrCarteira().toString(), 3));
+ transacaoTitulos.setValue("UsoDoBanco", FormataUtil.formatarValorPorTamanho(titulo.getUsoDoBanco(), 21));
+ transacaoTitulos.setValue("CodigoCarteira", FormataUtil.formatarValorPorTamanho(titulo.getCodigoCarteira(), 1));
+ transacaoTitulos.setValue("CodigoDeOcorrencia", FormataUtil.formatarValorPorTamanho(titulo.getCodigoDeOcorrencia().toString(), 2));
+ transacaoTitulos.setValue("NumeroDoDocumento", FormataUtil.formatarValorPorTamanho(titulo.getNumeroDoDocumento().toString(), 10));
+ transacaoTitulos.setValue("Vencimento", FormataUtil.formataData(titulo.getVencimento()));
+ transacaoTitulos.setValue("Valor", titulo.getValor());
+ //transacaoTitulos.setValue("CodigoCompensacaoBancoRecebedor", FormataUtil.formatarValorPorTamanho(titulo.getCodigoCompensacaoBancoRecebedor().toString(), 3));
+ transacaoTitulos.setValue("AgenciaCobradora", FormataUtil.formatarValorPorTamanho(titulo.getAgenciaCobradora().toString(), 5));
+ transacaoTitulos.setValue("EspecieDeTitulo", FormataUtil.formatarValorPorTamanho(titulo.getEspecieDeTitulo().toString(), 2));
+ transacaoTitulos.setValue("Aceite", FormataUtil.formatarValorPorTamanho(titulo.getAceite(), 1));
+ transacaoTitulos.setValue("Emissao", FormataUtil.formataData(titulo.getEmissao()));
+ transacaoTitulos.setValue("Instrucao1", FormataUtil.formatarValorPorTamanho(titulo.getInstrucao1(), 2));
+ transacaoTitulos.setValue("Instrucao2", FormataUtil.formatarValorPorTamanho(titulo.getInstrucao2(), 2));
+ transacaoTitulos.setValue("JurosDeMora", titulo.getJurosDeMora());
+ transacaoTitulos.setValue("DataDesconto", FormataUtil.formataData(titulo.getDataDesconto()));
+ transacaoTitulos.setValue("DescontoConcedido", titulo.getDescontoConcedido());
+ transacaoTitulos.setValue("IOF_Devido", titulo.getIOF_Devido());
+ transacaoTitulos.setValue("AbatimentoConcedido", titulo.getAbatimentoConcedido());
+ transacaoTitulos.setValue("TipoInscricaoSacado", FormataUtil.formatarValorPorTamanho(titulo.getTipoInscricaoSacado().getId(), 2));
+ transacaoTitulos.setValue("NumeroInscricaoSacado", FormataUtil.formatarValorPorTamanho(titulo.getNumeroInscricaoSacado().toString(), 14));
+ transacaoTitulos.setValue("NomeSacado", FormataUtil.formatarValorPorTamanho(titulo.getNomeSacado().toString(), 30));
+ transacaoTitulos.setValue("Brancos2", FormataUtil.formatarValorPorTamanho(" ", 2));
+ transacaoTitulos.setValue("LogradouroSacado", FormataUtil.formatarValorPorTamanho(titulo.getLogradouroSacado().toString(), 40));
+ transacaoTitulos.setValue("BairroSacado", FormataUtil.formatarValorPorTamanho(titulo.getBairroSacado().toString(), 12));
+ transacaoTitulos.setValue("CepSacado", FormataUtil.formatarValorPorTamanho(titulo.getCepSacado().toString(), 8));
+ transacaoTitulos.setValue("Cidade", FormataUtil.formatarValorPorTamanho(titulo.getCidade(), 15));
+ transacaoTitulos.setValue("Estado", FormataUtil.formatarValorPorTamanho(titulo.getEstado(), 2));
+ transacaoTitulos.setValue("SacadorAvalista", FormataUtil.formatarValorPorTamanho(titulo.getSacadorAvalista(), 30));
+ transacaoTitulos.setValue("Brancos3", FormataUtil.formatarValorPorTamanho(" ", 2));
+ transacaoTitulos.setValue("DataDeMora", FormataUtil.formataData(titulo.getDataDeMora()));
+ transacaoTitulos.setValue("Prazo", FormataUtil.formatarValorPorTamanho(titulo.getPrazo().toString(), 2));
+ transacaoTitulos.setValue("Brancos4", FormataUtil.formatarValorPorTamanho(" ", 2));
+ transacaoTitulos.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(titulo.getNumeroSequencialRegistro().toString(), 6));
+
+ DadosBoleto dadosBoleto = titulo.getDadosBoleto();
+
+ try{
+ if(dadosBoleto != null){
+ transacaoTitulos.addInnerRecord(createDadosBoletos(dadosBoleto));
+ }
+ }catch(UnsupportedOperationException e){ }
+
+ RateioDeCredito rateioDeCredito = titulo.getRateioDeCredito();
+
+ try{
+ if(dadosBoleto != null){
+ transacaoTitulos.addInnerRecord(createRateioDeCredito(rateioDeCredito));
+ }
+ }catch(UnsupportedOperationException e){ }
+
+ getFlatFile().addRecord(transacaoTitulos);
+ }
+
+ @Override
+ protected Record createDadosBoletos(DadosBoleto boleto) {
+ throw new UnsupportedOperationException("Não necessário...");
+ }
+
+ @Override
+ protected Record createRateioDeCredito(RateioDeCredito rateioDeCredito) {
+ throw new UnsupportedOperationException("Não necessário...");
+ }
+
+ @Override
+ protected void createTrailler(RodapeRemessa trailler) {
+
+ Record trailer = getFlatFile().createRecord("Trailler");
+
+ trailer.setValue("NumeroSequencialRegistro", FormataUtil.formatarValorPorTamanho(trailler.getNumeroSequencialRegistro().toString(), 6));
+
+ getFlatFile().addRecord(trailer);
+ }
+
+ @Override
+ protected CabecalhoRetorno readHeader(Record header) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+
+ @Override
+ protected List readTransacaoTitulos(Collection registrosDeTransacoes) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+
+ @Override
+ protected RodapeRetorno readTrailler(Record trailler) {
+ throw new UnsupportedOperationException("Somente classe de Retorno.");
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/layouts/RemessaInterface.java b/src/com/rjconsultores/ventaboletos/layouts/RemessaInterface.java
new file mode 100644
index 000000000..196811d68
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/RemessaInterface.java
@@ -0,0 +1,15 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.List;
+
+import com.rjconsultores.ventaboletos.ArquivoRemessa;
+import com.rjconsultores.ventaboletos.ArquivoRemessaItem;
+
+public interface RemessaInterface {
+
+ public List gerarRemessa(File arquivoRemessaFisico, ArquivoRemessa arquivoRemessa) throws FileNotFoundException, IOException;
+
+}
\ No newline at end of file
diff --git a/src/com/rjconsultores/ventaboletos/layouts/RetornoInteface.java b/src/com/rjconsultores/ventaboletos/layouts/RetornoInteface.java
new file mode 100644
index 000000000..7fee44a9d
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/layouts/RetornoInteface.java
@@ -0,0 +1,12 @@
+package com.rjconsultores.ventaboletos.layouts;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import com.rjconsultores.ventaboletos.ArquivoRetorno;
+
+public interface RetornoInteface {
+
+ public ArquivoRetorno lerRetorno(File arquivoRetornoFisico) throws FileNotFoundException, IOException;
+}
diff --git a/src/com/rjconsultores/ventaboletos/utils/FormataUtil.java b/src/com/rjconsultores/ventaboletos/utils/FormataUtil.java
new file mode 100644
index 000000000..e6b293fe2
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/utils/FormataUtil.java
@@ -0,0 +1,27 @@
+package com.rjconsultores.ventaboletos.utils;
+
+import java.util.Date;
+
+public class FormataUtil {
+
+ public static String formatarValorPorTamanho(String value, int tamanho) {
+
+ value = value == null ? "" : value;
+
+ if(value.length() > tamanho){
+ value = value.substring(0, tamanho);
+ }
+
+ return value;
+ }
+
+ public static Date formataData(Date dataGravacao) {
+
+ if(dataGravacao == null){
+ dataGravacao = new Date();
+ }
+
+ return dataGravacao;
+ }
+
+}
diff --git a/src/com/rjconsultores/ventaboletos/utils/NossoNumeroUtils.java b/src/com/rjconsultores/ventaboletos/utils/NossoNumeroUtils.java
new file mode 100644
index 000000000..b3f3a9740
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/utils/NossoNumeroUtils.java
@@ -0,0 +1,172 @@
+package com.rjconsultores.ventaboletos.utils;
+
+import java.math.BigInteger;
+
+import org.apache.commons.lang.StringUtils;
+
+public class NossoNumeroUtils {
+
+ /**
+ * Devolve o nosso numero do Bradesco com o DV calculado (Tamanho 12)...
+ * @param numCarteira
+ * @param nossoNumero
+ * @return
+ */
+ public static String calcularNossonumeroBradesco(Integer numCarteira, BigInteger nossoNumero){
+
+
+ return StringUtils.right("00000000000" + nossoNumero, 11) + dacBradesco(numCarteira, nossoNumero);
+
+ }
+
+ /**
+ * Devolve o nosso numero do Itau com o DV calculado (Tamanho 9)...
+ * @param codAgencia
+ * @param numConta
+ * @param numCarteira
+ * @param nossoNumero
+ * @return
+ */
+ public static String calcularNossoNumeroItau(Integer codAgencia, Integer numConta, Integer numCarteira, BigInteger nossoNumero){
+
+
+ return StringUtils.right("00000000" + nossoNumero, 8) + dacItau(codAgencia, numConta, numCarteira, nossoNumero);
+
+ }
+
+ /**
+ * Calcula do DV para o Bradesco
+ * @param numCarteira
+ * @param nossoNumero
+ * @return
+ */
+ public static String dacBradesco(Integer numCarteira, BigInteger nossoNumero){
+
+
+ int multiplicadores[] = {2,7,6,5,4,3,2,7,6,5,4,3,2};
+ int multiplicandos[] = new int[13];
+
+ String carteira = StringUtils.right("00" + numCarteira, 2);
+ String nNumero = StringUtils.right("00000000000" + nossoNumero, 11);
+
+ String base = carteira + nNumero;
+
+ for (int i = 0; i < multiplicandos.length; i++) {
+
+ String d = base.charAt(i) + "";
+
+ multiplicandos[i] = Integer.valueOf(d) * multiplicadores[i];
+ }
+
+ int dac = 0;
+
+ for(Integer v : multiplicandos){
+
+ dac += v;
+ }
+
+ dac = 11 - (dac % 11);
+
+ return (dac == 10) ? "P" : dac + "";
+
+ }
+
+ /**
+ * Calcula do DV para o Itau
+ * @param codAgencia
+ * @param numConta
+ * @param numCarteira
+ * @param nossoNumero
+ * @return
+ */
+ public static String dacItau(Integer codAgencia, Integer numConta, Integer numCarteira, BigInteger nossoNumero){
+
+
+ int multiplicadores[] = {1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2};
+ int multiplicandos[] = new int[20];
+
+ String agencia = StringUtils.right("0000" + codAgencia, 4);
+ String conta = StringUtils.right("00000" + numConta, 5);
+ String carteira = StringUtils.right("000" + numCarteira, 3);
+ String nNumero = StringUtils.right("00000000" + nossoNumero, 8);
+
+ String base = agencia + conta + carteira + nNumero;
+
+ for (int i = 0; i < multiplicandos.length; i++) {
+
+ String d = base.charAt(i) + "";
+
+ multiplicandos[i] = Integer.valueOf(d) * multiplicadores[i];
+ }
+
+ int dac = 0;
+
+ for(Integer v : multiplicandos){
+
+ if(v < 10){
+ dac += v;
+ }else{
+ dac += 1 + (v - 10);
+ }
+ }
+
+ dac = 10 - (dac % 10);
+
+
+
+ return dac + "";
+ }
+
+
+ /**
+ * Calcula do DV para o Itau (Numero Documento)
+ * @param codAgencia
+ * @param numConta
+ * @param numCarteira
+ * @param nossoNumero
+ * @return
+ */
+ public static String dvDocumentoItau(Integer numeroDoc){
+
+
+ int multiplicadores[] = {1,2,1,2,1,2,1,2,1,2};
+ int multiplicandos[] = new int[10];
+
+ String doc = StringUtils.right("0000000000" + numeroDoc, 10);
+
+ String base = doc;
+
+ for (int i = 0; i < multiplicandos.length; i++) {
+
+ String d = base.charAt(i) + "";
+
+ multiplicandos[i] = Integer.valueOf(d) * multiplicadores[i];
+ }
+
+ int dac = 0;
+
+ for(Integer v : multiplicandos){
+
+ if(v < 10){
+ dac += v;
+ }else{
+ dac += 1 + (v - 10);
+ }
+ }
+
+ dac = 10 - (dac % 10);
+
+
+
+ return dac + "";
+ }
+
+
+ public static void main(String[] args) {
+
+ System.out.println(calcularNossonumeroBradesco(19, new BigInteger("00166509652")));
+ System.out.println(calcularNossonumeroBradesco(19, new BigInteger("00000000001")));
+ System.out.println(calcularNossoNumeroItau(57, 72192, 109, new BigInteger("987123451")));
+ System.out.println(dvDocumentoItau(1108954));
+ }
+}
diff --git a/src/layouts/LayoutBradescoCNAB400Envio.txg.xml b/src/layouts/LayoutBradescoCNAB400Envio.txg.xml
new file mode 100644
index 000000000..ee25d798c
--- /dev/null
+++ b/src/layouts/LayoutBradescoCNAB400Envio.txg.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+ Arquivo-Remessa_BradescoCNAB400
+ Version 08, Published: 2009/09/30
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB REMESSA, REGISTROS:
+
+ 0 - Header Label
+ 1 - Cobrança - Transação
+ 2 - Mensagem (opcional)
+ 3 - Rateio de Crédito (opcional)
+ 7 – Sacador Avalista (opcional)
+ 9 - Trailler (Papel de finalizador de lote)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/LayoutBradescoCNAB400Retorno.txg.xml b/src/layouts/LayoutBradescoCNAB400Retorno.txg.xml
new file mode 100644
index 000000000..2512eaf3d
--- /dev/null
+++ b/src/layouts/LayoutBradescoCNAB400Retorno.txg.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+ Arquivo-Retorno_BradescoCNAB400
+ Version 08, Published: 2009/09/30
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB RETORNO, REGISTROS:
+
+ 0 - Header Label
+ 1 - Cobrança - Transação
+ 3 - Rateio de Crédito (opcional)
+ 9 - Trailler (Papel de finalizador de lote e totalizador)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/LayoutBradescoCNAB400RetornoParaLer.txg.xml b/src/layouts/LayoutBradescoCNAB400RetornoParaLer.txg.xml
new file mode 100644
index 000000000..9164b0f1f
--- /dev/null
+++ b/src/layouts/LayoutBradescoCNAB400RetornoParaLer.txg.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+ Arquivo-Retorno_BradescoCNAB400
+ Version 08, Published: 2009/09/30
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB RETORNO, REGISTROS:
+
+ 0 - Header Label
+ 1 - Cobrança - Transação
+ 3 - Rateio de Crédito (opcional)
+ 9 - Trailler (Papel de finalizador de lote e totalizador)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/LayoutBradescoCNAB400RetornoParaReEscrever.txg.xml b/src/layouts/LayoutBradescoCNAB400RetornoParaReEscrever.txg.xml
new file mode 100644
index 000000000..a79b4ae1e
--- /dev/null
+++ b/src/layouts/LayoutBradescoCNAB400RetornoParaReEscrever.txg.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+ Arquivo-Retorno_BradescoCNAB400
+ Version 08, Published: 2009/09/30
+
+
+ Arquivo para ler e reescrever ocorrencias e motivos.
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB RETORNO, REGISTROS:
+
+ 0 - Header Label
+ 1 - Cobrança - Transação
+ 3 - Rateio de Crédito (opcional)
+ 9 - Trailler (Papel de finalizador de lote e totalizador)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/LayoutItauCNAB400Envio.txg.xml b/src/layouts/LayoutItauCNAB400Envio.txg.xml
new file mode 100644
index 000000000..4db6d63fc
--- /dev/null
+++ b/src/layouts/LayoutItauCNAB400Envio.txg.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+ Arquivo-Remessa_ItauCNAB400
+ Version 01, Published: 2012/05/25
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB REMESSA, REGISTROS:
+
+ 0 - Registro Header do Arquivo
+ 1 - Registro de Detalhe (Obrigatório)
+ 1 - Registro de Transação (Opcional – Cheque Devolvido)
+ 4 - Registro de Detalhe (Opcional)
+ 5 - Registro de Detalhe (Opcional)
+ 9 - Trailler (Papel de finalizador de lote)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/LayoutItauCNAB400Retorno.txg.xml b/src/layouts/LayoutItauCNAB400Retorno.txg.xml
new file mode 100644
index 000000000..7ee46c1c7
--- /dev/null
+++ b/src/layouts/LayoutItauCNAB400Retorno.txg.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+ Arquivo-Retorno_ItauCNAB400
+ Version 01, Published: 2012/05/25
+
+ Layout para Cobrança.
+
+ Arquivo texto - padrão CNAB
+ Meio de Registro Transmissão de Dados
+ Descrição de Registro - Tamanho 400 Bytes
+ Organização Sequencial
+
+ ARQUIVO FORMATO CNAB RETORNO, REGISTROS:
+
+ 0 - Header Label
+ 1 - Cobrança - Transação
+ 3 - Rateio de Crédito (opcional)
+ 9 - Trailler (Papel de finalizador de lote e totalizador)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file