Skip to content

Commit

Permalink
Merge pull request #27 from esistemsistemas/master_fork_issue_26
Browse files Browse the repository at this point in the history
Master fork issue 26
  • Loading branch information
robertorp committed Jul 27, 2023
2 parents 5b5a803 + ac13a7d commit b8ebf8e
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/MotorTributarioNet/Impostos/IResultadoCalculoFcpStRetido.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Projeto: Motor Tributario
// Biblioteca C# para Cálculos Tributários Do Brasil
// NF-e, NFC-e, CT-e, SAT-Fiscal
//
// Esta biblioteca é software livre; você pode redistribuí-la e/ou modificá-la
// sob os termos da Licença Pública Geral Menor do GNU conforme publicada pela
// Free Software Foundation; tanto a versão 2.1 da Licença, ou (a seu critério)
// qualquer versão posterior.
//
// Esta biblioteca é distribuída na expectativa de que seja útil, porém, SEM
// NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU
// ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral Menor
// do GNU para mais detalhes. (Arquivo LICENÇA.TXT ou LICENSE.TXT)
//
// Você deve ter recebido uma cópia da Licença Pública Geral Menor do GNU junto
// com esta biblioteca; se não, escreva para a Free Software Foundation, Inc.,
// no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
// Você também pode obter uma copia da licença em:
// https://github.com/AutomacaoNet/MotorTributarioNet/blob/master/LICENSE

namespace MotorTributarioNet.Impostos
{
public interface IResultadoCalculoFcpStRetido
{
decimal BaseCalculoFcpStRetido { get; }
decimal ValorFcpStRetido { get; }
}
}
2 changes: 2 additions & 0 deletions src/MotorTributarioNet/Impostos/ITributavel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public interface ITributavel
decimal PercentualDifalInterestadual { get; set; }
decimal PercentualFcp { get; set; }
decimal PercentualMva { get; set; }
decimal PercentualFcpStRetido { get; set; }
decimal ValorUltimaBaseCalculoIcmsStRetido { get; set; }

/// <summary>
/// Na Substituição tributária = Alíquota interna no Estado de destino
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Projeto: Motor Tributario
// Biblioteca C# para Cálculos Tributários Do Brasil
// NF-e, NFC-e, CT-e, SAT-Fiscal
//
// Esta biblioteca é software livre; você pode redistribuí-la e/ou modificá-la
// sob os termos da Licença Pública Geral Menor do GNU conforme publicada pela
// Free Software Foundation; tanto a versão 2.1 da Licença, ou (a seu critério)
// qualquer versão posterior.
//
// Esta biblioteca é distribuída na expectativa de que seja útil, porém, SEM
// NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU
// ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral Menor
// do GNU para mais detalhes. (Arquivo LICENÇA.TXT ou LICENSE.TXT)
//
// Você deve ter recebido uma cópia da Licença Pública Geral Menor do GNU junto
// com esta biblioteca; se não, escreva para a Free Software Foundation, Inc.,
// no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
// Você também pode obter uma copia da licença em:
// https://github.com/AutomacaoNet/MotorTributarioNet/blob/master/LICENSE

namespace MotorTributarioNet.Impostos.Implementacoes
{
public class ResultadoCalculoFcpStRetido : IResultadoCalculoFcpStRetido
{
public ResultadoCalculoFcpStRetido(decimal baseCalculoFcpStRetido, decimal valorFcpStRetido)
{
BaseCalculoFcpStRetido = baseCalculoFcpStRetido;
ValorFcpStRetido = valorFcpStRetido;
}

public decimal BaseCalculoFcpStRetido { get; }
public decimal ValorFcpStRetido { get; }
}
}
19 changes: 19 additions & 0 deletions src/MotorTributarioNet/Impostos/ResultadoTributacao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class ResultadoTributacao
private TributacaoFcp TributacaoFcp { get; set; }
private TributacaoIssqn Issqn { get; set; }
private TributacaoIbpt Ibpt { get; set; }
private TributacaoFcpStRetido TributacaoFcpStRetido { get; set; }

