From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Model.Domain.Ferramentas/Imposto.cs | 177 +++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Ferramentas/Imposto.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Ferramentas/Imposto.cs') diff --git a/Codemerx/Gestor.Model/Model.Domain.Ferramentas/Imposto.cs b/Codemerx/Gestor.Model/Model.Domain.Ferramentas/Imposto.cs new file mode 100644 index 0000000..7a65e49 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Ferramentas/Imposto.cs @@ -0,0 +1,177 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Ferramentas +{ + public class Imposto : DomainBase, IDomain + { + public bool Ativo + { + get; + set; + } + + public decimal Desconto + { + get; + set; + } + + public decimal Ir + { + get; + set; + } + + public decimal Iss + { + get; + set; + } + + public decimal Outros + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Imposto imposto = this; + return new Func>>(imposto.Validate); + } + } + + public Imposto() + { + } + + public List Log() + { + object nome; + object nomeSocial; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>(); + Gestor.Model.Domain.Seguros.Ramo ramo = this.Ramo; + if (ramo != null) + { + nome = ramo.Nome; + } + else + { + nome = null; + } + if (nome == null) + { + nome = ""; + } + observableCollection.Add(new Tuple("RAMO", nome, "")); + Gestor.Model.Domain.Seguros.Seguradora seguradora = this.Seguradora; + if (seguradora != null) + { + nomeSocial = seguradora.NomeSocial; + } + else + { + nomeSocial = null; + } + if (nomeSocial == null) + { + Gestor.Model.Domain.Seguros.Seguradora seguradora1 = this.Seguradora; + if (seguradora1 != null) + { + nomeSocial = seguradora1.Nome; + } + else + { + nomeSocial = null; + } + if (nomeSocial == null) + { + nomeSocial = ""; + } + } + observableCollection.Add(new Tuple("SEGURADORA", nomeSocial, "")); + decimal ir = this.Ir; + observableCollection.Add(new Tuple("IR", ir.ToString("p"), "")); + ir = this.Iss; + observableCollection.Add(new Tuple("ISS", ir.ToString("p"), "")); + ir = this.Outros; + observableCollection.Add(new Tuple("OUTROS", ir.ToString("p"), "")); + ir = this.Desconto; + observableCollection.Add(new Tuple("DESCONTO", ir.ToString("p"), "")); + observableCollection.Add(new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Ir > decimal.One) + { + keyValuePairs.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MAIOR QUE 100%.", true); + } + if (this.Iss > decimal.One) + { + keyValuePairs.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MAIOR QUE 100%.", true); + } + if (this.Outros > decimal.One) + { + keyValuePairs.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MAIOR QUE 100%.", true); + } + if (this.Desconto > decimal.One) + { + keyValuePairs.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MAIOR QUE 100%.", true); + } + if (this.Ir < decimal.Zero) + { + keyValuePairs.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MENOR QUE 0%.", true); + } + if (this.Iss < decimal.Zero) + { + keyValuePairs.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MENOR QUE 0%.", true); + } + if (this.Outros < decimal.Zero) + { + keyValuePairs.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MENOR QUE 0%.", true); + } + if (this.Desconto < decimal.Zero) + { + keyValuePairs.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MENOR QUE 0%.", true); + } + if ((((this.Ir + this.Iss) + this.Outros) + this.Desconto) > decimal.One) + { + keyValuePairs.AddValue("Ir|PORCENTAGEM TOTAL", "NÃO É POSSÍVEL DEDUZIR MAIS QUE 100% DO TOTAL RECEBIDO.", true); + } + if ((((this.Ir + this.Iss) + this.Outros) + this.Desconto) == decimal.Zero) + { + keyValuePairs.AddValue("Ir|PORCENTAGEM TOTAL", "A SOMA DOS IMPOSTOS DEVEM SER MAIOR QUE 0 (ZERO).", true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3