Skip to content

Commit

Permalink
Merge pull request #39 from adrbarros/master
Browse files Browse the repository at this point in the history
Adicionado Propriedade CalcularIcmsEfetivoeRetencaoParaSt e Emunerador para CRT 4 (MEI)
  • Loading branch information
robertorp authored Dec 3, 2024
2 parents eec8426 + 78ac3e1 commit d49ea7b
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 98 deletions.
6 changes: 4 additions & 2 deletions src/MotorTributarioNet/Flags/Crt .cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public enum Crt
SimplesNacionalExecesso = 2,

[Description("3 - Regime Normal")]
RegimeNormal = 3
RegimeNormal = 3,

[Description("4 - Simples Nacional MEI")]
SimplesNacionalMei = 4
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ protected CalculaBaseCalculoBase(ITributavel tributavel)

protected decimal CalculaBaseDeCalculo()
{
var baseCalculo = _tributavel.ValorProduto * _tributavel.QuantidadeProduto +
_tributavel.Frete +
_tributavel.Seguro + _tributavel.OutrasDespesas;
var baseCalculo = (_tributavel.ValorProduto * _tributavel.QuantidadeProduto) +
_tributavel.Frete + _tributavel.Seguro + _tributavel.OutrasDespesas;

return baseCalculo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,19 @@ public decimal CalculaBaseCalculo()
{
decimal valorIcms = new TributacaoIcms(_tributavel, _tipoDesconto).Calcula().Valor;
var baseCalculo = _tributavel.DeduzIcmsDaBaseDePisCofins ? CalculaBaseDeCalculo() - valorIcms : CalculaBaseDeCalculo();
baseCalculo = baseCalculo - baseCalculo * _tributavel.PercentualReducaoCofins / 100;
baseCalculo -= baseCalculo * _tributavel.PercentualReducaoCofins / 100;
return _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculo) : CalculaIcmsComDescontoIncondicional(baseCalculo);
}

private decimal CalculaIcmsComDescontoIncondicional(decimal baseCalculoInicial)
{
var baseCalculo = baseCalculoInicial - _tributavel.Desconto;

return baseCalculo;
}

private decimal CalculaIcmsComDescontoCondicional(decimal baseCalculoInicial)
{
var baseCalulo = baseCalculoInicial + _tributavel.Desconto;

return baseCalulo;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,18 @@ public CalculaBaseCalculoIpi(ITributavel tributavel, TipoDesconto tipoDesconto)
public decimal CalculaBaseCalculo()
{
var baseCalculo = CalculaBaseDeCalculo();

return _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculo) : CalculaIcmsComDescontoIncondicional(baseCalculo);
}

private decimal CalculaIcmsComDescontoIncondicional(decimal baseCalculoInicial)
{
var baseCalculo = baseCalculoInicial - _tributavel.Desconto;

return baseCalculo;
}

