From 8f027e4fb91d1104eb6f92bcc1550f2204b42e04 Mon Sep 17 00:00:00 2001 From: "fabricio.vieira" Date: Thu, 1 Aug 2024 16:20:31 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Fix:=20Corre=C3=A7=C3=A3o=20dos=20tipos=20d?= =?UTF-8?q?as=20propriedades=20VlTotServ,=20VlBcPis,=20VlPisImp=20e=20VlCo?= =?UTF-8?q?finsImp=20no=20registro=20A120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/FiscalBr.EFDContribuicoes/BlocoA.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FiscalBr.EFDContribuicoes/BlocoA.cs b/src/FiscalBr.EFDContribuicoes/BlocoA.cs index 42b05aa..99872a0 100644 --- a/src/FiscalBr.EFDContribuicoes/BlocoA.cs +++ b/src/FiscalBr.EFDContribuicoes/BlocoA.cs @@ -236,19 +236,19 @@ public RegistroA120() : base("A120") /// Valor total do serviço, prestado por pessoa física ou jurídica domiciliada no exterior. /// [SpedCampos(2, "VL_TOT_SERV", "N", 0, 2, true, 2)] - public string VlTotServ { get; set; } + public decimal VlTotServ { get; set; } /// /// Valor da base de cálculo da Operação –PIS/PASEP –Importação /// [SpedCampos(3, "VL_BC_PIS", "N", 0, 2, true, 2)] - public string VlBcPis { get; set; } + public decimal VlBcPis { get; set; } /// /// Valor pago/recolhido de PIS/PASEP –Importação /// - [SpedCampos(4, "VL_PIS_IMP", "N", int.MaxValue, 2, false, 2)] - public string VlPisImp { get; set; } + [SpedCampos(4, "VL_PIS_IMP", "N", 0, 2, false, 2)] + public decimal VlPisImp { get; set; } /// /// Data de pagamento do PIS/PASEP –Importação @@ -266,7 +266,7 @@ public RegistroA120() : base("A120") /// Valor pago/recolhido de COFINS –Importação /// [SpedCampos(7, "VL_COFINS_IMP", "N", 0, 2, false, 2)] - public string VlCofinsImp { get; set; } + public decimal VlCofinsImp { get; set; } /// /// Data de pagamento do COFINS –Importação From da2ae263795ed1c57f61a3dbb508f6ffbb851f2b Mon Sep 17 00:00:00 2001 From: "fabricio.vieira" Date: Fri, 2 Aug 2024 10:29:45 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Fix:=20Altera=C3=A7=C3=A3o=20dos=20tipos=20?= =?UTF-8?q?das=20propriedades=20nos=20registros=20D300=20e=20D310,=20de=20?= =?UTF-8?q?acordo=20com=20manual=20do=20SPED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/FiscalBr.EFDFiscal/BlocoD.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/FiscalBr.EFDFiscal/BlocoD.cs b/src/FiscalBr.EFDFiscal/BlocoD.cs index 2d213f4..6dc9d5b 100644 --- a/src/FiscalBr.EFDFiscal/BlocoD.cs +++ b/src/FiscalBr.EFDFiscal/BlocoD.cs @@ -1420,8 +1420,8 @@ public RegistroD300() : base("D300") /// /// Número do último documento fiscal emitido (mesmo modelo, série e subsérie) /// - [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; } /// /// Código da Situação Tributária, conforme a Tabela indicada no item 4.3.1 @@ -1439,7 +1439,7 @@ public RegistroD300() : base("D300") /// Alíquota do ICMS /// [SpedCampos(9, "ALIQ_ICMS", "N", 6, 2, false, 2)] - public string AliqIcms { get; set; } + public decimal AliqIcms { get; set; } /// /// Data da emissão dos documentos fiscais @@ -1453,43 +1453,43 @@ public RegistroD300() : base("D300") /// e alíquota do ICMS, incluídas as despesas acessórias e acréscimos. /// [SpedCampos(11, "VL_OPR", "N", 0, 2, true, 2)] - public string VlOpr { get; set; } + public decimal VlOpr { get; set; } /// /// Valor total dos descontos /// [SpedCampos(12, "VL_DESC", "N", 0, 2, false, 2)] - public string VlDesc { get; set; } + public decimal VlDesc { get; set; } /// /// Valor total da prestação de serviço /// [SpedCampos(13, "VL_SERV", "N", 0, 2, true, 2)] - public string VlServ { get; set; } + public decimal VlServ { get; set; } /// /// Valor de seguro /// [SpedCampos(14, "VL_SEG", "N", 0, 2, false, 2)] - public string VlSeg { get; set; } + public decimal VlSeg { get; set; } /// /// Valor de outras despesas /// [SpedCampos(15, "VL_OUT_DESP", "N", 0, 2, false, 2)] - public string VlOutDesp { get; set; } + public decimal VlOutDesp { get; set; } /// /// Valor total da base de cálculo do ICMS /// [SpedCampos(16, "VL_BC_ICMS", "N", 0, 2, true, 2)] - public string VlBcIcms { get; set; } + public decimal VlBcIcms { get; set; } /// /// Valor total do ICMS /// [SpedCampos(17, "VL_ICMS", "N", 0, 2, true, 2)] - public string VlIcms { get; set; } + public decimal VlIcms { get; set; } /// /// Valor não tributado em função da redução da base de cálculo do ICMS, @@ -1497,7 +1497,7 @@ public RegistroD300() : base("D300") /// referente à combinação de CST_ICMS, CFOP e alíquota do ICMS. /// [SpedCampos(18, "VL_RED_BC", "N", 0, 2, true, 2)] - public string VlRedBc { get; set; } + public decimal VlRedBc { get; set; } /// /// Código da observação do lançamento fiscal (campo 02 do Registro 0460) @@ -1508,7 +1508,7 @@ public RegistroD300() : base("D300") /// /// Código da conta analítica contábil debitada/creditada /// - [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 RegD301s { get; set; } @@ -1552,19 +1552,19 @@ public RegistroD310() : base("D310") /// Valor total da prestação de serviço /// [SpedCampos(3, "VL_SERV", "N", 0, 2, true, 2)] - public string VlServ { get; set; } + public decimal VlServ { get; set; } /// /// Valor total da base de cálculo do ICMS /// [SpedCampos(4, "VL_BC_ICMS", "N", 0, 2, false, 2)] - public string VlBcIcms { get; set; } + public decimal VlBcIcms { get; set; } /// /// Valor total do ICMS /// [SpedCampos(5, "VL_ICMS", "N", 0, 2, false, 2)] - public string VlIcms { get; set; } + public decimal VlIcms { get; set; } } /// From c2dc2ca75d73e14df02cb26e2938e98dcd10d775 Mon Sep 17 00:00:00 2001 From: "fabricio.vieira" Date: Fri, 2 Aug 2024 10:32:35 -0300 Subject: [PATCH 3/4] Test: Criacao de testes para Bloco D, registros D300 e D310 --- .../Sped/BlocoD/BlocoDRegistro300Test.cs | 48 +++++++++++++++++++ .../Sped/BlocoD/BlocoDRegistro310Test.cs | 31 ++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro300Test.cs create mode 100644 tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro310Test.cs diff --git a/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro300Test.cs b/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro300Test.cs new file mode 100644 index 0000000..fa43e21 --- /dev/null +++ b/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro300Test.cs @@ -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); + } + } +} diff --git a/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro310Test.cs b/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro310Test.cs new file mode 100644 index 0000000..af0164b --- /dev/null +++ b/tests/FiscalBr.Test/Sped/BlocoD/BlocoDRegistro310Test.cs @@ -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); + } + } +} From 1ddbf094311fc98ce56b69b96d18f26cf48fb00e Mon Sep 17 00:00:00 2001 From: "fabricio.vieira" Date: Fri, 2 Aug 2024 10:35:48 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Revert=20"Fix:=20Corre=C3=A7=C3=A3o=20dos?= =?UTF-8?q?=20tipos=20das=20propriedades=20VlTotServ,=20VlBcPis,=20VlPisIm?= =?UTF-8?q?p=20e=20VlCofinsImp=20no=20registro=20A120"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8f027e4fb91d1104eb6f92bcc1550f2204b42e04. --- src/FiscalBr.EFDContribuicoes/BlocoA.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FiscalBr.EFDContribuicoes/BlocoA.cs b/src/FiscalBr.EFDContribuicoes/BlocoA.cs index 99872a0..42b05aa 100644 --- a/src/FiscalBr.EFDContribuicoes/BlocoA.cs +++ b/src/FiscalBr.EFDContribuicoes/BlocoA.cs @@ -236,19 +236,19 @@ public RegistroA120() : base("A120") /// Valor total do serviço, prestado por pessoa física ou jurídica domiciliada no exterior. /// [SpedCampos(2, "VL_TOT_SERV", "N", 0, 2, true, 2)] - public decimal VlTotServ { get; set; } + public string VlTotServ { get; set; } /// /// Valor da base de cálculo da Operação –PIS/PASEP –Importação /// [SpedCampos(3, "VL_BC_PIS", "N", 0, 2, true, 2)] - public decimal VlBcPis { get; set; } + public string VlBcPis { get; set; } /// /// Valor pago/recolhido de PIS/PASEP –Importação /// - [SpedCampos(4, "VL_PIS_IMP", "N", 0, 2, false, 2)] - public decimal VlPisImp { get; set; } + [SpedCampos(4, "VL_PIS_IMP", "N", int.MaxValue, 2, false, 2)] + public string VlPisImp { get; set; } /// /// Data de pagamento do PIS/PASEP –Importação @@ -266,7 +266,7 @@ public RegistroA120() : base("A120") /// Valor pago/recolhido de COFINS –Importação /// [SpedCampos(7, "VL_COFINS_IMP", "N", 0, 2, false, 2)] - public decimal VlCofinsImp { get; set; } + public string VlCofinsImp { get; set; } /// /// Data de pagamento do COFINS –Importação