diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.ViewModels.BI | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.BI')
5 files changed, 3538 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs new file mode 100644 index 0000000..edeae96 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs @@ -0,0 +1,61 @@ +using Gestor.Application.ViewModels.Generic; +using LiveCharts; + +namespace Gestor.Application.ViewModels.BI; + +public class BISeriesViewModel : BaseSegurosViewModel +{ + private int _indice; + + private string _titulo; + + private SeriesCollection _serie; + + public int Indice + { + get + { + return _indice; + } + set + { + if (_indice != value) + { + _indice = value; + OnPropertyChanged("Indice"); + } + } + } + + public string Titulo + { + get + { + return _titulo; + } + set + { + if (!(_titulo == value)) + { + _titulo = value; + OnPropertyChanged("Titulo"); + } + } + } + + public SeriesCollection Serie + { + get + { + return _serie; + } + set + { + if (_serie != value) + { + _serie = value; + OnPropertyChanged("Serie"); + } + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs new file mode 100644 index 0000000..7023c98 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs @@ -0,0 +1,265 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.BI; + +public class NotasViewModel : BaseSegurosViewModel +{ + private readonly TarefaServico _servico; + + private bool _enableIncluirNota = true; + + private bool _ocultarUsuarios; + + private ObservableCollection<Usuario> _usuarios; + + private Usuario _selectedUsuario; + + private Tarefa _tarefa; + + private ObservableCollection<Tarefa> _notas; + + private ObservableCollection<Tarefa> _notasConcluidas; + + private Tarefa _selectedNota; + + private bool _ocultarNotasConcluidas = true; + + public bool EnableIncluirNota + { + get + { + return _enableIncluirNota; + } + set + { + _enableIncluirNota = value; + OnPropertyChanged("EnableIncluirNota"); + } + } + + public bool OcultarUsuarios + { + get + { + return _ocultarUsuarios; + } + set + { + _ocultarUsuarios = value; + OnPropertyChanged("OcultarUsuarios"); + } + } + + public ObservableCollection<Usuario> Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + Carregar(); + OnPropertyChanged("SelectedUsuario"); + } + } + + public Tarefa Tarefa + { + get + { + return _tarefa; + } + set + { + _tarefa = value; + OnPropertyChanged("Tarefa"); + } + } + + public ObservableCollection<Tarefa> Notas + { + get + { + return _notas; + } + set + { + _notas = value; + OnPropertyChanged("Notas"); + } + } + + public ObservableCollection<Tarefa> NotasConcluidas + { + get + { + return _notasConcluidas; + } + set + { + _notasConcluidas = value; + OnPropertyChanged("NotasConcluidas"); + } + } + + public Tarefa SelectedNota + { + get + { + return _selectedNota; + } + set + { + _selectedNota = value; + OnPropertyChanged("SelectedNota"); + } + } + + public bool OcultarNotasConcluidas + { + get + { + return _ocultarNotasConcluidas; + } + set + { + _ocultarNotasConcluidas = value; + OnPropertyChanged("OcultarNotasConcluidas"); + } + } + + public NotasViewModel() + { + _servico = new TarefaServico(); + Usuarios = new ObservableCollection<Usuario>((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + SelectedUsuario = ((IEnumerable<Usuario>)Usuarios).FirstOrDefault((Func<Usuario, bool>)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)); + Usuario usuario = Recursos.Usuario; + OcultarUsuarios = usuario != null && usuario.Administrador; + Usuario usuario2 = Recursos.Usuario; + EnableIncluirNota = usuario2 != null && ((DomainBase)usuario2).Id > 0; + } + + public async void Carregar() + { + await CarregarNotas(); + } + + public async Task CarregarNotas() + { + if (SelectedUsuario == null) + { + return; + } + List<Tarefa> list = await _servico.BuscarNotas(((DomainBase)SelectedUsuario).Id); + list.ForEach(delegate(Tarefa x) + { + if (x.Titulo == "TÍTULO" && x.Descricao == "DESCRIÇÃO") + { + x.HabilitarPublica = true; + } + }); + Notas = new ObservableCollection<Tarefa>(list); + NotasConcluidas = new ObservableCollection<Tarefa>(await _servico.BuscarNotasConcluidas(((DomainBase)SelectedUsuario).Id)); + } + + public async Task AdicionarNota() + { + if (Notas != null && Notas.Any((Tarefa x) => x.Titulo == "TÍTULO" && x.Descricao == "DESCRIÇÃO")) + { + await ShowMessage("PARA ADICIONAR OUTRA NOTA, INSERIR TÍTULO E DESCRIÇÃO DA NOTA JÁ ADICIONADA"); + return; + } + Tarefa nota2 = new Tarefa + { + Agendamento = Funcoes.GetNetworkTime(), + Titulo = "TÍTULO", + Anotacoes = "DESCRIÇÃO", + Usuario = Usuarios.First((Usuario x) => ((DomainBase)x).Id == ((DomainBase)SelectedUsuario).Id), + UsuarioCadastro = Recursos.Usuario, + Entidade = (TipoTarefa)1, + Status = (StatusTarefa)0 + }; + nota2 = await _servico.Salvar(nota2); + await CarregarNotas(); + SelectedNota = nota2; + } + + public async Task<Tarefa> SalvarNota(Tarefa nota) + { + return await _servico.Salvar(nota); + } + + public async Task<List<KeyValuePair<string, string>>> Salvar(Tarefa destino) + { + destino.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list = destino.Validate(); + if (list.Count > 0) + { + return list; + } + bool publica = destino.Publica; + await _servico.Salvar(destino); + if (!_servico.Sucesso) + { + return null; + } + if (publica) + { + long id = ((DomainBase)destino.Usuario).Id; + List<Usuario> usuarios = Recursos.Usuarios; + List<Task> list2 = new List<Task>(); + foreach (Usuario item in usuarios) + { + if (id != ((DomainBase)item).Id) + { + Tarefa val = (Tarefa)((DomainBase)destino).Clone(); + ((DomainBase)val).Id = 0L; + val.Usuario = item; + list2.Add(_servico.Salvar(val)); + } + } + await Task.WhenAll(list2); + } + await CarregarNotas(); + return null; + } + + public void ToggleNotasConcluidas() + { + OcultarNotasConcluidas = !OcultarNotasConcluidas; + } + + public async Task ExcluirNota(Tarefa nota) + { + await _servico.Excluir(((DomainBase)nota).Id); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs new file mode 100644 index 0000000..2a12cda --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs @@ -0,0 +1,1563 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Seguros; +using LiveCharts; +using LiveCharts.Defaults; +using LiveCharts.Definitions.Series; +using LiveCharts.Helpers; +using LiveCharts.Wpf; + +namespace Gestor.Application.ViewModels.BI; + +public class PainelBiViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _clienteServico; + + private readonly ApoliceServico _apoliceServico; + + private readonly ParcelaServico _parcelaServico; + + private Visibility _isVisibleProducao = (Visibility)2; + + private Visibility _isVisibleClientes = (Visibility)2; + + private Visibility _isVisiblePendencia = (Visibility)2; + + private Visibility _isVisibleVencimento = (Visibility)2; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddDays(-7.0); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private DateTime _inicioClientes = Funcoes.GetNetworkTime().Date.AddDays(-7.0); + + private DateTime _fimClientes = Funcoes.GetNetworkTime().Date; + + private DateTime _inicioVencimento = Funcoes.GetNetworkTime().Date; + + private DateTime _fimVencimento = Funcoes.GetNetworkTime().Date.AddDays(7.0); + + private Grafico _producao; + + private Grafico _fechamento; + + private int _aniversariantes; + + private int _vencimentoCnh; + + private int _vencimentos; + + private int _parcelasPendentes; + + private int _parcelasAVencer; + + private int _cotacoes; + + private List<Parcela> _parcelasPendencia; + + private List<Parcela> _parcelasVencimento; + + private List<Documento> _documentosVencimento; + + private List<ClientesAtivosInativos> _clientesAniversariantes; + + private List<ClientesAtivosInativos> _clientesCnh; + + private int _quatidadeProducao; + + private int _endossos; + + private int _faturas; + + private int _apolicesPendentes; + + private int _novosNegocios; + + private int _renovacoes; + + private int _cancelamentos; + + private decimal _producaoTotal; + + private decimal _producaoTotalAnterior; + + private decimal _comissaoTotal; + + private List<Documento> _documentosProducao; + + private List<Documento> _documentosPendentes; + + private List<Documento> _documentosFechamento; + + private Grafico _gerada; + + private Grafico _mediaComissao; + + private Func<double, string> _yFormatter; + + private Func<double, string> _xFormatter; + + public Visibility IsVisibleProducao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleProducao; + } + 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) + _isVisibleProducao = value; + OnPropertyChanged("IsVisibleProducao"); + } + } + + public Visibility IsVisibleClientes + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleClientes; + } + 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) + _isVisibleClientes = value; + OnPropertyChanged("IsVisibleClientes"); + } + } + + public Visibility IsVisiblePendencia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePendencia; + } + 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) + _isVisiblePendencia = value; + OnPropertyChanged("IsVisiblePendencia"); + } + } + + public Visibility IsVisibleVencimento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleVencimento; + } + 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) + _isVisibleVencimento = value; + OnPropertyChanged("IsVisibleVencimento"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public DateTime InicioClientes + { + get + { + return _inicioClientes; + } + set + { + _inicioClientes = value; + OnPropertyChanged("InicioClientes"); + } + } + + public DateTime FimClientes + { + get + { + return _fimClientes; + } + set + { + _fimClientes = value; + OnPropertyChanged("FimClientes"); + } + } + + public DateTime InicioVencimento + { + get + { + return _inicioVencimento; + } + set + { + _inicioVencimento = value; + OnPropertyChanged("InicioVencimento"); + } + } + + public DateTime FimVencimento + { + get + { + return _fimVencimento; + } + set + { + _fimVencimento = value; + OnPropertyChanged("FimVencimento"); + } + } + + public Grafico Producao + { + get + { + return _producao; + } + set + { + _producao = value; + OnPropertyChanged("Producao"); + } + } + + public Grafico Fechamento + { + get + { + return _fechamento; + } + set + { + _fechamento = value; + OnPropertyChanged("Fechamento"); + } + } + + public int Aniversariantes + { + get + { + return _aniversariantes; + } + set + { + _aniversariantes = value; + OnPropertyChanged("Aniversariantes"); + } + } + + public int VencimentoCnh + { + get + { + return _vencimentoCnh; + } + set + { + _vencimentoCnh = value; + OnPropertyChanged("VencimentoCnh"); + } + } + + public int Vencimentos + { + get + { + return _vencimentos; + } + set + { + _vencimentos = value; + OnPropertyChanged("Vencimentos"); + } + } + + public int ParcelasPendentes + { + get + { + return _parcelasPendentes; + } + set + { + _parcelasPendentes = value; + OnPropertyChanged("ParcelasPendentes"); + } + } + + public int ParcelasAVencer + { + get + { + return _parcelasAVencer; + } + set + { + _parcelasAVencer = value; + OnPropertyChanged("ParcelasAVencer"); + } + } + + public int Cotacoes + { + get + { + return _cotacoes; + } + set + { + _cotacoes = value; + OnPropertyChanged("Cotacoes"); + } + } + + public int QuatidadeProducao + { + get + { + return _quatidadeProducao; + } + set + { + _quatidadeProducao = value; + OnPropertyChanged("QuatidadeProducao"); + } + } + + public int Endossos + { + get + { + return _endossos; + } + set + { + _endossos = value; + OnPropertyChanged("Endossos"); + } + } + + public int Faturas + { + get + { + return _faturas; + } + set + { + _faturas = value; + OnPropertyChanged("Faturas"); + } + } + + public int ApolicesPendentes + { + get + { + return _apolicesPendentes; + } + set + { + _apolicesPendentes = value; + OnPropertyChanged("ApolicesPendentes"); + } + } + + public int NovosNegocios + { + get + { + return _novosNegocios; + } + set + { + _novosNegocios = value; + OnPropertyChanged("NovosNegocios"); + } + } + + public int Renovacoes + { + get + { + return _renovacoes; + } + set + { + _renovacoes = value; + OnPropertyChanged("Renovacoes"); + } + } + + public int Cancelamentos + { + get + { + return _cancelamentos; + } + set + { + _cancelamentos = value; + OnPropertyChanged("Cancelamentos"); + } + } + + public decimal ProducaoTotal + { + get + { + return _producaoTotal; + } + set + { + _producaoTotal = value; + OnPropertyChanged("ProducaoTotal"); + } + } + + public decimal ProducaoTotalAnterior + { + get + { + return _producaoTotalAnterior; + } + set + { + _producaoTotalAnterior = value; + OnPropertyChanged("ProducaoTotalAnterior"); + } + } + + public decimal ComissaoTotal + { + get + { + return _comissaoTotal; + } + set + { + _comissaoTotal = value; + OnPropertyChanged("ComissaoTotal"); + } + } + + public Grafico Gerada + { + get + { + return _gerada; + } + set + { + _gerada = value; + OnPropertyChanged("Gerada"); + } + } + + public Grafico MediaComissao + { + get + { + return _mediaComissao; + } + set + { + _mediaComissao = value; + OnPropertyChanged("MediaComissao"); + } + } + + public Func<double, string> YFormatter + { + get + { + return _yFormatter; + } + set + { + _yFormatter = value; + OnPropertyChanged("YFormatter"); + } + } + + public Func<double, string> XFormatter + { + get + { + return _xFormatter; + } + set + { + _xFormatter = value; + OnPropertyChanged("XFormatter"); + } + } + + public PainelBiViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + _clienteServico = new ClienteServico(); + _apoliceServico = new ApoliceServico(); + _parcelaServico = new ParcelaServico(); + LoadInicial(); + } + + private async void LoadInicial() + { + await GerarProducao(); + await GerarVencimento(); + await GerarClientes(); + } + + public async Task GerarClientes() + { + IsVisibleClientes = (Visibility)2; + Filtros filtro = new Filtros + { + Inicio = InicioClientes, + Fim = FimClientes, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + }; + _clientesAniversariantes = await _clienteServico.BuscarAniversariantes(filtro); + Aniversariantes = _clientesAniversariantes.Count; + _clientesCnh = await _clienteServico.BuscarVencimentosCnh(filtro); + VencimentoCnh = _clientesCnh.Count; + IsVisibleClientes = (Visibility)0; + } + + public async Task GerarVencimento() + { + IsVisibleVencimento = (Visibility)2; + List<VendedorUsuario> source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = InicioVencimento, + Fim = FimVencimento, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _documentosVencimento = (await _apoliceServico.BuscarApolicesVigenciaFinal(filtro)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + Vencimentos = _documentosVencimento.Count; + _parcelasVencimento = (await _parcelaServico.BuscarParcelas(filtro)).Where((Parcela x) => (int)x.Documento.Situacao != 7).ToList(); + ParcelasAVencer = _parcelasVencimento.Count; + IsVisibleVencimento = (Visibility)0; + } + + public async Task GerarPendencia() + { + IsVisiblePendencia = (Visibility)2; + List<VendedorUsuario> source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = Inicio, + Fim = Fim, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _parcelasPendencia = (await _parcelaServico.BuscarParcelasPendentes(filtro)).Where((Parcela x) => (int)x.Documento.Situacao != 7).ToList(); + ParcelasPendentes = _parcelasPendencia.Count; + IsVisiblePendencia = (Visibility)0; + } + + public async Task GerarProducao() + { + IsVisibleProducao = (Visibility)2; + Producao = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C0") + }; + Gerada = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C2") + }; + MediaComissao = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("P2") + }; + Fechamento = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C2") + }; + List<VendedorUsuario> source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = Inicio, + Fim = Fim, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + Filtros filtroFechamento = new Filtros + { + Inicio = Inicio.AddYears(-1), + Fim = Fim.AddYears(-1), + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _documentosProducao = (await _apoliceServico.BuscarApolices(filtro, buscarAssinatura: false, painelBi: true)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + _documentosPendentes = await _apoliceServico.BuscarApolicesPendentes(filtro); + List<Documento> source2 = await _parcelaServico.BuscarFaturas(filtro, buscaAssinaturas: false, painelBi: true); + _documentosProducao.AddRange(source2.Where((Documento x) => (int)x.Situacao != 7)); + ApolicesPendentes = _documentosPendentes.Count((Documento x) => string.IsNullOrEmpty(x.Apolice) && x.Tipo != 2); + await GerarPendencia(); + _documentosFechamento = (await _apoliceServico.BuscarApolices(filtroFechamento, buscarAssinatura: false, painelBi: true)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + List<Documento> source3 = await _parcelaServico.BuscarFaturas(filtroFechamento, buscaAssinaturas: false, painelBi: true); + _documentosFechamento.AddRange(source3.Where((Documento x) => (int)x.Situacao != 7)); + Cotacoes = await _apoliceServico.Cotacoes(filtro); + QuatidadeProducao = _documentosProducao.Count((Documento x) => x.Tipo != 2); + Faturas = _documentosProducao.Count((Documento x) => x.Tipo == 2); + NovosNegocios = _documentosProducao.Count((Documento x) => x.Tipo == 0 && ((int)x.Situacao == 1 || ((int)x.Situacao == 2 && x.NegocioCorretora == (NegocioCorretora?)0))); + Renovacoes = _documentosProducao.Count((Documento x) => x.Tipo == 0 && (int)x.Situacao == 2 && ((int)x.NegocioCorretora.GetValueOrDefault() == 1 || (int)x.Negocio.GetValueOrDefault() == 1)); + Cancelamentos = (from x in _documentosProducao + where (int)x.Situacao == 3 && x.Tipo == 1 + select ((DomainBase)x.Controle).Id).Distinct().Count(); + Endossos = _documentosProducao.Count((Documento x) => x.Tipo == 1); + ProducaoTotal = _documentosProducao.Sum((Documento x) => x.PremioLiquido); + ProducaoTotalAnterior = _documentosFechamento.Sum((Documento x) => x.PremioLiquido); + ComissaoTotal = _documentosProducao.Sum((Documento x) => (x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m); + (from x in _documentosProducao + group x by x.Controle.Seguradora.NomeSocial into x + orderby x.Sum((Documento p) => p.PremioLiquido) descending + select x).ToList().ForEach(delegate(IGrouping<string, Documento> x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Expected O, but got Unknown + ColumnSeries val6 = new ColumnSeries + { + Title = x.Key + }; + ChartValues<decimal> obj = new ChartValues<decimal>(); + ((NoisyCollection<decimal>)(object)obj).Add(x.Sum((Documento p) => p.PremioLiquido)); + ((Series)val6).Values = (IChartValues)(object)obj; + ((Series)val6).LabelPoint = (ChartPoint chartPoint) => "R$ " + x.Sum((Documento p) => p.PremioLiquido).ToString("N2"); + val6.MaxColumnWidth = double.PositiveInfinity; + ColumnSeries val7 = val6; + ((NoisyCollection<ISeriesView>)(object)Producao.Series).Add((ISeriesView)(object)val7); + decimal comissaoGerada = x.Sum((Documento p) => (p.PremioLiquido + (p.AdicionalComiss ? p.PremioAdicional : 0m)) * p.Comissao * 0.01m); + PieSeries val8 = new PieSeries + { + Title = x.Key + }; + ChartValues<decimal> obj2 = new ChartValues<decimal>(); + ((NoisyCollection<decimal>)(object)obj2).Add((comissaoGerada > 0m) ? comissaoGerada : (comissaoGerada * -1m)); + ((Series)val8).Values = (IChartValues)(object)obj2; + ((Series)val8).DataLabels = false; + ((Series)val8).LabelPoint = (ChartPoint chartPoint) => "R$ " + comissaoGerada.ToString("N2"); + PieSeries val9 = val8; + ((NoisyCollection<ISeriesView>)(object)Gerada.Series).Add((ISeriesView)(object)val9); + decimal mediaComissao = Math.Round(x.Sum((Documento p) => p.Comissao) / (decimal)x.Count(), 2); + PieSeries val10 = new PieSeries + { + Title = x.Key + }; + ChartValues<decimal> obj3 = new ChartValues<decimal>(); + ((NoisyCollection<decimal>)(object)obj3).Add(mediaComissao); + ((Series)val10).Values = (IChartValues)(object)obj3; + ((Series)val10).DataLabels = false; + ((Series)val10).LabelPoint = (ChartPoint chartPoint) => $" Media de Comissão {mediaComissao}% "; + PieSeries val11 = val10; + ((NoisyCollection<ISeriesView>)(object)MediaComissao.Series).Add((ISeriesView)(object)val11); + }); + double totalDays = (filtro.Fim - filtro.Inicio).TotalDays; + ChartValues<DateTimePoint> val2 = new ChartValues<DateTimePoint>(); + ChartValues<DateTimePoint> val3 = new ChartValues<DateTimePoint>(); + for (int i = 0; (double)i <= totalDays; i++) + { + DateTime dateProc = filtro.Inicio.AddDays(i); + DateTime dateProcAnterior = dateProc.AddYears(-1); + decimal num = _documentosFechamento.Where((Documento s) => s.Vigencia1 == dateProcAnterior).Sum((Documento s) => s.PremioLiquido); + decimal num2 = _documentosProducao.Where((Documento s) => s.Vigencia1 == dateProc).Sum((Documento s) => s.PremioLiquido); + ((NoisyCollection<DateTimePoint>)(object)val2).Add(new DateTimePoint(dateProc, (double)num)); + ((NoisyCollection<DateTimePoint>)(object)val3).Add(new DateTimePoint(dateProc, (double)num2)); + } + LineSeries val4 = new LineSeries + { + Title = $"{filtroFechamento.Inicio.Year}", + Values = (IChartValues)(object)val2 + }; + LineSeries val5 = new LineSeries + { + Title = $"{filtro.Inicio.Year}", + Values = (IChartValues)(object)val3 + }; + ((NoisyCollection<ISeriesView>)(object)Fechamento.Series).Add((ISeriesView)(object)val4); + ((NoisyCollection<ISeriesView>)(object)Fechamento.Series).Add((ISeriesView)(object)val5); + XFormatter = (double val) => new DateTime((long)val).ToString("dd/MM"); + YFormatter = (double val) => val.ToString("C2"); + IsVisibleProducao = (Visibility)0; + } + + public async void Detalhar(int tipo) + { + string titulo = ""; + string tipo2 = "APOLICES"; + List<string> campos = new List<string> + { + "Nome", "Apolice", "Endosso", "Status", "Negocio", "VigenciaInicial", "VigenciaFinal", "Comissao", "PremioLiquido", "PremioTotal", + "Seguradora", "Ramo" + }; + List<Analitico> list; + switch (tipo) + { + default: + titulo = "PRODUÇÃO"; + list = ((IEnumerable<Documento>)_documentosProducao).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val3 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio3; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora3 = x.NegocioCorretora; + negocio3 = (negocioCorretora3.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora3.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio3 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val3.Negocio = (string)negocio3; + val3.PremioLiquido = x.PremioLiquido; + val3.PremioTotal = x.PremioTotal; + val3.VigenciaFinal = x.Vigencia2; + val3.VigenciaInicial = x.Vigencia1; + val3.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val3.Seguradora = x.Controle.Seguradora.NomeSocial; + val3.Ramo = x.Controle.Ramo.Nome; + val3.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val3.Documento = x; + return val3; + }).ToList(); + break; + case 1: + { + titulo = "COMPARATIVO"; + List<Documento> documentosProducao = _documentosProducao; + List<Documento> documentosFechamento = _documentosFechamento; + List<Documento> list2 = new List<Documento>(); + list2.AddRange(documentosProducao); + list2.AddRange(documentosFechamento); + list = ((IEnumerable<Documento>)list2.OrderBy((Documento x) => x.Vigencia1)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val10 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio10; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora10 = x.NegocioCorretora; + negocio10 = (negocioCorretora10.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora10.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio10 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val10.Negocio = (string)negocio10; + val10.PremioLiquido = x.PremioLiquido; + val10.PremioTotal = x.PremioTotal; + val10.VigenciaFinal = x.Vigencia2; + val10.VigenciaInicial = x.Vigencia1; + val10.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val10.Seguradora = x.Controle.Seguradora.NomeSocial; + val10.Ramo = x.Controle.Ramo.Nome; + val10.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val10.Documento = x; + return val10; + }).ToList(); + break; + } + case 2: + titulo = "NOVOS NEGÓCIOS"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where x.Tipo == 0 && ((int)x.Situacao == 1 || ((int)x.Situacao == 2 && x.NegocioCorretora == (NegocioCorretora?)0)) + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val8 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio8; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora8 = x.NegocioCorretora; + negocio8 = (negocioCorretora8.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora8.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio8 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val8.Negocio = (string)negocio8; + val8.PremioLiquido = x.PremioLiquido; + val8.PremioTotal = x.PremioTotal; + val8.VigenciaFinal = x.Vigencia2; + val8.VigenciaInicial = x.Vigencia1; + val8.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val8.Seguradora = x.Controle.Seguradora.NomeSocial; + val8.Ramo = x.Controle.Ramo.Nome; + val8.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val8.Documento = x; + return val8; + }).ToList(); + break; + case 3: + titulo = "RENOVAÇÕES"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where x.Tipo == 0 && (int)x.Situacao == 2 && ((int)x.NegocioCorretora.GetValueOrDefault() == 1 || (int)x.Negocio.GetValueOrDefault() == 1) + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val6 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio6; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora6 = x.NegocioCorretora; + negocio6 = (negocioCorretora6.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora6.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio6 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val6.Negocio = (string)negocio6; + val6.PremioLiquido = x.PremioLiquido; + val6.PremioTotal = x.PremioTotal; + val6.VigenciaFinal = x.Vigencia2; + val6.VigenciaInicial = x.Vigencia1; + val6.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val6.Seguradora = x.Controle.Seguradora.NomeSocial; + val6.Ramo = x.Controle.Ramo.Nome; + val6.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val6.Documento = x; + return val6; + }).ToList(); + break; + case 4: + titulo = "CANCELAMENTOS"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where (int)x.Situacao == 3 && x.Tipo == 1 + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val4 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio4; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora4 = x.NegocioCorretora; + negocio4 = (negocioCorretora4.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora4.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio4 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val4.Negocio = (string)negocio4; + val4.PremioLiquido = x.PremioLiquido; + val4.PremioTotal = x.PremioTotal; + val4.VigenciaFinal = x.Vigencia2; + val4.VigenciaInicial = x.Vigencia1; + val4.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val4.Seguradora = x.Controle.Seguradora.NomeSocial; + val4.Ramo = x.Controle.Ramo.Nome; + val4.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val4.Documento = x; + return val4; + }).ToList(); + break; + case 5: + tipo2 = "CLIENTES"; + campos = new List<string> + { + "Nome", "DocumentoCliente", "Dia/Mês", "Nascimento", "TipoPessoa", "Cidade", "Uf", "Cep", "Telefone", "E-mail", + "Profissão" + }; + list = ((IEnumerable<ClientesAtivosInativos>)_clientesAniversariantes).Select((Func<ClientesAtivosInativos, Analitico>)((ClientesAtivosInativos x) => new Analitico + { + Nome = (x.Nome ?? ""), + DocumentoCliente = x.Documento, + DiaMes = x.Aniversario, + TipoPessoa = ((ValidationHelper.OnlyNumber(x.Documento).Length > 11) ? "JURÍDICA" : "FÍSICA"), + Nascimento = x.Nascimento, + VencimentoHabilitacao = x.VencimentoCnh, + Cliente = x, + Cidade = x.Cidade, + Uf = x.Estado, + Cep = x.Cep, + Telefone = x.Telefone, + Email = x.Email, + Profissao = x.Profissao + })).ToList(); + break; + case 6: + tipo2 = "CLIENTES"; + campos = new List<string> { "Nome", "DocumentoCliente", "Nascimento", "VencimentoHabilitacao" }; + list = ((IEnumerable<ClientesAtivosInativos>)_clientesCnh).Select((Func<ClientesAtivosInativos, Analitico>)((ClientesAtivosInativos x) => new Analitico + { + Nome = (x.Nome ?? ""), + DocumentoCliente = x.Documento, + Nascimento = x.Nascimento, + VencimentoHabilitacao = x.VencimentoCnh, + Cliente = x + })).ToList(); + break; + case 7: + titulo = "APÓLICES À VENCER"; + list = ((IEnumerable<Documento>)_documentosVencimento.OrderBy((Documento x) => x.Vigencia1)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora = x.NegocioCorretora; + negocio = (negocioCorretora.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val.Negocio = (string)negocio; + val.PremioLiquido = x.PremioLiquido; + val.PremioTotal = x.PremioTotal; + val.VigenciaFinal = x.Vigencia2; + val.VigenciaInicial = x.Vigencia1; + val.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val.Seguradora = x.Controle.Seguradora.NomeSocial; + val.Ramo = x.Controle.Ramo.Nome; + val.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val.Documento = x; + return val; + }).ToList(); + break; + case 8: + campos = new List<string> + { + "Nome", "Apolice", "Endosso", "Seguradora", "Comissao", "Vencimento", "Recebimento", "Valor", "ComissaoGerada", "NumeroParcela", + "Ramo" + }; + titulo = "PARCELAS À VENCER"; + tipo2 = "PARCELAS"; + list = ((IEnumerable<Parcela>)_parcelasVencimento.OrderBy((Parcela x) => x.Vencimento)).Select((Func<Parcela, Analitico>)((Parcela x) => new Analitico + { + Nome = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Comissao = x.Comissao, + Seguradora = x.Documento.Controle.Seguradora.NomeSocial, + Ramo = x.Documento.Controle.Ramo.Nome, + Vencimento = x.Vencimento, + Recebimento = x.DataRecebimento, + Valor = x.Valor, + ValorComissao = x.ValorComDesconto, + NumeroParcela = x.NumeroParcela, + Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + }, + Documento = x.Documento, + Parcela = x + })).ToList(); + break; + case 9: + titulo = "APÓLICES PENDENTES"; + list = ((IEnumerable<Documento>)(from x in _documentosPendentes + where string.IsNullOrEmpty(x.Apolice) && x.Tipo != 2 + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val5 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio5; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora5 = x.NegocioCorretora; + negocio5 = (negocioCorretora5.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora5.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio5 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val5.Negocio = (string)negocio5; + val5.PremioLiquido = x.PremioLiquido; + val5.PremioTotal = x.PremioTotal; + val5.VigenciaFinal = x.Vigencia2; + val5.VigenciaInicial = x.Vigencia1; + val5.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val5.Seguradora = x.Controle.Seguradora.NomeSocial; + val5.Ramo = x.Controle.Ramo.Nome; + val5.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val5.Documento = x; + return val5; + }).ToList(); + break; + case 10: + campos = new List<string> { "Nome", "Apolice", "Endosso", "Seguradora", "Comissao", "Vencimento", "Valor", "NumeroParcela", "Ramo" }; + titulo = "PARCELAS PENDENTES"; + tipo2 = "PARCELAS"; + list = ((IEnumerable<Parcela>)_parcelasPendencia.OrderBy((Parcela x) => x.Vencimento)).Select((Func<Parcela, Analitico>)((Parcela x) => new Analitico + { + Nome = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Comissao = x.Comissao, + Seguradora = x.Documento.Controle.Seguradora.NomeSocial, + Ramo = x.Documento.Controle.Ramo.Nome, + Vencimento = x.Vencimento, + Recebimento = x.DataRecebimento, + Valor = x.Valor, + ValorComissao = x.ValorComissao, + NumeroParcela = x.NumeroParcela, + Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + }, + Documento = x.Documento, + Parcela = x + })).ToList(); + break; + case 11: + titulo = "ENDOSSOS"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where x.Tipo == 1 + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val7 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio7; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora7 = x.NegocioCorretora; + negocio7 = (negocioCorretora7.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora7.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio7 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val7.Negocio = (string)negocio7; + val7.PremioLiquido = x.PremioLiquido; + val7.PremioTotal = x.PremioTotal; + val7.VigenciaFinal = x.Vigencia2; + val7.VigenciaInicial = x.Vigencia1; + val7.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val7.Seguradora = x.Controle.Seguradora.NomeSocial; + val7.Ramo = x.Controle.Ramo.Nome; + val7.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val7.Documento = x; + return val7; + }).ToList(); + break; + case 12: + titulo = "FATURAS"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where x.Tipo == 2 + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val2 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio2; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora2 = x.NegocioCorretora; + negocio2 = (negocioCorretora2.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora2.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio2 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val2.Negocio = (string)negocio2; + val2.PremioLiquido = x.PremioLiquido; + val2.PremioTotal = x.PremioTotal; + val2.VigenciaFinal = x.Vigencia2; + val2.VigenciaInicial = x.Vigencia1; + val2.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val2.Seguradora = x.Controle.Seguradora.NomeSocial; + val2.Ramo = x.Controle.Ramo.Nome; + val2.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val2.Documento = x; + return val2; + }).ToList(); + break; + case 13: + titulo = "TOTAL DOCUMENTOS"; + list = ((IEnumerable<Documento>)(from x in _documentosProducao + where x.Tipo != 2 + orderby x.Vigencia1 + select x)).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val9 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio9; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora9 = x.NegocioCorretora; + negocio9 = (negocioCorretora9.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora9.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio9 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val9.Negocio = (string)negocio9; + val9.PremioLiquido = x.PremioLiquido; + val9.PremioTotal = x.PremioTotal; + val9.VigenciaFinal = x.Vigencia2; + val9.VigenciaInicial = x.Vigencia1; + val9.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val9.Seguradora = x.Controle.Seguradora.NomeSocial; + val9.Ramo = x.Controle.Ramo.Nome; + val9.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val9.Documento = x; + return val9; + }).ToList(); + break; + case 14: + titulo = "PRODUÇÃO ANTERIOR"; + list = ((IEnumerable<Documento>)_documentosFechamento).Select((Func<Documento, Analitico>)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val11 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio11; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora11 = x.NegocioCorretora; + negocio11 = (negocioCorretora11.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora11.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio11 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val11.Negocio = (string)negocio11; + val11.PremioLiquido = x.PremioLiquido; + val11.PremioTotal = x.PremioTotal; + val11.VigenciaFinal = x.Vigencia2; + val11.VigenciaInicial = x.Vigencia1; + val11.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val11.Seguradora = x.Controle.Seguradora.NomeSocial; + val11.Ramo = x.Controle.Ramo.Nome; + val11.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val11.Documento = x; + return val11; + }).ToList(); + break; + } + if (list.Count == 0) + { + await ShowMessage("NÃO FOI POSSÍVEL DETALHAR POIS NÃO HÁ DADOS"); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new DialogAnaliticoBi(titulo, list, tipo2, campos), "ANALÍTICO", 1260.0, 500.0)).Show(); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs new file mode 100644 index 0000000..a9fad65 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs @@ -0,0 +1,503 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using ClosedXML.Excel; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.BI; + +public class ProspeccaoViewModel : BaseViewModel +{ + private readonly ProspeccaoServico _servico; + + private PermissaoUsuario SelectedPermissaoUsuario; + + private ObservableCollection<Vendedor> _vendedores; + + private Vendedor _selectedVendedor = new Vendedor(); + + private List<string> _searchStatus = new List<string> + { + "TODOS", + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)1), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)5), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)2), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)4), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)3) + }; + + private string _selectedStatusSearch = "AGENDANDO"; + + private StatusProspeccao? _selectedStatus; + + private ObservableCollection<StatusDeProspeccao> _statusProspeccaoPersonalizado; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date; + + private DateTime _fim = Funcoes.GetNetworkTime().Date.AddDays(7.0); + + private ObservableCollection<Prospeccao> _prospeccoesFiltradas; + + private Prospeccao _selectedProspeccao; + + private ObservableCollection<Prospeccao> _prospeccao; + + private bool _naoHaDados; + + public ObservableCollection<Vendedor> Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + OnPropertyChanged("Vendedores"); + } + } + + public Vendedor SelectedVendedor + { + get + { + return _selectedVendedor; + } + set + { + _selectedVendedor = value; + OnPropertyChanged("SelectedVendedor"); + } + } + + public List<string> SearchStatus + { + get + { + return _searchStatus; + } + set + { + _searchStatus = value; + SelectedStatusSearch = value[1]; + OnPropertyChanged("SearchStatus"); + } + } + + public string SelectedStatusSearch + { + get + { + return _selectedStatusSearch; + } + set + { + _selectedStatusSearch = value; + switch (value) + { + default: + SelectedStatus = null; + break; + case "AGENDADO": + SelectedStatus = (StatusProspeccao)1; + break; + case "GANHO": + SelectedStatus = (StatusProspeccao)2; + break; + case "PERDIDO": + SelectedStatus = (StatusProspeccao)3; + break; + case "NÃO TRABALHADO": + SelectedStatus = (StatusProspeccao)4; + break; + case "EM ANDAMENTO": + SelectedStatus = (StatusProspeccao)5; + break; + } + OnPropertyChanged("SelectedStatusSearch"); + } + } + + public StatusProspeccao? SelectedStatus + { + get + { + return _selectedStatus; + } + set + { + _selectedStatus = value; + OnPropertyChanged("SelectedStatus"); + } + } + + public ObservableCollection<StatusDeProspeccao> StatusProspeccaoPersonalizado + { + get + { + return _statusProspeccaoPersonalizado; + } + set + { + _statusProspeccaoPersonalizado = value; + OnPropertyChanged("StatusProspeccaoPersonalizado"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public List<Prospeccao> Prospeccoes { get; set; } + + public ObservableCollection<Prospeccao> ProspeccoesFiltradas + { + get + { + return _prospeccoesFiltradas; + } + set + { + _prospeccoesFiltradas = value; + OnPropertyChanged("ProspeccoesFiltradas"); + } + } + + public Prospeccao SelectedProspeccao + { + get + { + return _selectedProspeccao; + } + set + { + _selectedProspeccao = value; + OnPropertyChanged("SelectedProspeccao"); + } + } + + public AutoCompleteFilterPredicate<object> ProspeccaoItemFilter => (string searchText, object obj) => ((Prospeccao)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Documento.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Telefone1.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Telefone2.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Email.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).VigenciaFinal.ToString().ToUpper().Contains(searchText.ToUpper()); + + public ObservableCollection<Prospeccao> Prospeccao + { + get + { + return _prospeccao; + } + set + { + _prospeccao = value; + NaoHaDados = value == null || value.Count == 0; + OnPropertyChanged("Prospeccao"); + } + } + + public bool NaoHaDados + { + get + { + return _naoHaDados; + } + set + { + _naoHaDados = value; + OnPropertyChanged("NaoHaDados"); + } + } + + public ProspeccaoViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new ProspeccaoServico(); + StatusProspeccaoPersonalizado = new ObservableCollection<StatusDeProspeccao>(Recursos.StatusProspeccao.Where((StatusDeProspeccao x) => x.Ativo).ToList()); + CarregaVendedores(); + SelectedStatusSearch = SearchStatus[1]; + CarregaProspeccoes(); + } + + public async void Excluir(Prospeccao prospeccao) + { + if (!(await BuscaPermissao("Excluir")) || prospeccao == null) + { + return; + } + bool flag = prospeccao.Tarefa == null; + if (flag) + { + flag = !(await ShowMessage("DESEJA EXCLUIR ESSA PROSPECÇÃO?", "SIM", "NÃO")); + } + bool flag2 = flag; + if (!flag2) + { + bool flag3 = prospeccao.Tarefa != null; + if (flag3) + { + flag3 = !(await ShowMessage("HÁ UMA TAREFA ANEXADA A ESSA PROSPECÇÃO. ESSE PROCEDIMENTO IRÁ EXCLUIR A TAREFA ANEXADA." + Environment.NewLine + "DESEJA REALMENTE PROSSEGUIR?", "SIM", "NÃO")); + } + flag2 = flag3; + } + if (!flag2 && await _servico.Delete(prospeccao)) + { + RegistrarAcao($"EXCLUIU PROSPECÇÃO DO ID: {((DomainBase)prospeccao).Id}", ((DomainBase)prospeccao).Id, (TipoTela)33, $"CLIENTE \"{prospeccao.Nome}\", ID: {((DomainBase)prospeccao).Id}"); + await CarregarProspeccoes(); + ToggleSnackBar("PROSPECÇÃO EXCLUÍDA COM SUCESSO"); + } + } + + public async void CarregaProspeccoes() + { + await CarregarProspeccoes(); + } + + public async void CarregaVendedores() + { + await CarregarVendedores(); + } + + public async Task CarregarVendedores() + { + List<long> vinculos = (await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario)).Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList(); + List<Vendedor> list = new List<Vendedor>(); + if (vinculos.Count > 0 && !Recursos.Usuario.Administrador) + { + list.AddRange((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo && vinculos.Contains(((DomainBase)x).Id) + orderby x.Nome + select x).ToList()); + } + else + { + list.Add(new Vendedor + { + Id = 0L, + Nome = "TODOS OS VENDEDORES" + }); + list.AddRange((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList()); + } + Vendedores = new ObservableCollection<Vendedor>(list); + SelectedVendedor = Vendedores.FirstOrDefault(); + } + + public async Task CarregarProspeccoes() + { + if (!(Inicio > Fim)) + { + Loading(isLoading: true); + base.IsVisible = (Visibility)2; + Prospeccoes = await _servico.BuscarProspeccoes(((DomainBase)SelectedVendedor).Id, Inicio, Fim, SelectedStatus); + ProspeccoesFiltradas = new ObservableCollection<Prospeccao>(Prospeccoes.OrderBy((Prospeccao x) => x.VigenciaFinal)); + SelectedProspeccao = ProspeccoesFiltradas.FirstOrDefault(); + base.IsVisible = (Visibility)0; + Loading(isLoading: false); + } + } + + internal async Task<List<Prospeccao>> FiltrarProspecao(string value) + { + return await Task.Run(() => Filtrar(value)); + } + + public List<Prospeccao> Filtrar(string filter) + { + if (Prospeccoes == null) + { + return null; + } + ProspeccoesFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Prospeccao>(Prospeccoes) : new ObservableCollection<Prospeccao>(from x in Prospeccoes + where ValidationHelper.RemoveDiacritics(ValidationHelper.RemoveDiacritics(x.Nome).ToUpper().Trim()).Contains(filter) || (x.Documento != null && ValidationHelper.RemoveDiacritics(x.Documento.Trim()).Contains(filter)) || (x.Telefone1 != null && ValidationHelper.RemoveDiacritics(x.Telefone1.Trim()).Contains(filter)) || (x.Telefone2 != null && ValidationHelper.RemoveDiacritics(x.Telefone2.Trim()).Contains(filter)) || (x.Email != null && ValidationHelper.RemoveDiacritics(x.Email.Trim()).Contains(filter)) || (x.VigenciaFinal.HasValue && ValidationHelper.RemoveDiacritics(x.VigenciaFinal.ToString().Trim()).Contains(filter)) + orderby x.VigenciaFinal + select x)); + return ProspeccoesFiltradas.ToList(); + } + + public async Task<List<KeyValuePair<string, string>>> Salvar(Prospeccao prospecao) + { + return await SalvarProspeccao(prospecao); + } + + public async Task Print() + { + if (ProspeccoesFiltradas != null) + { + List<ProspeccaoToPrint> printProspect = new List<ProspeccaoToPrint>(); + ProspeccoesFiltradas.AsEnumerable().ToList().ForEach(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + ProspeccaoToPrint item = new ProspeccaoToPrint + { + Nome = x.Nome, + Documento = (x.Documento ?? ""), + Nascimento = x.Nascimento, + Prefixo1 = (x.Prefixo1 ?? ""), + Telefone1 = (x.Telefone1 ?? ""), + Email = (x.Email ?? ""), + VigenciaFinal = x.VigenciaFinal, + Item = (x.Item ?? ""), + Status = x.Status, + StatusPersonalizadotoPrint = ((x.StatusPersonalizado == null) ? "" : x.StatusPersonalizado.Nome), + Tipo = (x.Tipo ?? ""), + Vendedor = (x.Vendedor.Nome ?? null), + Valor = x.Valor + }; + printProspect.Add(item); + }); + printProspect = printProspect.OrderBy((ProspeccaoToPrint x) => x.Vendedor).ToList(); + string text = await Funcoes.GenerateTable(printProspect.ToList(), new List<string>()); + if (!string.IsNullOrEmpty(text)) + { + text = Funcoes.ExportarHtml(new TipoRelatorio + { + Inicio = Inicio, + Fim = Fim, + Nome = "PROSPECÇÕES - " + SelectedVendedor.Nome + }, text, "60", "landscaoe"); + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}PROSPECÇÃO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + } + } + } + + public async Task GerarExcel() + { + if (ProspeccoesFiltradas == null) + { + ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO EM EXCEL"); + return; + } + List<ProspeccaoToPrint> excelProspect = new List<ProspeccaoToPrint>(); + ProspeccoesFiltradas.AsEnumerable().ToList().ForEach(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + ProspeccaoToPrint item = new ProspeccaoToPrint + { + Nome = x.Nome, + Documento = (x.Documento ?? ""), + Nascimento = x.Nascimento, + Prefixo1 = (x.Prefixo1 ?? ""), + Telefone1 = (x.Telefone1 ?? ""), + Email = (x.Email ?? ""), + VigenciaFinal = x.VigenciaFinal, + Item = (x.Item ?? ""), + Status = x.Status, + StatusPersonalizadotoPrint = ((x.StatusPersonalizado == null) ? "" : x.StatusPersonalizado.Nome), + Tipo = (x.Tipo ?? ""), + Vendedor = (x.Vendedor.Nome ?? null), + Valor = x.Valor + }; + excelProspect.Add(item); + }); + string tempPath = Path.GetTempPath(); + string fileName = $"{tempPath}{Guid.NewGuid()}.xlsx"; + XLWorkbook val = new XLWorkbook(); + string nome = "PROSPECÇÃO"; + (await Funcoes.GerarXls(val, nome, excelProspect, new List<string>())).SaveAs(fileName); + Process.Start(fileName); + } + + public async Task CarregaProspeccao() + { + if (ProspeccoesFiltradas != null) + { + ProspeccoesFiltradas = new ObservableCollection<Prospeccao>(ProspeccoesFiltradas.ToList()); + } + } + + public async Task CarregarPermissao() + { + SelectedPermissaoUsuario = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, (TipoTela)60); + } + + public async Task<bool> BuscaPermissao(string Tipo) + { + if (Recursos.Usuario.Administrador) + { + return true; + } + if (Tipo == "Alterar" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Alterar) + { + return false; + } + if (Tipo == "Excluir" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Excluir) + { + return false; + } + if (Tipo == "Incluir" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Incluir) + { + return false; + } + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs new file mode 100644 index 0000000..03d23df --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs @@ -0,0 +1,1146 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.BI; + +public class TarefaBIViewModel : BaseTarefaViewModel +{ + private bool _enableAlterarTarefa = true; + + private bool _administrador; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddDays(-4.0); + + private DateTime _fim = Funcoes.GetNetworkTime().Date.AddDays(4.0); + + private List<string> _status = new List<string> + { + "TODAS AS TAREFAS", + ValidationHelper.GetDescription((Enum)(object)(StatusTarefa)0), + ValidationHelper.GetDescription((Enum)(object)(StatusTarefa)2) + }; + + private string _selectedStatus; + + private Visibility _isVisibleCliente = (Visibility)2; + + private Visibility _isVisibleApolice = (Visibility)2; + + private Visibility _isVisibleArquivoDigital = (Visibility)2; + + private Visibility _isVisibleSinistro = (Visibility)2; + + private ObservableCollection<Usuario> _usuariosFiltro; + + private ObservableCollection<Usuario> _usuarios; + + private ObservableCollection<TipoDeTarefa> _tiposTarefa; + + private TipoDeTarefa _selectedTipoTarefa; + + private Usuario _selectedUsuarioFiltro = new Usuario(); + + private Usuario _selectedUsuario = new Usuario(); + + private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); + + private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); + + private bool _isAnotacoes = true; + + private string _descricao = ""; + + private string _historicoInterno = ""; + + private ObservableCollection<Tarefa> _tarefas; + + private Tarefa _selectedTarefa; + + private ObservableCollection<TelefoneBase> _telefones; + + private long _cancelTarefa; + + private ObservableCollection<Tarefa> _tarefasFiltradas = new ObservableCollection<Tarefa>(); + + private string _filtro = ""; + + private ObservableCollection<string> _filtroTarefa = new ObservableCollection<string>(); + + private GridLength _columnUsuarioPrincipal = new GridLength(1.0, (GridUnitType)2); + + private GridLength _columnUsuarios = new GridLength(0.0, (GridUnitType)1); + + private new TarefaServico Servico { get; } + + private ClienteServico ClienteServico { get; } + + public override bool EnableAlterarTarefa + { + get + { + return _enableAlterarTarefa; + } + set + { + _enableAlterarTarefa = _alterarPermissEnabled && value; + OnPropertyChanged("EnableAlterarTarefa"); + } + } + + public bool Administrador + { + get + { + return _administrador; + } + set + { + _administrador = value; + OnPropertyChanged("Administrador"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + CarregaTarefas(); + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + CarregaTarefas(); + OnPropertyChanged("Fim"); + } + } + + public List<string> Status + { + get + { + return _status; + } + set + { + _status = value; + CarregaTarefas(); + OnPropertyChanged("Status"); + } + } + + public string SelectedStatus + { + get + { + return _selectedStatus; + } + set + { + _selectedStatus = value; + CarregaTarefas(); + OnPropertyChanged("SelectedStatus"); + } + } + + public Visibility IsVisibleCliente + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleCliente; + } + 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) + _isVisibleCliente = value; + OnPropertyChanged("IsVisibleCliente"); + } + } + + public Visibility IsVisibleApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleApolice; + } + 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) + _isVisibleApolice = value; + OnPropertyChanged("IsVisibleApolice"); + } + } + + public Visibility IsVisibleArquivoDigital + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleArquivoDigital; + } + 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) + _isVisibleArquivoDigital = value; + OnPropertyChanged("IsVisibleArquivoDigital"); + } + } + + public Visibility IsVisibleSinistro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleSinistro; + } + 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) + _isVisibleSinistro = value; + OnPropertyChanged("IsVisibleSinistro"); + } + } + + public ObservableCollection<Usuario> UsuariosFiltro + { + get + { + return _usuariosFiltro; + } + set + { + _usuariosFiltro = value; + OnPropertyChanged("UsuariosFiltro"); + } + } + + public ObservableCollection<Usuario> Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection<TipoDeTarefa> TiposTarefa + { + get + { + return _tiposTarefa; + } + set + { + _tiposTarefa = value; + OnPropertyChanged("TiposTarefa"); + } + } + + public TipoDeTarefa SelectedTipoTarefa + { + get + { + return _selectedTipoTarefa; + } + set + { + _selectedTipoTarefa = value; + OnPropertyChanged("SelectedTipoTarefa"); + } + } + + public Usuario SelectedUsuarioFiltro + { + get + { + return _selectedUsuarioFiltro; + } + set + { + _selectedUsuarioFiltro = value; + CarregaTarefas(); + OnPropertyChanged("SelectedUsuarioFiltro"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedTarefa.Agendamento:T}"); + } + OnPropertyChanged("DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{SelectedTarefa.Agendamento:d} {value:T}"); + } + OnPropertyChanged("HoraAgendamento"); + } + } + + public bool IsAnotacoes + { + get + { + return _isAnotacoes; + } + set + { + _isAnotacoes = value; + OnPropertyChanged("IsAnotacoes"); + } + } + + public string Descricao + { + get + { + return _descricao; + } + set + { + _descricao = value; + OnPropertyChanged("Descricao"); + } + } + + public string HistoricoInterno + { + get + { + return _historicoInterno; + } + set + { + _historicoInterno = value; + OnPropertyChanged("HistoricoInterno"); + } + } + + public ObservableCollection<Tarefa> Tarefas + { + get + { + return _tarefas; + } + set + { + _tarefas = value; + OnPropertyChanged("Tarefas"); + } + } + + public override Tarefa SelectedTarefa + { + get + { + return _selectedTarefa; + } + set + { + _cancelTarefa = ((value != null) ? ((DomainBase)value).Id : 0); + WorkOnSelectedTarefa(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + _selectedTarefa = value; + ValidaPermissaoParaEditarTarefa(); + OnPropertyChanged("SelectedTarefa"); + } + } + + public ObservableCollection<TelefoneBase> Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection<Tarefa> TarefasFiltradas + { + get + { + return _tarefasFiltradas; + } + set + { + _tarefasFiltradas = value; + base.IsVisible = (Visibility)((value.Count <= 0) ? 2 : 0); + OnPropertyChanged("TarefasFiltradas"); + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public ObservableCollection<string> FiltroTarefa + { + get + { + return _filtroTarefa; + } + set + { + _filtroTarefa = value; + OnPropertyChanged("FiltroTarefa"); + } + } + + public GridLength ColumnUsuarioPrincipal + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _columnUsuarioPrincipal; + } + 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) + _columnUsuarioPrincipal = value; + OnPropertyChanged("ColumnUsuarioPrincipal"); + } + } + + public GridLength ColumnUsuarios + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _columnUsuarios; + } + 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) + _columnUsuarios = value; + OnPropertyChanged("ColumnUsuarios"); + } + } + + public TarefaBIViewModel() + { + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Unknown result type (might be due to invalid IL or missing references) + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Unknown result type (might be due to invalid IL or missing references) + //IL_01dd: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected O, but got Unknown + Servico = new TarefaServico(); + ClienteServico = new ClienteServico(); + Administrador = ((DomainBase)Recursos.Usuario).Id == 0L || Recursos.Usuario.Administrador; + CarregarUsuarios(); + List<Usuario> list = (from x in Recursos.Usuarios + where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList(); + list.Insert(0, new Usuario + { + Nome = "TODOS OS USUÁRIOS", + Id = 0L + }); + UsuariosFiltro = new ObservableCollection<Usuario>(list); + TiposTarefa = new ObservableCollection<TipoDeTarefa>(Recursos.TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + SelectedUsuarioFiltro = ((IEnumerable<Usuario>)UsuariosFiltro).FirstOrDefault((Func<Usuario, bool>)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)) ?? UsuariosFiltro.FirstOrDefault(); + SelectedStatus = Status[1]; + CarregaTarefas(permissoes: true); + } + + public async void CarregaTarefas(bool permissoes = false) + { + if (permissoes) + { + await PermissaoTela((TipoTela)38); + Alterar(alterar: false); + } + await CarregarTarefas(); + } + + public async Task CarregarTarefas() + { + ColumnUsuarioPrincipal = new GridLength(1.0, (GridUnitType)2); + ColumnUsuarios = new GridLength(0.0, (GridUnitType)1); + Filtro = string.Empty; + TarefaServico servico = Servico; + Usuario selectedUsuarioFiltro = SelectedUsuarioFiltro; + Tarefas = new ObservableCollection<Tarefa>(from x in await servico.BuscarTarefas((selectedUsuarioFiltro != null) ? ((DomainBase)selectedUsuarioFiltro).Id : 0, Inicio, Fim, (SelectedStatus == "TODAS AS TAREFAS") ? null : new bool?(SelectedStatus != "PENDENTE")) + where (int)x.Entidade != 1 + orderby x.Agendamento + select x); + TarefasFiltradas = Tarefas; + SelectedTarefa = TarefasFiltradas.FirstOrDefault(); + if (FiltroTarefa.Count > 0) + { + FiltrarTarefa(); + } + } + + private async void WorkOnSelectedTarefa(Tarefa value) + { + if (value == null) + { + base.Responsaveis = new ObservableCollection<ResponsavelTarefa>(); + return; + } + SelectedUsuario = ((value.Usuario != null) ? ((IEnumerable<Usuario>)Usuarios).FirstOrDefault((Func<Usuario, bool>)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)value.Usuario).Id)) : null); + DataAgendamento = value.Agendamento; + HoraAgendamento = value.Agendamento; + Descricao = value.Descricao; + HistoricoInterno = value.DescricaoInterna; + base.Responsaveis = ((value == null) ? new ObservableCollection<ResponsavelTarefa>() : ((value.Responsaveis == null) ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>(value.Responsaveis))); + if (!base.Responsaveis.Any()) + { + TarefaBIViewModel tarefaBIViewModel = this; + Tarefa obj = value; + tarefaBIViewModel.Responsaveis = ((((obj != null) ? obj.Usuario : null) == null) ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>((IEnumerable<ResponsavelTarefa>)(object)new ResponsavelTarefa[1] + { + new ResponsavelTarefa + { + Usuario = value.Usuario + } + })); + } + if (value.TipoDeTarefa != null) + { + if (TiposTarefa.All((TipoDeTarefa x) => ((DomainBase)x).Id != ((DomainBase)value).Id) && !value.TipoDeTarefa.Ativo) + { + TiposTarefa.Add(value.TipoDeTarefa); + } + else + { + TiposTarefa = new ObservableCollection<TipoDeTarefa>(TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + } + } + SelectedTipoTarefa = value.TipoDeTarefa; + IsVisibleCliente = (Visibility)2; + IsVisibleApolice = (Visibility)2; + IsVisibleSinistro = (Visibility)2; + IsVisibleArquivoDigital = (Visibility)2; + TipoTarefa entidade = value.Entidade; + switch ((int)entidade) + { + case 2: + IsVisibleCliente = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + case 0: + case 3: + IsVisibleCliente = (Visibility)0; + IsVisibleApolice = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + case 4: + IsVisibleCliente = (Visibility)0; + IsVisibleApolice = (Visibility)0; + IsVisibleSinistro = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + } + entidade = value.Entidade; + if ((int)entidade != 5) + { + if ((int)entidade != 8) + { + Telefones = new ObservableCollection<TelefoneBase>((await ClienteServico.BuscarTelefonesAsync(value.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func<ClienteTelefone, TelefoneBase>)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList()); + } + else + { + Telefones = new ObservableCollection<TelefoneBase>(); + } + return; + } + Prospeccao val = await new ProspeccaoServico().BuscarProspeccao(value.IdEntidade); + Telefones = new ObservableCollection<TelefoneBase>(); + if (val != null && val.Telefone1 != null) + { + Telefones.Add(new TelefoneBase + { + Tipo = (TipoTelefone)(val.Telefone1.StartsWith("9") ? 3 : 7), + Numero = val.Telefone1, + Prefixo = val.Prefixo1 + }); + } + if (val != null && val.Telefone2 != null) + { + Telefones.Add(new TelefoneBase + { + Tipo = (TipoTelefone)(val.Telefone2.StartsWith("9") ? 3 : 7), + Numero = val.Telefone2, + Prefixo = val.Prefixo2 + }); + } + } + + public async void Abrir(TipoTarefa tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + switch ((int)tipo) + { + case 2: + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(await CarregaCliente(SelectedTarefa.IdCliente), lockInsert: true), "CADASTRO DE CLIENTES - " + SelectedTarefa.Cliente)).Show(); + break; + case 3: + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await CarregaApoliceParcela(SelectedTarefa.IdEntidade), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + SelectedTarefa.Cliente + " - " + SelectedTarefa.Referencia)).Show(); + break; + case 0: + { + long num = SelectedTarefa.IdEntidade; + if ((int)SelectedTarefa.Entidade == 4) + { + Sinistro obj = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + long? obj2; + if (obj == null) + { + obj2 = null; + } + else + { + ControleSinistro controleSinistro = obj.ControleSinistro; + if (controleSinistro == null) + { + obj2 = null; + } + else + { + Item item = controleSinistro.Item; + if (item == null) + { + obj2 = null; + } + else + { + Documento documento = item.Documento; + obj2 = ((documento != null) ? new long?(((DomainBase)documento).Id) : null); + } + } + } + long? num2 = obj2; + num = num2.GetValueOrDefault(); + } + if (num != 0L) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await CarregaApolice(num), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + SelectedTarefa.Cliente)).Show(); + } + break; + } + case 4: + { + Sinistro val = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + if (val == null) + { + await ShowMessage("SINISTRO NÃO ENCONTRADO!"); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(val.ControleSinistro.Item, attached: false), "CADASTRO DE SINISTROS - " + SelectedTarefa.Cliente + " - " + SelectedTarefa.Referencia)).Show(); + } + break; + } + case 1: + break; + } + } + + public async Task<MalaDireta> CriarMalaDireta(TipoTarefa tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + switch ((int)tipo) + { + case 8: + return null; + case 2: + { + Cliente cliente = await CarregaCliente(SelectedTarefa.IdCliente); + return new MalaDireta + { + Cliente = cliente, + Tela = (TipoTela)1 + }; + } + case 3: + { + Documento val3 = await CarregaApoliceParcela(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val3.Controle.Cliente, + Apolice = val3, + Tela = (TipoTela)5 + }; + } + case 0: + { + Documento val2 = await CarregaApolice(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val2.Controle.Cliente, + Apolice = val2, + Tela = (TipoTela)2 + }; + } + case 4: + { + Sinistro val = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val.ControleSinistro.Item.Documento.Controle.Cliente, + Apolice = val.ControleSinistro.Item.Documento, + Sinistro = val, + Tela = (TipoTela)7 + }; + } + case 5: + { + Prospeccao prospeccao = await CarregarProspeccao(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Prospeccao = prospeccao, + Tela = (TipoTela)33 + }; + } + default: + return null; + } + } + + public async Task<List<KeyValuePair<string, string>>> Salvar(string titulo) + { + if (SelectedTarefa == null) + { + return null; + } + DateTime networkTime = Funcoes.GetNetworkTime(); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 45) && (int)SelectedTarefa.Status != 2 && SelectedTarefa.Agendamento < networkTime) + { + SelectedTarefa.Agendamento = networkTime; + } + if ((int)SelectedTarefa.Status == 2) + { + SelectedTarefa.Conclusao = networkTime; + } + SelectedTarefa.Responsaveis = base.Responsaveis.ToList(); + Tarefa selectedTarefa = SelectedTarefa; + ResponsavelTarefa? obj = base.Responsaveis.FirstOrDefault(); + selectedTarefa.Usuario = ((obj != null) ? obj.Usuario : null); + SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list = SelectedTarefa.Validate(); + string text = Funcoes.GetText(SelectedTarefa.Anotacoes); + string text2 = Funcoes.GetText(SelectedTarefa.AnotacoesInternas); + if (string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text2)) + { + list.Add(new KeyValuePair<string, string>("Anotações", "OBRIGATÓRIO")); + } + if (list.Count > 0) + { + return list; + } + SelectedTarefa.Anotacoes = Funcoes.AdicionarLog(SelectedTarefa.Anotacoes); + SelectedTarefa.Descricao = SelectedTarefa.Anotacoes + " <p> " + Descricao + " </p>"; + SelectedTarefa.DescricaoInterna = (string.IsNullOrWhiteSpace(SelectedTarefa.AnotacoesInternas) ? HistoricoInterno : (SelectedTarefa.AnotacoesInternas + " <p> " + HistoricoInterno + " </p>")); + SelectedTarefa.TipoDeTarefa = SelectedTipoTarefa; + SelectedTarefa.Titulo = titulo; + SelectedTarefa = await Servico.Salvar(SelectedTarefa); + if (!Servico.Sucesso) + { + return null; + } + long id = ((DomainBase)SelectedTarefa).Id; + await CarregarTarefas(); + SelectedTarefa = ((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == id)) ?? TarefasFiltradas.FirstOrDefault(); + return null; + } + + public async Task Cancelar() + { + if (_cancelTarefa != 0L) + { + long id = _cancelTarefa; + await CarregarTarefas(); + SelectedTarefa = ((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == id)); + Alterar(alterar: false); + } + } + + public async Task Excluir() + { + Tarefa selectedTarefa = SelectedTarefa; + if (selectedTarefa != null && ((DomainBase)selectedTarefa).Id == 0) + { + return; + } + TarefaBIViewModel tarefaBIViewModel = this; + string[] obj = new string[5] { "DESEJA REALMENTE EXCLUIR A TAREFA ", null, null, null, null }; + Tarefa selectedTarefa2 = SelectedTarefa; + obj[1] = ((selectedTarefa2 != null) ? selectedTarefa2.Titulo : null); + obj[2] = "?"; + obj[3] = Environment.NewLine; + obj[4] = "ESSE PROCEDIMENTO É IRREVERSÍVEL"; + if (await tarefaBIViewModel.ShowMessage(string.Concat(obj), "SIM", "NÃO")) + { + if (!(await Servico.Excluir(((DomainBase)SelectedTarefa).Id))) + { + Alterar(alterar: false); + return; + } + await CarregarTarefas(); + Gestor.Application.Actions.Actions.AtualizaTrilhas?.Invoke(); + Alterar(alterar: false); + } + } + + public async Task<Tarefa> ConcluirTarefa(Tarefa tarefa) + { + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EDITAR ESSA TAREFA!"); + return null; + } + return await Servico.Salvar(tarefa); + } + + public void FiltrarTarefa() + { + TarefasFiltradas = new ObservableCollection<Tarefa>(Filtrar()); + SelectedTarefa = TarefasFiltradas.FirstOrDefault(); + } + + private List<Tarefa> Filtrar() + { + List<Tarefa> tarefas = Tarefas.ToList(); + FiltroTarefa.ToList().ForEach(delegate(string f) + { + tarefas = tarefas.Where((Tarefa x) => ValidationHelper.RemoveDiacritics(x.Titulo).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ValidationHelper.RemoveDiacritics(x.Cliente).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ValidationHelper.RemoveDiacritics(x.Referencia).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || x.Agendamento.ToString("d").ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ((DomainBase)x).Id.ToString().Contains(ValidationHelper.RemoveDiacritics(f)) || (x.TipoDeTarefa != null && ValidationHelper.RemoveDiacritics(x.TipoDeTarefa.Nome).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f))) || (x.Usuario != null && x.Usuario.Nome.ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)))).ToList(); + }); + return tarefas; + } + + public void AdcionarFiltro() + { + if (!string.IsNullOrEmpty(Filtro)) + { + if (FiltroTarefa == null) + { + FiltroTarefa = new ObservableCollection<string>(); + } + FiltroTarefa.Add(Filtro); + Filtro = string.Empty; + FiltrarTarefa(); + } + } + + public void ExcluirFiltro(string filtro) + { + FiltroTarefa.Remove(filtro); + FiltrarTarefa(); + } + + public async void AbrirArquivoDigital() + { + if (SelectedTarefa.IdEntidade == 0L) + { + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital(); + TipoTarefa entidade = SelectedTarefa.Entidade; + switch ((int)entidade) + { + case 8: + return; + case 2: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)1) + "."); + return; + } + Cliente val2 = await CarregaCliente(SelectedTarefa.IdCliente); + filtro.Id = ((DomainBase)val2).Id; + filtro.Tipo = (TipoArquivoDigital)1; + filtro.Parente = val2; + break; + } + case 3: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + Parcela val5 = await CarregaParcela(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val5).Id; + filtro.Tipo = (TipoArquivoDigital)3; + filtro.Parente = val5; + filtro.IdApolice = ((DomainBase)val5.Documento).Id; + break; + } + case 0: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + Documento val3 = await CarregaApolice(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val3).Id; + filtro.Tipo = (TipoArquivoDigital)2; + filtro.Parente = val3; + break; + } + case 4: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + Sinistro val4 = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val4).Id; + filtro.Tipo = (TipoArquivoDigital)5; + filtro.Parente = val4; + filtro.IdApolice = ((DomainBase)val4.ControleSinistro.Item.Documento).Id; + break; + } + case 5: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)11).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)11) + "."); + return; + } + Prospeccao val = await CarregarProspeccao(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val).Id; + filtro.Tipo = (TipoArquivoDigital)11; + filtro.Parente = val; + break; + } + } + ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + public async Task AlterarTarefa() + { + if (SelectedTarefa == null) + { + return; + } + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!"); + return; + } + CarregarUsuarios(); + Alterar(alterar: true); + ColumnUsuarioPrincipal = (base.EnableFields ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + ColumnUsuarios = (base.EnableFields ? new GridLength(1.0, (GridUnitType)2) : new GridLength(0.0, (GridUnitType)1)); + ListaUsuariosResponsaveis(); + base.HasResponsaveis = true; + SelectedUsuario = null; + base.Responsaveis.ToList().ForEach(delegate(ResponsavelTarefa x) + { + Usuarios.Remove(((IEnumerable<Usuario>)Usuarios).FirstOrDefault((Func<Usuario, bool>)((Usuario u) => ((DomainBase)u).Id == ((DomainBase)x.Usuario).Id))); + }); + } + + private void CarregarUsuarios() + { + Usuarios = new ObservableCollection<Usuario>((from x in Recursos.Usuarios + where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + } + + public async Task AdcionarResponsavel() + { + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!"); + } + else if (SelectedUsuario != null) + { + base.Responsaveis.Add(new ResponsavelTarefa + { + Usuario = SelectedUsuario, + IdTarefa = ((DomainBase)SelectedTarefa).Id + }); + Usuarios.Remove(SelectedUsuario); + SelectedUsuario = null; + } + } + + public void Print() + { + string value = GerarHtml(); + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{(object)(TipoTela)38}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public string GerarHtml() + { + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + string text = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=yes'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title> TAREFA </title></head><body bgcolor='#FFFFFF'><div align='center'>"; + text += "<br>"; + text += "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>"; + text += "TAREFA</h4></td></table><br>"; + text += "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 4pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>"; + int num = 0; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + SelectedTarefa.Cliente + "</p></td></tr>"; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>REFERÊNCIA: </b>" + SelectedTarefa.Referencia + "</p></td></tr>"; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>TÍTULO: </b>" + SelectedTarefa.Titulo + "</p></td></tr>"; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>AGENDAMENTO: </b>" + SelectedTarefa.Agendamento.ToString() + "</p></td></tr>"; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RESPONSÁVEL PRINCIPAL: </b>" + SelectedTarefa.Usuario.Nome + "</p></td></tr>"; + text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>STATUS: </b>" + ValidationHelper.GetDescription((Enum)(object)SelectedTarefa.Status) + "</p></td></tr>"; + string[] obj = new string[6] + { + text, + "<tr><td width='333' bgcolor='", + (num % 2 == 0) ? "WhiteSmoke" : "White", + "'><p align='left'><b>TIPO DE TAREFA: </b>", + null, + null + }; + TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa; + obj[4] = ((selectedTipoTarefa != null) ? selectedTipoTarefa.Nome : null); + obj[5] = "</p></td></tr>"; + text = string.Concat(obj); + text += "</font></table>"; + if (base.Responsaveis != null && base.Responsaveis.Count > 0) + { + text += "<h2>RESPONSÁVEIS VINCULADOS</h2>"; + text += "<br>"; + text += "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>"; + List<string> list = new List<string>(); + foreach (ResponsavelTarefa responsavei in base.Responsaveis) + { + list.Add(responsavei.Usuario.Nome.Trim().ToUpper()); + } + text = text + "<tr><td width='333'><p align='left'>" + string.Join(", ", list) + "</p></td></tr>"; + text += "</font></table>"; + text += "<br><br>"; + } + text += "<br><br>"; + if (SelectedTarefa.Descricao != null) + { + text += "<h2>ANOTAÇÕES</h2>"; + text += "<br>"; + text += "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>"; + text = text + "<tr><td width='333'><p align='left'>" + SelectedTarefa.Descricao.Replace("<BODY>", "").Replace("</BODY>", "") + "</p></td></tr>"; + text += "</font></table>"; + text += "<br><br>"; + } + return text + "</div></body>"; + } +} |