private decimal CalculaIcmsComDescontoCondicional(decimal baseCalculoInicial)
{
var baseCalulo = baseCalculoInicial + _tributavel.Desconto;

return baseCalulo;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,18 @@ public CalculaBaseCalculoIssqn(ITributavel tributavel, TipoDesconto tipoDesconto
public decimal CalculaBaseCalculo()
{
var baseCalculo = CalculaBaseDeCalculo();

return _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculo) : CalculaIcmsComDescontoIncondicional(baseCalculo);
}

private decimal CalculaIcmsComDescontoIncondicional(decimal baseCalculoInicial)
{
var baseCalculo = baseCalculoInicial - _tributavel.Desconto;

return baseCalculo;
}

private decimal CalculaIcmsComDescontoCondicional(decimal baseCalculoInicial)
{
var baseCalulo = baseCalculoInicial + _tributavel.Desconto;

return baseCalulo;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,19 @@ public decimal CalculaBaseCalculo()
{
decimal valorIcms = new TributacaoIcms(_tributavel, _tipoDesconto).Calcula().Valor;
var baseCalculo = _tributavel.DeduzIcmsDaBaseDePisCofins ? CalculaBaseDeCalculo() - valorIcms : CalculaBaseDeCalculo();
baseCalculo = baseCalculo - baseCalculo * _tributavel.PercentualReducaoPis / 100;

baseCalculo -= baseCalculo * _tributavel.PercentualReducaoPis / 100;
return _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculo) : CalculaIcmsComDescontoIncondicional(baseCalculo);
}

private decimal CalculaIcmsComDescontoIncondicional(decimal baseCalculoInicial)
{
var baseCalculo = baseCalculoInicial - _tributavel.Desconto;

return baseCalculo;
}

private decimal CalculaIcmsComDescontoCondicional(decimal baseCalculoInicial)
{
var baseCalulo = baseCalculoInicial + _tributavel.Desconto;

return baseCalulo;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/MotorTributarioNet/Impostos/CalulosDeBC/CalculaBaseFcp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace MotorTributarioNet.Impostos.CalulosDeBC
public class CalculaBaseFcp : CalculaBaseCalculoIcms
{
public CalculaBaseFcp(ITributavel tributavel, TipoDesconto tipoDesconto) : base(tributavel, tipoDesconto)
{
}
{ }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,20 @@ public CalculoBaseIcmsSemIpi(ITributavel tributavel, TipoDesconto tipoDesconto)
public decimal CalculaBaseCalculo()
{
var baseCalculo = CalculaBaseDeCalculo();

return _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculo) : CalculaIcmsComDescontoIncondicional(baseCalculo);
}

private decimal CalculaIcmsComDescontoIncondicional(decimal baseCalculoInicial)
{
var baseCalculo = baseCalculoInicial - _tributavel.Desconto;

baseCalculo = baseCalculo - baseCalculo * _tributavel.PercentualReducao / 100;

baseCalculo -= baseCalculo * _tributavel.PercentualReducao / 100;
return baseCalculo;
}

private decimal CalculaIcmsComDescontoCondicional(decimal baseCalculoInicial)
{
var baseCalulo = baseCalculoInicial + _tributavel.Desconto;

baseCalulo = baseCalulo - baseCalulo * _tributavel.PercentualReducao / 100;

baseCalulo -= baseCalulo * _tributavel.PercentualReducao / 100;
return baseCalulo;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ public CalculoBaseIcmsSt(ITributavel tributavel, TipoDesconto tipoDesconto) : ba
_tipoDesconto = tipoDesconto;
}


public decimal CalculaBaseCalculo()
{
var baseCalculo = CalculaBaseDeCalculo();
var baseCalculoSt = CalculaBaseCalculoST(baseCalculo + _tributavel.ValorIpi);
return baseCalculoSt;
}


public decimal CalculaBaseCalculoST(decimal baseCalculoIcms)
{
var baseCalculoSt = _tipoDesconto == TipoDesconto.Condincional ? CalculaIcmsComDescontoCondicional(baseCalculoIcms) : CalculaIcmsComDescontoIncondicional(baseCalculoIcms);
Expand Down
20 changes: 11 additions & 9 deletions src/MotorTributarioNet/Impostos/Csosns/Csosn500.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ public Csosn500(OrigemMercadoria origemMercadoria = OrigemMercadoria.Nacional, T

public override void Calcula(ITributavel tributavel)
{
PercentualSt = tributavel.PercentualIcmsSt + tributavel.PercentualFcpSt;
if (tributavel.CalcularIcmsEfetivoeRetencaoParaSt)
{
PercentualSt = tributavel.PercentualIcmsSt + tributavel.PercentualFcpSt;

var facade = new FacadeCalculadoraTributacao(tributavel, TipoDesconto);
var resultadoCalculoIcmsEfetivo = facade.CalculaIcmsEfetivo();
var facade = new FacadeCalculadoraTributacao(tributavel, TipoDesconto);
var resultadoCalculoIcmsEfetivo = facade.CalculaIcmsEfetivo();

ValorBcIcmsEfetivo = resultadoCalculoIcmsEfetivo.BaseCalculo;
PercentualIcmsEfetivo = tributavel.PercentualIcmsEfetivo;
PercentualReducaoIcmsEfetivo = tributavel.PercentualReducaoIcmsEfetivo;
ValorIcmsEfetivo = resultadoCalculoIcmsEfetivo.Valor;
PercentualFcpStRetido = tributavel.PercentualFcpStRetido;
ValorBcIcmsEfetivo = resultadoCalculoIcmsEfetivo.BaseCalculo;
PercentualIcmsEfetivo = tributavel.PercentualIcmsEfetivo;
PercentualReducaoIcmsEfetivo = tributavel.PercentualReducaoIcmsEfetivo;
ValorIcmsEfetivo = resultadoCalculoIcmsEfetivo.Valor;
PercentualFcpStRetido = tributavel.PercentualFcpStRetido;
}
}

}
}
31 changes: 17 additions & 14 deletions src/MotorTributarioNet/Impostos/Csts/Cst60.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,27 @@ public Cst60(OrigemMercadoria origemMercadoria = OrigemMercadoria.Nacional, Tipo

public override void Calcula(ITributavel tributavel)
{
var facade = new FacadeCalculadoraTributacao(tributavel, TipoDesconto);
var resultadoCalculoIcms = facade.CalculaIcmsSt();
var resultadoCalculoIcmsEfetivo = facade.CalculaIcmsEfetivo();
if (tributavel.CalcularIcmsEfetivoeRetencaoParaSt)
{
var facade = new FacadeCalculadoraTributacao(tributavel, TipoDesconto);
var resultadoCalculoIcms = facade.CalculaIcmsSt();
var resultadoCalculoIcmsEfetivo = facade.CalculaIcmsEfetivo();

PercentualBcStRetido = tributavel.PercentualIcmsSt;
ValorBcStRetido = resultadoCalculoIcms.BaseCalculoIcmsSt;
ValorIcmsStRetido = resultadoCalculoIcms.ValorIcmsSt;
PercentualBcStRetido = tributavel.PercentualIcmsSt;
ValorBcStRetido = resultadoCalculoIcms.BaseCalculoIcmsSt;
ValorIcmsStRetido = resultadoCalculoIcms.ValorIcmsSt;

//ICMS Efetivo
ValorBcIcmsEfetivo = resultadoCalculoIcmsEfetivo.BaseCalculo;
PercentualIcmsEfetivo = tributavel.PercentualIcmsEfetivo;
PercentualReducaoIcmsEfetivo = tributavel.PercentualReducaoIcmsEfetivo;
ValorIcmsEfetivo = resultadoCalculoIcmsEfetivo.Valor;
PercentualFcpStRetido = tributavel.PercentualFcpStRetido;
//ICMS Efetivo
ValorBcIcmsEfetivo = resultadoCalculoIcmsEfetivo.BaseCalculo;
PercentualIcmsEfetivo = tributavel.PercentualIcmsEfetivo;
PercentualReducaoIcmsEfetivo = tributavel.PercentualReducaoIcmsEfetivo;
ValorIcmsEfetivo = resultadoCalculoIcmsEfetivo.Valor;
PercentualFcpStRetido = tributavel.PercentualFcpStRetido;

ValorCreditoOutorgadoOuPresumido = facade.CalculaIcmsCredito().Valor;
ValorCreditoOutorgadoOuPresumido = facade.CalculaIcmsCredito().Valor;

PercentualSt = tributavel.PercentualIcmsSt + tributavel.PercentualFcpSt;
PercentualSt = tributavel.PercentualIcmsSt + tributavel.PercentualFcpSt;
}
}
}
}
1 change: 1 addition & 0 deletions src/MotorTributarioNet/Impostos/ITributavel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public interface ITributavel
decimal AliquotaAdRemIcmsRetidoAnteriormente { get; set; }
decimal PercentualReducaoAliquotaAdRemIcms { get; set; }
decimal PercentualIcmsMonofasicoDiferido { get; set; }
bool CalcularIcmsEfetivoeRetencaoParaSt { get; set; }
decimal PercentualIcmsEfetivo { get; set; }
decimal PercentualReducaoIcmsEfetivo { get; set; }
}
Expand Down
Loading

0 comments on commit d49ea7b

Please sign in to comment.