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 --- .../ViewModels/Drawer/ValoresApoliceViewModel.cs | 345 --------------------- 1 file changed, 345 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs (limited to 'Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs') diff --git a/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs b/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs deleted file mode 100644 index df49b81..0000000 --- a/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs +++ /dev/null @@ -1,345 +0,0 @@ -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Windows; - -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 string ApoliceDescricao - { - get - { - return this._apoliceDescricao; - } - set - { - this._apoliceDescricao = value; - base.OnPropertyChanged("ApoliceDescricao"); - } - } - - public string ApoliceLabel - { - get - { - return this._apoliceLabel; - } - set - { - this._apoliceLabel = value; - base.OnPropertyChanged("ApoliceLabel"); - } - } - - public Visibility IsVisibleEspecial - { - get - { - return this._isVisibleEspecial; - } - set - { - this._isVisibleEspecial = value; - base.OnPropertyChanged("IsVisibleEspecial"); - } - } - - public Visibility IsVisibleVendedores - { - get - { - return this._isVisibleVendedores; - } - set - { - this._isVisibleVendedores = value; - base.OnPropertyChanged("IsVisibleVendedores"); - } - } - - public decimal Paga - { - get - { - return this._paga; - } - set - { - this._paga = value; - base.OnPropertyChanged("Paga"); - } - } - - public decimal PagaEspecial - { - get - { - return this._pagaEspecial; - } - set - { - this._pagaEspecial = value; - base.OnPropertyChanged("PagaEspecial"); - } - } - - public ObservableCollection Pagamentos - { - get - { - return this._pagamentos; - } - set - { - this._pagamentos = value; - base.OnPropertyChanged("Pagamentos"); - } - } - - public decimal Pendente - { - get - { - return this._pendente; - } - set - { - this._pendente = value; - base.OnPropertyChanged("Pendente"); - } - } - - public decimal Prevista - { - get - { - return this._prevista; - } - set - { - this._prevista = value; - base.OnPropertyChanged("Prevista"); - } - } - - public decimal Recebida - { - get - { - return this._recebida; - } - set - { - this._recebida = value; - base.OnPropertyChanged("Recebida"); - } - } - - public decimal RecebidaEspecial - { - get - { - return this._recebidaEspecial; - } - set - { - this._recebidaEspecial = value; - base.OnPropertyChanged("RecebidaEspecial"); - } - } - - public decimal Repasse - { - get - { - return this._repasse; - } - set - { - this._repasse = value; - base.OnPropertyChanged("Repasse"); - } - } - - public decimal RepasseEspecial - { - get - { - return this._repasseEspecial; - } - set - { - this._repasseEspecial = value; - base.OnPropertyChanged("RepasseEspecial"); - } - } - - public Documento SelectedDocumento - { - get - { - return this._selectedDocumento; - } - set - { - this._selectedDocumento = value; - base.OnPropertyChanged("SelectedDocumento"); - } - } - - public ValoresApoliceViewModel(Documento documento) - { - base.EnableMenu = true; - this.Seleciona(documento); - } - - private void CalculaComissao() - { - if (this.SelectedDocumento.get_TipoRecebimento().GetValueOrDefault() != 1) - { - this.Prevista = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() == 1 - select x).Sum((Parcela x) => x.get_ValorLiquidoFatura() * (x.get_Comissao() < decimal.One ? x.get_Comissao() : (x.get_Comissao() > new decimal(100) ? decimal.One : x.get_Comissao() * new decimal(1, 0, 0, false, 2)))); - } - else - { - decimal num = (this.SelectedDocumento.get_AdicionalComiss() ? this.SelectedDocumento.get_PremioLiquido() + this.SelectedDocumento.get_PremioAdicional() : this.SelectedDocumento.get_PremioLiquido()); - decimal comissao = this.SelectedDocumento.get_Comissao() * new decimal(1, 0, 0, false, 2); - this.Prevista = num * comissao; - } - this.Recebida = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() == 1 - select x).Sum((Parcela x) => x.get_ValorComissao()); - this.Pendente = this.Prevista - this.Recebida; - this.Repasse = ( - from x in this.SelectedDocumento.get_Pagamentos() - where x.get_Parcela().get_SubTipo() == 1 - select x).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.Paga = this.SelectedDocumento.get_Pagamentos().Where((VendedorParcela x) => { - if (x.get_Parcela().get_SubTipo() != 1) - { - return false; - } - return x.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - } - - private void CalculaEspecial() - { - if (this.SelectedDocumento.get_Parcelas().All((Parcela x) => x.get_SubTipo() == 1)) - { - this.IsVisibleEspecial = Visibility.Collapsed; - return; - } - this.RecebidaEspecial = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() != 1 - select x).Sum((Parcela x) => x.get_ValorComissao()); - this.RepasseEspecial = ( - from x in this.SelectedDocumento.get_Pagamentos() - where x.get_Parcela().get_SubTipo() != 1 - select x).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.PagaEspecial = this.SelectedDocumento.get_Pagamentos().Where((VendedorParcela x) => { - if (x.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return x.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - } - - private void CalculaRepasse() - { - if (this.SelectedDocumento.get_Pagamentos().All((VendedorParcela x) => x.get_Vendedor().get_Corretora())) - { - this.IsVisibleVendedores = Visibility.Collapsed; - return; - } - List list = ( - from x in this.SelectedDocumento.get_Pagamentos() - where !x.get_Vendedor().get_Corretora() - group x by x.get_Vendedor().get_Id()).Select, VendedorParcela>((IGrouping x) => { - VendedorParcela vendedorParcela = new VendedorParcela(); - vendedorParcela.set_Repasse(x.First().get_Repasse()); - vendedorParcela.set_Documento(this.SelectedDocumento); - vendedorParcela.set_ValorTotal(x.First().get_ValorTotal()); - vendedorParcela.set_Vendedor(x.First().get_Vendedor()); - vendedorParcela.set_ValorTotalPago(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() != 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasseB(( - from y in x - where y.get_Parcela().get_SubTipo() != 1 - select y).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasse(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - decimal? porcentagemRepasse = x.First().get_PorcentagemRepasse(); - vendedorParcela.set_PorcentagemRepasse((porcentagemRepasse.HasValue ? new decimal?(porcentagemRepasse.GetValueOrDefault() / 100) : null)); - vendedorParcela.set_TipoVendedor(x.First().get_TipoVendedor()); - return vendedorParcela; - }).ToList(); - this.Pagamentos = new ObservableCollection(list); - } - - public void Seleciona(Documento documento) - { - this.SelectedDocumento = documento; - if (this.SelectedDocumento.get_Tipo() != 1) - { - this.ApoliceLabel = (!this.SelectedDocumento.get_Emissao().HasValue ? string.Concat("VALORES DA PROPOSTA ", this.SelectedDocumento.get_Proposta()) : string.Concat("VALORES DA APÓLICE ", this.SelectedDocumento.get_Apolice())); - this.ApoliceDescricao = (!this.SelectedDocumento.get_Emissao().HasValue ? string.Concat("VALORES BASEADOS NA PROPOSTA ", this.SelectedDocumento.get_Proposta(), " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.") : string.Concat("VALORES BASEADOS NA APÓLICE ", this.SelectedDocumento.get_Apolice(), " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.")); - } - this.CalculaComissao(); - this.CalculaEspecial(); - this.CalculaRepasse(); - base.RegistrarAcao(string.Format("CONSULTOU MAIS INFORMAÇÕES DOS VALORES DO DOCUMENTO DE ID {0}", documento.get_Id()), documento.get_Id(), new TipoTela?(21), null); - } - } -} \ No newline at end of file -- cgit v1.2.3