diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.tar.gz gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs new file mode 100644 index 0000000..50b50be --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Imposto : DomainBase, IDomain +{ + public Seguradora Seguradora { get; set; } + + public Ramo Ramo { get; set; } + + public decimal Ir { get; set; } + + public decimal Iss { get; set; } + + public decimal Outros { get; set; } + + public decimal Desconto { get; set; } + + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Ir > 1m) + { + list.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MAIOR QUE 100%."); + } + if (Iss > 1m) + { + list.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MAIOR QUE 100%."); + } + if (Outros > 1m) + { + list.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MAIOR QUE 100%."); + } + if (Desconto > 1m) + { + list.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MAIOR QUE 100%."); + } + if (Ir < 0m) + { + list.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MENOR QUE 0%."); + } + if (Iss < 0m) + { + list.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MENOR QUE 0%."); + } + if (Outros < 0m) + { + list.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MENOR QUE 0%."); + } + if (Desconto < 0m) + { + list.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MENOR QUE 0%."); + } + if (Ir + Iss + Outros + Desconto > 1m) + { + list.AddValue("Ir|PORCENTAGEM TOTAL", "NÃO É POSSÍVEL DEDUZIR MAIS QUE 100% DO TOTAL RECEBIDO."); + } + if (Ir + Iss + Outros + Desconto == 0m) + { + list.AddValue("Ir|PORCENTAGEM TOTAL", "A SOMA DOS IMPOSTOS DEVEM SER MAIOR QUE 0 (ZERO)."); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("RAMO", Ramo?.Nome ?? "", ""), + new Tuple<string, string, string>("SEGURADORA", Seguradora?.NomeSocial ?? Seguradora?.Nome ?? "", ""), + new Tuple<string, string, string>("IR", Ir.ToString("p"), ""), + new Tuple<string, string, string>("ISS", Iss.ToString("p"), ""), + new Tuple<string, string, string>("OUTROS", Outros.ToString("p"), ""), + new Tuple<string, string, string>("DESCONTO", Desconto.ToString("p"), ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "") + } + } + }; + } +} |