From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../ValoresApoliceViewModel.cs | 306 +++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs new file mode 100644 index 0000000..e27a291 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ValoresApoliceViewModel : BaseSegurosViewModel +{ + private Visibility _isVisibleEspecial; + + private Visibility _isVisibleVendedores; + + private decimal _prevista; + + private decimal _recebida; + + private decimal _recebidaEspecial; + + private decimal _pendente; + + private decimal _repasse; + + private decimal _repasseEspecial; + + private decimal _paga; + + private decimal _pagaEspecial; + + private string _apoliceLabel = "DESCRIÇÃO DE VALORES"; + + private string _apoliceDescricao = "VALORES BASEADOS NO DOCUMENTO SELECIONADO ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS."; + + private Documento _selectedDocumento; + + private ObservableCollection _pagamentos; + + public Visibility IsVisibleEspecial + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleEspecial; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleEspecial = value; + OnPropertyChanged("IsVisibleEspecial"); + } + } + + public Visibility IsVisibleVendedores + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleVendedores; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleVendedores = value; + OnPropertyChanged("IsVisibleVendedores"); + } + } + + public decimal Prevista + { + get + { + return _prevista; + } + set + { + _prevista = value; + OnPropertyChanged("Prevista"); + } + } + + public decimal Recebida + { + get + { + return _recebida; + } + set + { + _recebida = value; + OnPropertyChanged("Recebida"); + } + } + + public decimal RecebidaEspecial + { + get + { + return _recebidaEspecial; + } + set + { + _recebidaEspecial = value; + OnPropertyChanged("RecebidaEspecial"); + } + } + + public decimal Pendente + { + get + { + return _pendente; + } + set + { + _pendente = value; + OnPropertyChanged("Pendente"); + } + } + + public decimal Repasse + { + get + { + return _repasse; + } + set + { + _repasse = value; + OnPropertyChanged("Repasse"); + } + } + + public decimal RepasseEspecial + { + get + { + return _repasseEspecial; + } + set + { + _repasseEspecial = value; + OnPropertyChanged("RepasseEspecial"); + } + } + + public decimal Paga + { + get + { + return _paga; + } + set + { + _paga = value; + OnPropertyChanged("Paga"); + } + } + + public decimal PagaEspecial + { + get + { + return _pagaEspecial; + } + set + { + _pagaEspecial = value; + OnPropertyChanged("PagaEspecial"); + } + } + + public string ApoliceLabel + { + get + { + return _apoliceLabel; + } + set + { + _apoliceLabel = value; + OnPropertyChanged("ApoliceLabel"); + } + } + + public string ApoliceDescricao + { + get + { + return _apoliceDescricao; + } + set + { + _apoliceDescricao = value; + OnPropertyChanged("ApoliceDescricao"); + } + } + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + _selectedDocumento = value; + OnPropertyChanged("SelectedDocumento"); + } + } + + public ObservableCollection Pagamentos + { + get + { + return _pagamentos; + } + set + { + _pagamentos = value; + OnPropertyChanged("Pagamentos"); + } + } + + public ValoresApoliceViewModel(Documento documento) + { + base.EnableMenu = true; + Seleciona(documento); + } + + public void Seleciona(Documento documento) + { + SelectedDocumento = documento; + if (SelectedDocumento.Tipo != 1) + { + ApoliceLabel = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES DA PROPOSTA " + SelectedDocumento.Proposta) : ("VALORES DA APÓLICE " + SelectedDocumento.Apolice)); + ApoliceDescricao = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES BASEADOS NA PROPOSTA " + SelectedDocumento.Proposta + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.") : ("VALORES BASEADOS NA APÓLICE " + SelectedDocumento.Apolice + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.")); + } + CalculaComissao(); + CalculaEspecial(); + CalculaRepasse(); + RegistrarAcao($"CONSULTOU MAIS INFORMAÇÕES DOS VALORES DO DOCUMENTO DE ID {((DomainBase)documento).Id}", ((DomainBase)documento).Id, (TipoTela)21); + } + + private void CalculaRepasse() + { + if (SelectedDocumento.Pagamentos.All((VendedorParcela x) => x.Vendedor.Corretora)) + { + IsVisibleVendedores = (Visibility)2; + return; + } + List list = (from x in SelectedDocumento.Pagamentos + where !x.Vendedor.Corretora + group x by ((DomainBase)x.Vendedor).Id).Select((Func, VendedorParcela>)((IGrouping x) => new VendedorParcela + { + Repasse = x.First().Repasse, + Documento = SelectedDocumento, + ValorTotal = x.First().ValorTotal, + Vendedor = x.First().Vendedor, + ValorTotalPago = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo == 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasseB = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasse = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + PorcentagemRepasse = x.First().PorcentagemRepasse / (decimal?)100, + TipoVendedor = x.First().TipoVendedor + })).ToList(); + Pagamentos = new ObservableCollection(list); + } + + private void CalculaComissao() + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Invalid comparison between Unknown and I4 + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) + { + decimal num = (SelectedDocumento.AdicionalComiss ? (SelectedDocumento.PremioLiquido + SelectedDocumento.PremioAdicional) : SelectedDocumento.PremioLiquido); + decimal num2 = SelectedDocumento.Comissao * 0.01m; + Prevista = num * num2; + } + else + { + Prevista = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorLiquidoFatura * ((x.Comissao < 1m) ? x.Comissao : ((x.Comissao > 100m) ? 1m : (x.Comissao * 0.01m)))); + } + Recebida = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorComissao); + Pendente = Prevista - Recebida; + Repasse = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + Paga = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + } + + private void CalculaEspecial() + { + if (SelectedDocumento.Parcelas.All((Parcela x) => (int)x.SubTipo == 1)) + { + IsVisibleEspecial = (Visibility)2; + return; + } + RecebidaEspecial = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo != 1).Sum((Parcela x) => x.ValorComissao); + RepasseEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + PagaEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + } +} -- cgit v1.2.3