Skip to content

Commit

Permalink
incluindo layouts 240 - remessa de pagto a fornecedores
Browse files Browse the repository at this point in the history
  • Loading branch information
hmcheu committed Mar 14, 2021
1 parent e87025c commit 98a0674
Show file tree
Hide file tree
Showing 13 changed files with 1,967 additions and 1,588 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/github/braully/boleto/CNABServico.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
*/
public enum CNABServico {

COBRANCA_REMESSA, COBRANCA_RETORNO
COBRANCA_REMESSA, COBRANCA_RETORNO, PAGAMENTO_FORNECEDOR_REMESSA
}
3 changes: 3 additions & 0 deletions src/main/java/com/github/braully/boleto/CabecalhoArquivo.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public CabecalhoArquivo dataGeracao(String string) {
public CabecalhoArquivo dataGeracao(Date data) {
return (CabecalhoArquivo) setValue(data);
}
public CabecalhoArquivo horaGeracao(Date hora) {
return (CabecalhoArquivo) setValue(hora);
}

public CabecalhoArquivo cedenteCnpj(String string) {
return (CabecalhoArquivo) setValue(string);
Expand Down
2,624 changes: 1,303 additions & 1,321 deletions src/main/java/com/github/braully/boleto/LayoutsSuportados.java

Large diffs are not rendered by default.

40 changes: 37 additions & 3 deletions src/main/java/com/github/braully/boleto/RegistroArquivo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import static com.github.braully.boleto.TagLayout.TagCreator.fmovimentoCodigo;
import static com.github.braully.boleto.TagLayout.TagCreator.fsequencialArquivo;
import static com.github.braully.boleto.TagLayout.TagCreator.fsequencialRegistro;

import java.text.Format;
import java.util.ArrayList;
import java.util.List;

import org.jrimum.texgit.FixedField;
import org.jrimum.texgit.IFiller;
import org.jrimum.texgit.Record;
Expand Down Expand Up @@ -60,7 +62,7 @@ public void addExtraId(FixedField fixedField) {

public String render() {
// StringBuilder sb = new StringBuilder();
// return sb.toString();
// return sb.toString();
return this.write();
}

Expand Down Expand Up @@ -97,7 +99,11 @@ public String cedenteCnpj() {
}

public RegistroArquivo convenio(String convenio, String agencia, String conta, String dac) {
this.convenio(convenio).agencia(agencia).conta(conta).dac(dac);

this.convenio(convenio)
.agencia(agencia)
.conta(conta)
.dac(dac);
return this;
}

Expand All @@ -106,6 +112,20 @@ public RegistroArquivo convenio(String convenio, String carteira, String agencia
return this;
}

public RegistroArquivo endereco(String endereco) {
return setValue(endereco);
}

public RegistroArquivo endereco(String logradouro, String numero, String complemento,String nomeCidade, String cep, String uf) {
this.setValue(logradouro)
.setValue("numero",numero)
.setValue("complemento",complemento == null ? "" : complemento)
.setValue("cidade",nomeCidade)
.setValue("cep",cep)
.setValue("uf", uf);
return this;
}

public RegistroArquivo convenio(String convenio) {
return setValue(convenio);
}
Expand All @@ -126,7 +146,14 @@ public String convenio() {
return getValue(fconvenio().nome);
}

public RegistroArquivo agencia(String agencia) {
//não pode ser marcado como String pois Strings são immmutable, o que faz com que se perca mudanças de sanitize
public RegistroArquivo agencia(Object agencia) {

if (agencia != null && ((String)agencia).length()== 4 ) {
//caso o usuario não tenha informado o digito verificador, assumir que é 0
agencia = agencia + "-0";
}

return setValue(agencia);
}

Expand Down Expand Up @@ -217,6 +244,7 @@ public Number getValueAsNumber() {
protected RegistroArquivo setValue(Object valor) {
//TODO: Melhorar isso; perda de performance
String nomeMetodoAnterior = Thread.currentThread().getStackTrace()[2].getMethodName();

/* Propriedade a ser setada é o nome do metodo que chamou */
this.setValue(nomeMetodoAnterior, valor);
return this;
Expand Down Expand Up @@ -254,6 +282,12 @@ private void add(TagLayout l) {
if (l.isAttr("truncate")) {
fixedField.setTruncate(true);
}

if (l.isAttr("apenasDigitos")) {
fixedField.setApenasDigitos(true);
}


if (l.isAttr("id")) {
if (this.getIdType() == null) {
setIdType(fixedField);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/github/braully/boleto/RemessaFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public TituloArquivo addNovoDetalhe(String segmento) {
return titulo;
}

public TituloArquivo addNovoDetalheSegmentoA() {
return addNovoDetalhe("A");
}

public TituloArquivo addNovoDetalheSegmentoB() {
return addNovoDetalhe("B");
}

public TituloArquivo addNovoDetalheSegmentoJ() {
return addNovoDetalhe("J");
}
Expand All @@ -81,7 +89,7 @@ public TituloArquivo addNovoDetalheSegmentoR() {
public TituloArquivo addNovoDetalheTransacao() {
return addNovoDetalhe();
}

public TituloArquivo novoTitulo(String tipoTitulo) {
TituloArquivo titulo = new TituloArquivo(template.get(tipoTitulo));
return titulo;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/github/braully/boleto/RodapeArquivo.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public RodapeArquivo quantidadeRegistros(Number valorQuantidade) {
return (RodapeArquivo) setValue(valorQuantidade);
}

public RodapeArquivo quantidadeLotes(Number quantidade) {
return (RodapeArquivo) setValue(quantidade);
}

public Number quantidadeRegistros() {
return getValueAsNumber();
}

public RodapeArquivo valorTotalRegistros(Number valorTotal) {
public RodapeArquivo valorTotalRegistros(Object valorTotal) {
return (RodapeArquivo) setValue(valorTotal);
}
}
Loading

0 comments on commit 98a0674

Please sign in to comment.