#endregion

Expand Down Expand Up @@ -100,6 +101,9 @@ public class ResultadoTributacao
public decimal ValorTributacaoEstadual { get; private set; }
public decimal ValorTributacaoMunicipal { get; private set; }
public decimal ValorTotalTributos { get; private set; }

public decimal ValorBcFcpStRetido { get; private set; }
public decimal FcpStRetido { get; private set; }
#endregion

private readonly ITributavelProduto _produto;
Expand All @@ -124,6 +128,7 @@ public ResultadoTributacao Calcular()
CalcularIcms();
CalcularDifal();
CalcularFcp();
CalcularFcpStRetido();
CalcularIpi();
}
CalcularPis();
Expand Down Expand Up @@ -469,6 +474,20 @@ private TributacaoFcp CalcularFcp()
return TributacaoFcp;
}

private TributacaoFcp CalcularFcpStRetido()
{
TributacaoFcpStRetido = new TributacaoFcpStRetido(_produto);
FcpStRetido = decimal.Zero;
ValorBcFcpStRetido = decimal.Zero;

var result = TributacaoFcpStRetido.Calcula();

FcpStRetido = result.ValorFcpSt;
ValorBcFcpStRetido = result.BaseCalculoFcpSt;

return TributacaoFcp;
}

private TributacaoDifal CalcularDifal()
{
var cstCson = (Crt.RegimeNormal == CrtEmpresa ? _produto.Cst.GetValue<int>() : _produto.Csosn.GetValue<int>());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Projeto: Motor Tributario
// Biblioteca C# para Cálculos Tributários Do Brasil
// NF-e, NFC-e, CT-e, SAT-Fiscal
//
// Esta biblioteca é software livre; você pode redistribuí-la e/ou modificá-la
// sob os termos da Licença Pública Geral Menor do GNU conforme publicada pela
// Free Software Foundation; tanto a versão 2.1 da Licença, ou (a seu critério)
// qualquer versão posterior.
//
// Esta biblioteca é distribuída na expectativa de que seja útil, porém, SEM
// NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU
// ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral Menor
// do GNU para mais detalhes. (Arquivo LICENÇA.TXT ou LICENSE.TXT)
//
// Você deve ter recebido uma cópia da Licença Pública Geral Menor do GNU junto
// com esta biblioteca; se não, escreva para a Free Software Foundation, Inc.,
// no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
// Você também pode obter uma copia da licença em:
// https://github.com/AutomacaoNet/MotorTributarioNet/blob/master/LICENSE

using System;
using MotorTributarioNet.Flags;
using MotorTributarioNet.Impostos.CalulosDeBC;
using MotorTributarioNet.Impostos.Implementacoes;

namespace MotorTributarioNet.Impostos.Tributacoes
{
public class TributacaoFcpStRetido
{
private readonly ITributavel _tributavel;

public TributacaoFcpStRetido(ITributavel tributavel)
{
_tributavel = tributavel ?? throw new ArgumentNullException(nameof(tributavel));
}

public IResultadoCalculoFcpSt Calcula()
{
return CalculaFcpSt();
}

private IResultadoCalculoFcpSt CalculaFcpSt()
{
decimal baseIcmsSt = _tributavel.ValorUltimaBaseCalculoIcmsStRetido * _tributavel.QuantidadeProduto;
var valorIcmsSt = (baseIcmsSt * (_tributavel.PercentualFcpStRetido / 100));

return new ResultadoCalculoFcpSt(baseIcmsSt, valorIcmsSt);
}
}
}
2 changes: 2 additions & 0 deletions src/TestesUnitarios/Entidade/Produto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public Produto()
public decimal PercentualRetIrrf { get; set; }
public decimal PercentualRetInss { get; set; }
public decimal PercentualFcpSt { get; set; }
public decimal PercentualFcpStRetido { get; set; }
public decimal ValorUltimaBaseCalculoIcmsStRetido { get; set; }
}
}

0 comments on commit b8ebf8e

Please sign in to comment.