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 --- Gestor.Model/Model.Domain.Seguros/Parcela.cs | 789 --------------------------- 1 file changed, 789 deletions(-) delete mode 100644 Gestor.Model/Model.Domain.Seguros/Parcela.cs (limited to 'Gestor.Model/Model.Domain.Seguros/Parcela.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/Parcela.cs b/Gestor.Model/Model.Domain.Seguros/Parcela.cs deleted file mode 100644 index d97f5c8..0000000 --- a/Gestor.Model/Model.Domain.Seguros/Parcela.cs +++ /dev/null @@ -1,789 +0,0 @@ -using Gestor.Model.Attributes; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Helper; -using Gestor.Model.Resources; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; - -namespace Gestor.Model.Domain.Seguros -{ - public class Parcela : DomainBase, IDomain - { - private string _extrato; - - private string _fatura; - - [Description("STATUS PAGAMENTO")] - [ForceLog(true)] - [Log(true)] - private Gestor.Model.Common.StatusPagamento? _statusPagamento; - - private bool _percentualmaiorque100; - - private bool _alteracao; - - private bool _permitirVencimentoMenor; - - private bool _permitirVencimentoMaior; - - public bool Baixando - { - get; - set; - } - - [Description("COMISSÃO")] - [ForceLog(true)] - [Log(true)] - public decimal Comissao - { - get; - set; - } - - [Description("CONTROLE")] - [ForceLog(true)] - [Log(true)] - public DateTime? DataControle - { - get; - set; - } - - [Description("CRÉDITO")] - [ForceLog(true)] - [Log(true)] - public DateTime? DataCredito - { - get; - set; - } - - [Log(false)] - public DateTime? DataCriacao - { - get; - set; - } - - [Description("QUITAÇÃO")] - [ForceLog(true)] - [Log(true)] - public DateTime? DataQuitacao - { - get; - set; - } - - [Description("RECEBIMENTO")] - [ForceLog(true)] - [Log(true)] - public DateTime? DataRecebimento - { - get; - set; - } - - [Description("DESCONTO")] - [ForceLog(true)] - [Log(true)] - public decimal Desconto - { - get; - set; - } - - [ForceLog(true)] - [Log(false)] - public Gestor.Model.Domain.Seguros.Documento Documento - { - get; - set; - } - - [Description("EMISSÃO FATURA")] - [ForceLog(true)] - [Log(true)] - public DateTime? Emissao - { - get; - set; - } - - [Description("EXTRATO")] - [ForceLog(true)] - [Log(true)] - public string Extrato - { - get - { - string str = this._extrato; - if (str != null) - { - return str.ToUpper(); - } - return null; - } - set - { - this._extrato = value; - } - } - - [Description("FATURA")] - [ForceLog(true)] - [Log(true)] - public string Fatura - { - get - { - string str = this._fatura; - if (str == null) - { - return null; - } - return str.ToUpper().Trim(); - } - set - { - this._fatura = value; - } - } - - public long IdEmpresa - { - get; - set; - } - - [Log(false)] - public long IdParcelaPendente - { - get; - set; - } - - [Description("IR")] - [ForceLog(true)] - [Log(true)] - public decimal Irr - { - get; - set; - } - - [Description("ISS")] - [ForceLog(true)] - [Log(true)] - public decimal Iss - { - get; - set; - } - - [Description("PARCELA")] - [ForceLog(true)] - [Log(true)] - public int NumeroParcela - { - get; - set; - } - - public string Observacao - { - get; - set; - } - - [Description("OUTROS")] - [ForceLog(true)] - [Log(true)] - public decimal Outros - { - get; - set; - } - - [Log(false)] - public Gestor.Model.Common.StatusPagamento? StatusPagamento - { - get - { - return this._statusPagamento; - } - set - { - this._statusPagamento = new Gestor.Model.Common.StatusPagamento?(value.GetValueOrDefault()); - } - } - - [Description("TIPO DA PARCELA")] - [ForceLog(true)] - [Log(true)] - public Gestor.Model.Common.SubTipo SubTipo - { - get; - set; - } - - public Gestor.Model.Common.TipoPagamento TipoPagamento - { - get; - set; - } - - [Log(false)] - public long UsuarioCriacao - { - get; - set; - } - - [JsonIgnore] - public Func>> ValidationEvent - { - get - { - Parcela parcela = this; - return new Func>>(parcela.Validate); - } - } - - [Description("VALOR")] - [ForceLog(true)] - [Log(true)] - public decimal Valor - { - get; - set; - } - - [Description("COMISSÃO LÍQUIDA")] - [ForceLog(true)] - [Log(true)] - public decimal ValorComDesconto - { - get; - set; - } - - [Description("VALOR DE COMISSÃO")] - [ForceLog(true)] - [Log(true)] - public decimal ValorComissao - { - get; - set; - } - - public decimal ValorExtrato - { - get; - set; - } - - [Description("VALOR LÍQUIDO FATURA")] - [ForceLog(true)] - [Log(true)] - public decimal ValorLiquidoFatura - { - get; - set; - } - - public decimal ValorPago - { - get; - set; - } - - [Description("VALOR PARCELA EXTRATO")] - [ForceLog(true)] - [Log(true)] - public decimal ValorRealizado - { - get; - set; - } - - [Description("VENCIMENTO")] - [ForceLog(true)] - [Log(true)] - public DateTime Vencimento - { - get; - set; - } - - [Log(false)] - public ObservableCollection Vendedores - { - get; - set; - } - - [Description("FIM FATURA")] - [ForceLog(true)] - [Log(true)] - public DateTime? VigenciaFinal - { - get; - set; - } - - [Description("INÍCIO FATURA")] - [ForceLog(true)] - [Log(true)] - public DateTime? VigenciaIncial - { - get; - set; - } - - public Parcela() - { - } - - public List> Validate(bool permitirVencimentoMenor, bool permitirVencimentoMaior, bool alteracao = false, bool percentualmaiorque100 = false) - { - this._permitirVencimentoMenor = permitirVencimentoMenor; - this._permitirVencimentoMaior = permitirVencimentoMaior; - this._alteracao = alteracao; - this._percentualmaiorque100 = percentualmaiorque100; - return this.Validate(); - } - - public List> Validate() - { - decimal? nullable; - decimal numeroParcelas; - decimal? nullable1; - decimal? nullable2; - decimal? nullable3; - DateTime vencimento; - DateTime? vigencia2; - int num; - decimal? tolerancia; - decimal? tolerancia1; - decimal? nullable4; - decimal? nullable5; - decimal? tolerancia2; - decimal? tolerancia3; - decimal? nullable6; - List> keyValuePairs = ValidationHelper.AddValue(); - DateTime? emissao = this.Emissao; - if (emissao.HasValue) - { - emissao = this.Emissao; - if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) - { - emissao = this.Emissao; - if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) - { - goto Label0; - } - } - keyValuePairs.AddValue("Emissao|EMISSÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - Label0: - emissao = this.VigenciaFinal; - if (emissao.HasValue) - { - emissao = this.VigenciaFinal; - if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) - { - emissao = this.VigenciaFinal; - if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) - { - goto Label1; - } - } - keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - Label1: - emissao = this.VigenciaIncial; - if (emissao.HasValue) - { - emissao = this.VigenciaIncial; - if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) - { - emissao = this.VigenciaIncial; - if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) - { - goto Label2; - } - } - keyValuePairs.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - Label2: - emissao = this.DataCredito; - if (emissao.HasValue) - { - emissao = this.DataCredito; - if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) - { - emissao = this.DataCredito; - if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) - { - goto Label3; - } - } - keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - Label3: - emissao = this.DataRecebimento; - if (emissao.HasValue) - { - emissao = this.DataRecebimento; - if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) - { - emissao = this.DataRecebimento; - if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) - { - goto Label4; - } - } - keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - Label4: - if (DateTime.Compare(this.Vencimento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Vencimento, new DateTime(9999, 12, 31)) > 0) - { - keyValuePairs.AddValue("Vencimento", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - if (this.NumeroParcela == 0) - { - keyValuePairs.AddValue("NumeroParcela|NÚMERO DA PARCELA", Messages.Obrigatorio, true); - } - if (this.Valor == decimal.Zero) - { - keyValuePairs.AddValue("Valor", Messages.Obrigatorio, true); - } - if (this.Comissao == decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura) - { - keyValuePairs.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio, true); - } - if (this.Comissao > new decimal(100) && (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura || !this._percentualmaiorque100)) - { - keyValuePairs.AddValue("Comissao|% COMISSÃO", "MAIOR QUE 100%", true); - } - emissao = this.DataRecebimento; - if (emissao.HasValue) - { - emissao = this.DataCredito; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio, true); - } - } - emissao = this.DataCredito; - if (emissao.HasValue) - { - emissao = this.DataRecebimento; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio, true); - } - } - if (this.Baixando) - { - emissao = this.DataRecebimento; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("DataRecebimento|DATA DE RECEBIMENTO", Messages.Obrigatorio, true); - } - emissao = this.DataCredito; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio, true); - } - } - if (!this._alteracao) - { - emissao = this.DataCredito; - if (!emissao.HasValue) - { - emissao = this.DataRecebimento; - if (!emissao.HasValue) - { - goto Label5; - } - } - if (this.ValorRealizado == decimal.Zero) - { - keyValuePairs.AddValue("ValorRealizado|VALOR REALIZADO", Messages.Obrigatorio, true); - } - } - Label5: - if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal) - { - if (this.Documento.NumeroParcelas != decimal.One) - { - decimal num1 = Math.Abs(this.Valor); - decimal num2 = Math.Abs(this.Documento.PremioTotal); - Controle controle = this.Documento.Controle; - if (controle != null) - { - Seguradora seguradora = controle.Seguradora; - if (seguradora != null) - { - tolerancia1 = seguradora.Tolerancia; - } - else - { - nullable3 = null; - tolerancia1 = nullable3; - } - } - else - { - nullable3 = null; - tolerancia1 = nullable3; - } - nullable2 = tolerancia1; - if (nullable2.HasValue) - { - nullable4 = new decimal?(num2 + nullable2.GetValueOrDefault()); - } - else - { - nullable3 = null; - nullable4 = nullable3; - } - nullable1 = nullable4; - numeroParcelas = this.Documento.NumeroParcelas; - if (nullable1.HasValue) - { - nullable5 = new decimal?(nullable1.GetValueOrDefault() - numeroParcelas); - } - else - { - nullable2 = null; - nullable5 = nullable2; - } - nullable = nullable5; - if ((num1 > nullable.GetValueOrDefault()) & nullable.HasValue) - { - decimal valor = this.Valor; - Controle controle1 = this.Documento.Controle; - if (controle1 != null) - { - Seguradora seguradora1 = controle1.Seguradora; - if (seguradora1 != null) - { - tolerancia2 = seguradora1.Tolerancia; - } - else - { - nullable1 = null; - tolerancia2 = nullable1; - } - } - else - { - nullable1 = null; - tolerancia2 = nullable1; - } - nullable = tolerancia2; - if ((valor > nullable.GetValueOrDefault()) & nullable.HasValue) - { - keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); - } - } - } - else - { - decimal num3 = Math.Abs(this.Valor); - numeroParcelas = Math.Abs(this.Documento.PremioTotal); - Controle controle2 = this.Documento.Controle; - if (controle2 != null) - { - Seguradora seguradora2 = controle2.Seguradora; - if (seguradora2 != null) - { - tolerancia3 = seguradora2.Tolerancia; - } - else - { - nullable2 = null; - tolerancia3 = nullable2; - } - } - else - { - nullable2 = null; - tolerancia3 = nullable2; - } - nullable1 = tolerancia3; - if (nullable1.HasValue) - { - nullable6 = new decimal?(numeroParcelas + nullable1.GetValueOrDefault()); - } - else - { - nullable2 = null; - nullable6 = nullable2; - } - nullable = nullable6; - if ((num3 > nullable.GetValueOrDefault()) & nullable.HasValue) - { - keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); - } - } - } - if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal && this.Documento.Parcelas != null && this.Documento.NumeroParcelas == this.Documento.Parcelas.Count) - { - decimal num4 = Math.Abs(( - from x in this.Documento.Parcelas - where x.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal - select x).Sum((Parcela x) => x.Valor)); - decimal num5 = Math.Abs(this.Documento.PremioTotal); - Controle controle3 = this.Documento.Controle; - if (controle3 != null) - { - Seguradora seguradora3 = controle3.Seguradora; - if (seguradora3 != null) - { - tolerancia = seguradora3.Tolerancia; - } - else - { - nullable = null; - tolerancia = nullable; - } - } - else - { - nullable = null; - tolerancia = nullable; - } - nullable = tolerancia; - if (num4 > (num5 + nullable.GetValueOrDefault()) && this.NumeroParcela == this.Documento.NumeroParcelas) - { - keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); - } - } - if (!this._permitirVencimentoMaior) - { - emissao = this.Documento.Vigencia2; - if (emissao.HasValue) - { - vencimento = this.Vencimento; - emissao = this.Documento.Vigencia2; - if ((emissao.HasValue ? vencimento > emissao.GetValueOrDefault() : false) && this.Documento.Controle.Ramo.Id != (long)23) - { - keyValuePairs.AddValue("Vencimento", Messages.VencimentoMaior, true); - } - } - } - if (!this._permitirVencimentoMenor) - { - if (this.Documento.Vigencia1 > DateTime.MinValue && this.NumeroParcela == 1) - { - DateTime dateTime = this.Vencimento; - vencimento = this.Documento.Vigencia1; - if (dateTime < vencimento.AddDays(-30)) - { - goto Label6; - } - } - if (this.NumeroParcela == 1 || !(this.Vencimento < this.Documento.Vigencia1)) - { - goto Label7; - } - Label6: - keyValuePairs.AddValue("Vencimento", Messages.VencimentoMenor, true); - } - Label7: - if (this.Documento == null || this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura) - { - return keyValuePairs; - } - if (string.IsNullOrWhiteSpace(this.Fatura)) - { - keyValuePairs.AddValue("Fatura", Messages.Obrigatorio, true); - } - else if (this.Fatura.Length > 50) - { - keyValuePairs.AddValue("Fatura", string.Format(Messages.MaiorQueLimite, 255), true); - } - if (this.ValorLiquidoFatura == decimal.Zero) - { - keyValuePairs.AddValue("ValorLiquidoFatura|VALOR LÍQUIDO DA FATURA", Messages.Obrigatorio, true); - } - emissao = this.VigenciaIncial; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", Messages.Obrigatorio, true); - } - emissao = this.VigenciaFinal; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.Obrigatorio, true); - } - emissao = this.Emissao; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("Emissao|EMISSÃO", Messages.Obrigatorio, true); - } - if (!string.IsNullOrWhiteSpace(this.Extrato) && this.Extrato.Length > 50) - { - keyValuePairs.AddValue("Extrato", string.Format(Messages.MaiorQueLimite, 50), true); - } - emissao = this.VigenciaFinal; - if (emissao.HasValue) - { - emissao = this.Documento.Vigencia2; - if (emissao.HasValue) - { - emissao = this.VigenciaFinal; - vigencia2 = this.Documento.Vigencia2; - if ((emissao.HasValue & vigencia2.HasValue ? emissao.GetValueOrDefault() > vigencia2.GetValueOrDefault() : false) && !this._permitirVencimentoMaior) - { - keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.VencimentoMaior, true); - } - } - } - vigencia2 = this.DataRecebimento; - if (!vigencia2.HasValue && this.ValorComissao != decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura) - { - keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio, true); - } - if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.Documento.Parcelas != null && this.Documento.Parcelas.Any((Parcela x) => { - if (x.NumeroParcela >= this.NumeroParcela) - { - return false; - } - return !x.DataRecebimento.HasValue; - })) - { - keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.BaixaInvalida, true); - } - vigencia2 = this.DataRecebimento; - if (vigencia2.HasValue && this.ValorComissao != decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura) - { - decimal num6 = (this.ValorExtrato == decimal.Zero ? this.ValorLiquidoFatura : this.ValorExtrato); - if (num6 > decimal.Zero) - { - num = num6.CompareTo(this.ValorComissao); - } - else - { - numeroParcelas = this.ValorComissao; - num = numeroParcelas.CompareTo(num6); - } - if (num < 0) - { - keyValuePairs.AddValue("ValorComissao|RECEBIDO", "VALOR RECEBIDO MAIOR QUE VALOR PARCELA", true); - } - } - return keyValuePairs; - } - } -} \ No newline at end of file -- cgit v1.2.3