Skip to content

Commit

Permalink
Caso não seja possível obter a versão desejada no ArquivoSpedV2 será …
Browse files Browse the repository at this point in the history
…usado sempre a última versão disponível
  • Loading branch information
orochasamuel committed Sep 16, 2023
1 parent 2529299 commit a269646
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/FiscalBr.Common/Sped/ArquivoSpedV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,15 @@ public virtual string EscreverLinha(IRegistroSped reg, DateTime? competencia = n
competencia.Value
);

var versoesLeiaute = ObterVersoesLeiaute(ArquivoSped);

int versaoDesejada =
ObterVersoesLeiaute(ArquivoSped).FirstOrDefault(fd =>
versoesLeiaute.FirstOrDefault(fd =>
Convert.ToInt32(fd.ToString()).Equals((int)VersaoLeiaute));

if (versaoDesejada == 0)
versaoDesejada = versoesLeiaute.LastOrDefault();

var sb = new StringBuilder();
if (deveGerarCamposDoRegistro)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FiscalBr.Test/Sped/Bloco0/Bloco0Registro000Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Escrever_Registro_0000_EFDFiscal_VNova()

var efd = new ArquivoEFDFiscalV2(VersaoLeiauteSped.V15);

var currentResult = efd.EscreverLinha(source, null, null);
var currentResult = efd.EscreverLinha(source);

Assert.Equal(expectedResult, currentResult);
}
Expand Down

0 comments on commit a269646

Please sign in to comment.