Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correção tipos das propriedades D300 e D310 - EFD Fiscal - Issue #132 #135

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/FiscalBr.EFDFiscal/BlocoD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,8 +1420,8 @@ public RegistroD300() : base("D300")
/// <summary>
/// Número do último documento fiscal emitido (mesmo modelo, série e subsérie)
/// </summary>
[SpedCampos(6, "NUM_DOC_FIN", "N", 0, 0, true, 2)]
public string NumDocFin { get; set; }
[SpedCampos(6, "NUM_DOC_FIN", "N", int.MaxValue, 0, true, 2)]
public int NumDocFin { get; set; }

/// <summary>
/// Código da Situação Tributária, conforme a Tabela indicada no item 4.3.1
Expand All @@ -1439,7 +1439,7 @@ public RegistroD300() : base("D300")
/// Alíquota do ICMS
/// </summary>
[SpedCampos(9, "ALIQ_ICMS", "N", 6, 2, false, 2)]
public string AliqIcms { get; set; }
public decimal AliqIcms { get; set; }

/// <summary>
/// Data da emissão dos documentos fiscais
Expand All @@ -1453,51 +1453,51 @@ public RegistroD300() : base("D300")
/// e alíquota do ICMS, incluídas as despesas acessórias e acréscimos.
/// </summary>
[SpedCampos(11, "VL_OPR", "N", 0, 2, true, 2)]
public string VlOpr { get; set; }
public decimal VlOpr { get; set; }

/// <summary>
/// Valor total dos descontos
/// </summary>
[SpedCampos(12, "VL_DESC", "N", 0, 2, false, 2)]
public string VlDesc { get; set; }
public decimal VlDesc { get; set; }

/// <summary>
/// Valor total da prestação de serviço
/// </summary>
[SpedCampos(13, "VL_SERV", "N", 0, 2, true, 2)]
public string VlServ { get; set; }
public decimal VlServ { get; set; }

/// <summary>
/// Valor de seguro
/// </summary>
[SpedCampos(14, "VL_SEG", "N", 0, 2, false, 2)]
public string VlSeg { get; set; }
public decimal VlSeg { get; set; }

/// <summary>
/// Valor de outras despesas
/// </summary>
[SpedCampos(15, "VL_OUT_DESP", "N", 0, 2, false, 2)]
public string VlOutDesp { get; set; }
public decimal VlOutDesp { get; set; }

/// <summary>
/// Valor total da base de cálculo do ICMS
/// </summary>
[SpedCampos(16, "VL_BC_ICMS", "N", 0, 2, true, 2)]
public string VlBcIcms { get; set; }
public decimal VlBcIcms { get; set; }

/// <summary>
/// Valor total do ICMS
/// </summary>
[SpedCampos(17, "VL_ICMS", "N", 0, 2, true, 2)]
public string VlIcms { get; set; }
public decimal VlIcms { get; set; }

/// <summary>
/// Valor não tributado em função da redução da base de cálculo do ICMS,
/// <para />
/// referente à combinação de CST_ICMS, CFOP e alíquota do ICMS.
/// </summary>
[SpedCampos(18, "VL_RED_BC", "N", 0, 2, true, 2)]
public string VlRedBc { get; set; }
public decimal VlRedBc { get; set; }

/// <summary>
/// Código da observação do lançamento fiscal (campo 02 do Registro 0460)
Expand All @@ -1508,7 +1508,7 @@ public RegistroD300() : base("D300")
/// <summary>
/// Código da conta analítica contábil debitada/creditada
/// </summary>
[SpedCampos(20, "COD_CTA", "C", 0, 0, false, 2)]
[SpedCampos(20, "COD_CTA", "C", 255, 0, false, 2)]
public string CodCta { get; set; }

public List<RegistroD301> RegD301s { get; set; }
Expand Down Expand Up @@ -1552,19 +1552,19 @@ public RegistroD310() : base("D310")
/// Valor total da prestação de serviço
/// </summary>
[SpedCampos(3, "VL_SERV", "N", 0, 2, true, 2)]
public string VlServ { get; set; }
public decimal VlServ { get; set; }

/// <summary>
/// Valor total da base de cálculo do ICMS
/// </summary>
[SpedCampos(4, "VL_BC_ICMS", "N", 0, 2, false, 2)]
public string VlBcIcms { get; set; }
public decimal VlBcIcms { get; set; }

/// <summary>
/// Valor total do ICMS
/// </summary>
[SpedCampos(5, "VL_ICMS", "N", 0, 2, false, 2)]
public string VlIcms { get; set; }
public decimal VlIcms { get; set; }
}

/// <summary>
Expand Down
48 changes: 48 additions & 0 deletions tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro300Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using FiscalBr.Common.Sped.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FiscalBr.Test.Sped.BlocoD
{
public class BlocoDRegistro300Test
{
[Fact]
public void Escrever_Registro_D300_EFDFiscal()
{
var formattedDate = DateTime.Today.ToString(new CultureInfo("pt-BR")).Replace("/", "").Split(" ")[0];

var expectedResult =
$"|D300|13|1|1|1|5|040|5102|0,00|{formattedDate}|0,00|0,00|0,00|0,00|0,00|0,00|0,00|0,00|000001|010|{Environment.NewLine}";

var source = new EFDFiscal.BlocoD.RegistroD300()
{
CodMod= IndCodMod.Mod13.ToDefaultValue(),
Ser = "1",
Sub = "1",
NumDocIni = "1",
NumDocFin = 5,
CstIcms = "040",
Cfop = "5102",
AliqIcms = 0M,
DtDoc = formattedDate,
VlOpr = 0M,
VlDesc = 0M,
VlServ = 0M,
VlSeg = 0M,
VlOutDesp = 0M,
VlBcIcms = 0M,
VlIcms = 0M,
VlRedBc = 0M,
CodObs = "000001",
CodCta = "010",
};

var currentResult = Common.Sped.EscreverCamposSped.EscreverCampos(source, VersaoLeiauteSped.V2);

Assert.Equal(expectedResult, currentResult);
}
}
}
31 changes: 31 additions & 0 deletions tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro310Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using FiscalBr.Common.Sped.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FiscalBr.Test.Sped.BlocoD
{
public class BlocoDRegistro310Test
{
[Fact]
public void Escrever_Registro_D310_EFDFiscal()
{
var expectedResult =
$"|D310|3550308|0,00|0,00|0,00|{Environment.NewLine}";

var source = new EFDFiscal.BlocoD.RegistroD310()
{
CodMunOrig = "3550308",
VlServ = 0M,
VlBcIcms = 0M,
VlIcms = 0M,
};

var currentResult = Common.Sped.EscreverCamposSped.EscreverCampos(source, VersaoLeiauteSped.V2);

Assert.Equal(expectedResult, currentResult);
}
}
}
Loading