summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Financeiro
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/ViewModels/Financeiro
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/ViewModels/Financeiro')
-rw-r--r--Gestor.Application/ViewModels/Financeiro/BancosContasViewModel.cs604
-rw-r--r--Gestor.Application/ViewModels/Financeiro/CentroDeCustoViewmodel.cs255
-rw-r--r--Gestor.Application/ViewModels/Financeiro/ContasDialogModel.cs48
-rw-r--r--Gestor.Application/ViewModels/Financeiro/CopiarClienteViewModel.cs28
-rw-r--r--Gestor.Application/ViewModels/Financeiro/ExtratoContaViewModel.cs552
-rw-r--r--Gestor.Application/ViewModels/Financeiro/FinanceiroViewModel.cs5973
-rw-r--r--Gestor.Application/ViewModels/Financeiro/FornecedorViewModel.cs780
-rw-r--r--Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs81
-rw-r--r--Gestor.Application/ViewModels/Financeiro/MenuFinanceiroViewModel.cs30
-rw-r--r--Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs147
-rw-r--r--Gestor.Application/ViewModels/Financeiro/PlanosViewModel.cs330
-rw-r--r--Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs2746
-rw-r--r--Gestor.Application/ViewModels/Financeiro/TranferenciaViewModel.cs99
13 files changed, 0 insertions, 11673 deletions
diff --git a/Gestor.Application/ViewModels/Financeiro/BancosContasViewModel.cs b/Gestor.Application/ViewModels/Financeiro/BancosContasViewModel.cs
deleted file mode 100644
index e83a4eb..0000000
--- a/Gestor.Application/ViewModels/Financeiro/BancosContasViewModel.cs
+++ /dev/null
@@ -1,604 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using Gestor.Model.Helper;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows.Media;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class BancosContasViewModel : BaseFinanceiroViewModel
- {
- private readonly BancosContasServico _bancosContasServico;
-
- public Gestor.Model.Domain.Financeiro.BancosContas CancelBancosContas;
-
- private long _ultimoId;
-
- private Gestor.Model.Domain.Financeiro.BancosContas _selectedBancosContas;
-
- private SolidColorBrush _corDoSaldo = new SolidColorBrush(Colors.Green);
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> _bancosContasFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>();
-
- private bool _isExpanded;
-
- private ObservableCollection<Saldo> _saldos = new ObservableCollection<Saldo>();
-
- private bool _habilitarFecharSaldo;
-
- private Saldo _selectedSaldo = new Saldo();
-
- private string _saldoAtual;
-
- private decimal? _valorAbertura;
-
- private DateTime? _dataAbertura;
-
- private bool _incluindo;
-
- public List<Gestor.Model.Domain.Financeiro.BancosContas> BancosContas
- {
- get;
- set;
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> BancosContasFiltrados
- {
- get
- {
- return this._bancosContasFiltrados;
- }
- set
- {
- this._bancosContasFiltrados = value;
- this.IsExpanded = (value != null ? value.Count > 0 : false);
- base.OnPropertyChanged("BancosContasFiltrados");
- }
- }
-
- public SolidColorBrush CorDoSaldo
- {
- get
- {
- return this._corDoSaldo;
- }
- set
- {
- this._corDoSaldo = value;
- base.OnPropertyChanged("CorDoSaldo");
- }
- }
-
- public DateTime? DataAbertura
- {
- get
- {
- return this._dataAbertura;
- }
- set
- {
- this._dataAbertura = value;
- base.OnPropertyChanged("DataAbertura");
- }
- }
-
- public bool HabilitarFecharSaldo
- {
- get
- {
- return this._habilitarFecharSaldo;
- }
- set
- {
- this._habilitarFecharSaldo = value;
- base.OnPropertyChanged("HabilitarFecharSaldo");
- }
- }
-
- public bool Incluindo
- {
- get
- {
- return this._incluindo;
- }
- set
- {
- this._incluindo = value;
- base.OnPropertyChanged("Incluindo");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public string SaldoAtual
- {
- get
- {
- return this._saldoAtual;
- }
- set
- {
- this._saldoAtual = value;
- base.OnPropertyChanged("SaldoAtual");
- }
- }
-
- public ObservableCollection<Saldo> Saldos
- {
- get
- {
- return this._saldos;
- }
- set
- {
- this._saldos = value;
- if (value != null && value.Count > 0)
- {
- this.SelectedSaldo = value.FirstOrDefault<Saldo>((Saldo x) => !x.get_DataFinal().HasValue);
- if (this.SelectedSaldo == null)
- {
- this.UltimoSladoNaoAberto();
- }
- }
- base.OnPropertyChanged("Saldos");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.BancosContas SelectedBancosContas
- {
- get
- {
- return this._selectedBancosContas;
- }
- set
- {
- long? nullable;
- this._selectedBancosContas = value;
- this.CarregarSaldos(value);
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- this.Incluindo = (value == null ? false : value.get_Id() == (long)0);
- base.OnPropertyChanged("SelectedBancosContas");
- }
- }
-
- public Saldo SelectedSaldo
- {
- get
- {
- return this._selectedSaldo;
- }
- set
- {
- bool id;
- this._selectedSaldo = value;
- if (value == null || value.get_DataFinal().HasValue)
- {
- id = false;
- }
- else
- {
- Usuario usuario = Recursos.Usuario;
- if (usuario != null)
- {
- id = usuario.get_Id() > (long)0;
- }
- else
- {
- id = false;
- }
- }
- this.HabilitarFecharSaldo = id;
- base.OnPropertyChanged("SelectedSaldo");
- Saldo selectedSaldo = this.SelectedSaldo;
- if (selectedSaldo == null)
- {
- return;
- }
- selectedSaldo.Initialize();
- }
- }
-
- public decimal? ValorAbertura
- {
- get
- {
- return this._valorAbertura;
- }
- set
- {
- this._valorAbertura = value;
- base.OnPropertyChanged("ValorAbertura");
- }
- }
-
- public BancosContasViewModel()
- {
- this._bancosContasServico = new BancosContasServico();
- this.Seleciona();
- }
-
- public async Task<decimal> CalcularValor()
- {
- decimal? valorFinal = await this._bancosContasServico.FecharSaldo(this.SelectedSaldo).get_ValorFinal();
- return valorFinal.GetValueOrDefault();
- }
-
- public async void CancelarAlteracao()
- {
- base.Loading(true);
- if (this.SelectedBancosContas.get_Id() > (long)0)
- {
- await this.SelecionaBancosDeContas();
- }
- BancosContasViewModel bancosContasViewModel = this;
- Gestor.Model.Domain.Financeiro.BancosContas bancosConta = this.BancosContasFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.BancosContas>((Gestor.Model.Domain.Financeiro.BancosContas x) => x.get_Id() == this._ultimoId);
- if (bancosConta == null)
- {
- bancosConta = this.BancosContasFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.BancosContas>();
- }
- bancosContasViewModel.SelecionaBancosContas(bancosConta);
- base.Alterar(false);
- base.Loading(false);
- }
-
- public async void CarregarSaldos(Gestor.Model.Domain.Financeiro.BancosContas banco)
- {
- if (banco != null && banco.get_Id() != 0)
- {
- List<Saldo> saldos = await this._bancosContasServico.BuscarSaldos(banco.get_Id());
- this.CorDoSaldo = new SolidColorBrush(Colors.Green);
- this.SaldoAtual = string.Empty;
- BancosContasViewModel observableCollection = this;
- List<Saldo> saldos1 = saldos;
- observableCollection.Saldos = new ObservableCollection<Saldo>(
- from x in saldos1
- orderby x.get_DataInicio() descending
- select x);
- if (this.Saldos.FirstOrDefault<Saldo>() != null)
- {
- Saldo saldo = new Saldo();
- saldo.set_Conta(this.Saldos.First<Saldo>().get_Conta());
- saldo.set_ValorInicio(this.Saldos.First<Saldo>().get_ValorInicio());
- saldo.set_DataInicio(this.Saldos.First<Saldo>().get_DataInicio());
- saldo.set_DataFinal(new DateTime?(Funcoes.GetNetworkTime()));
- Saldo saldo1 = saldo;
- saldo1 = await this._bancosContasServico.FecharSaldo(saldo1);
- decimal? valorFinal = saldo1.get_ValorFinal();
- decimal num = new decimal();
- if ((valorFinal.GetValueOrDefault() < num) & valorFinal.HasValue)
- {
- this.CorDoSaldo = new SolidColorBrush(Colors.Red);
- }
- valorFinal = saldo1.get_ValorFinal();
- this.SaldoAtual = string.Format("SALDO: {0:c}", Math.Round(valorFinal.GetValueOrDefault(), 2));
- }
- }
- }
-
- public async void Excluir()
- {
- if (this.SelectedBancosContas != null && this.SelectedBancosContas.get_Id() != 0)
- {
- if (await (new BaseServico()).BancosContasUtilizado(this.SelectedBancosContas.get_Id()))
- {
- await base.ShowMessage("NÃO PODE SER EXCLUÍDO POIS ESTÁ SENDO UTILIZADO EM UM LANÇAMENTO.", "OK", "", false);
- }
- else if (await base.ShowMessage(string.Concat("DESEJA REALMENTE EXCLUIR A CONTA ", this.SelectedBancosContas.get_Descricao(), " PERMANENTEMENTE?"), "SIM", "NÃO", false))
- {
- base.Loading(true);
- if (await this._bancosContasServico.Delete(this.SelectedBancosContas))
- {
- await this.SelecionaBancosDeContas();
- base.Loading(false);
- base.ToggleSnackBar("CONTA EXCLUÍDA COM SUCESSO", true);
- }
- else
- {
- base.Loading(false);
- }
- }
- }
- }
-
- public async void ExcluirSaldo()
- {
- if (this.SelectedSaldo != null && this.SelectedSaldo.get_Id() != 0)
- {
- if (this.Saldos.Count <= 1)
- {
- await base.ShowMessage("NÃO É POSSÍVEL EXCLUIR O SALDO INICIAL DA CONTA.", "OK", "", false);
- }
- else if (await base.ShowMessage("DESEJA REALMENTE EXCLUIR O SALDO PERMANENTEMENTE?", "SIM", "NÃO", false))
- {
- base.Loading(true);
- Saldo saldo = this.Saldos.FirstOrDefault<Saldo>((Saldo x) => {
- DateTime? dataFinal = x.get_DataFinal();
- DateTime? dataInicio = this.SelectedSaldo.get_DataInicio();
- if (dataFinal.HasValue != dataInicio.HasValue)
- {
- return false;
- }
- if (!dataFinal.HasValue)
- {
- return true;
- }
- return dataFinal.GetValueOrDefault() == dataInicio.GetValueOrDefault();
- });
- if (saldo != null)
- {
- saldo.set_DataFinal(null);
- saldo.set_ValorFinal(null);
- await this._bancosContasServico.Save(saldo);
- if (!this._bancosContasServico.Sucesso)
- {
- base.Loading(false);
- }
- else if (await this._bancosContasServico.DeleteSaldo(this.SelectedSaldo))
- {
- this.CarregarSaldos(this.SelectedBancosContas);
- base.Loading(false);
- base.ToggleSnackBar("SALDO EXCLUÍDO COM SUCESSO", true);
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- base.Loading(false);
- await base.ShowMessage("NÃO É POSSÍVEL EXCLUIR O SALDO DA CONTA.", "OK", "", false);
- }
- }
- }
- }
-
- public async Task FecharSaldo()
- {
- this.SelectedSaldo = await this._bancosContasServico.Save(this.SelectedSaldo);
- if (this._bancosContasServico.Sucesso)
- {
- DateTime? dataFinal = this.SelectedSaldo.get_DataFinal();
- if (dataFinal.HasValue)
- {
- decimal? valorFinal = this.SelectedSaldo.get_ValorFinal();
- if (valorFinal.HasValue)
- {
- Saldo saldo = new Saldo();
- saldo.set_Conta(this.SelectedSaldo.get_Conta());
- dataFinal = null;
- saldo.set_DataFinal(dataFinal);
- dataFinal = this.SelectedSaldo.get_DataFinal();
- saldo.set_DataInicio(new DateTime?(dataFinal.Value));
- valorFinal = null;
- saldo.set_ValorFinal(valorFinal);
- valorFinal = this.SelectedSaldo.get_ValorFinal();
- saldo.set_ValorInicio(valorFinal.Value);
- await this._bancosContasServico.Save(saldo);
- if (!this._bancosContasServico.Sucesso)
- {
- return;
- }
- }
- }
- this.CarregarSaldos(this.SelectedBancosContas);
- base.ToggleSnackBar("SALDO FECHADO COM SUCESSO", true);
- }
- }
-
- internal async Task<List<Gestor.Model.Domain.Financeiro.BancosContas>> Filtrar(string value)
- {
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas = await Task.Run<List<Gestor.Model.Domain.Financeiro.BancosContas>>(() => this.FiltrarBancosContas(value));
- return bancosContas;
- }
-
- public List<Gestor.Model.Domain.Financeiro.BancosContas> FiltrarBancosContas(string filter)
- {
- this.BancosContasFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>(this.BancosContas) : new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>(
- from x in this.BancosContas
- where Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Descricao().Trim()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(filter))
- orderby x.get_Ativo() descending, x.get_Descricao()
- select x));
- return this.BancosContasFiltrados.ToList<Gestor.Model.Domain.Financeiro.BancosContas>();
- }
-
- public void Incluir()
- {
- this._ultimoId = this.SelectedBancosContas.get_Id();
- this.DataAbertura = null;
- this.ValorAbertura = new decimal?(new decimal());
- this.SaldoAtual = "";
- Gestor.Model.Domain.Financeiro.BancosContas bancosConta = new Gestor.Model.Domain.Financeiro.BancosContas();
- bancosConta.set_Ativo(true);
- this.SelectedBancosContas = bancosConta;
- this.Saldos = new ObservableCollection<Saldo>();
- this.SelectedSaldo = null;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- Gestor.Model.Domain.Financeiro.BancosContas bancosConta;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedBancosContas.Validate();
- keyValuePairs1.AddRange(this.Validate());
- if (keyValuePairs1.Count <= 0)
- {
- bancosConta = await this._bancosContasServico.Save(this.SelectedBancosContas);
- if (this._bancosContasServico.Sucesso)
- {
- if (this.SelectedBancosContas.get_Id() == 0 && this.DataAbertura.HasValue && this.ValorAbertura.HasValue)
- {
- Saldo saldo = new Saldo();
- saldo.set_Conta(bancosConta);
- saldo.set_DataInicio(new DateTime?(this.DataAbertura.Value));
- saldo.set_ValorInicio(this.ValorAbertura.Value);
- await this._bancosContasServico.Save(saldo);
- if (!this._bancosContasServico.Sucesso)
- {
- keyValuePairs = null;
- bancosConta = null;
- return keyValuePairs;
- }
- }
- await this.SelecionaBancosDeContas();
- this.SelecionaBancosContas(bancosConta);
- Recursos.BancosContas = this.BancosContas;
- base.Alterar(false);
- base.ToggleSnackBar("CONTA SALVA COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- bancosConta = null;
- return keyValuePairs;
- }
-
- private async void Seleciona()
- {
- base.Loading(true);
- await base.PermissaoTela(26);
- await this.SelecionaBancosDeContas();
- base.Loading(false);
- }
-
- public void SelecionaBancosContas(Gestor.Model.Domain.Financeiro.BancosContas bancosContas)
- {
- base.Loading(true);
- this.SelectedBancosContas = this.BancosContasFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.BancosContas>((Gestor.Model.Domain.Financeiro.BancosContas x) => x.get_Id() == bancosContas.get_Id());
- base.Loading(false);
- }
-
- private async Task SelecionaBancosDeContas()
- {
- base.Loading(true);
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas = await this._bancosContasServico.BuscarBancos();
- BancosContasViewModel list = this;
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas1 = bancosContas;
- IOrderedEnumerable<Gestor.Model.Domain.Financeiro.BancosContas> ativo =
- from x in bancosContas1
- orderby x.get_Ativo() descending
- select x;
- list.BancosContas = ativo.ThenBy<Gestor.Model.Domain.Financeiro.BancosContas, string>((Gestor.Model.Domain.Financeiro.BancosContas x) => x.get_Descricao()).ToList<Gestor.Model.Domain.Financeiro.BancosContas>();
- this.BancosContasFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>(this.BancosContas);
- if (this.BancosContasFiltrados.Count <= 0)
- {
- this.SelectedBancosContas = new Gestor.Model.Domain.Financeiro.BancosContas();
- this.Saldos = new ObservableCollection<Saldo>();
- this.DataAbertura = null;
- this.ValorAbertura = new decimal?(new decimal());
- this.SaldoAtual = "";
- base.Alterar(false);
- base.EnableMenu = false;
- }
- else
- {
- this.SelecionaBancosContas(this.BancosContasFiltrados.First<Gestor.Model.Domain.Financeiro.BancosContas>());
- }
- Recursos.BancosContas = bancosContas;
- base.Loading(false);
- }
-
- private async void UltimoSladoNaoAberto()
- {
- Saldo saldo = this.Saldos.ToList<Saldo>().Find((Saldo x) => {
- DateTime? dataInicio = x.get_DataInicio();
- DateTime? nullable = this.Saldos.Max<Saldo, DateTime?>((Saldo r) => r.get_DataInicio());
- if (dataInicio.HasValue != nullable.HasValue)
- {
- return false;
- }
- if (!dataInicio.HasValue)
- {
- return true;
- }
- return dataInicio.GetValueOrDefault() == nullable.GetValueOrDefault();
- });
- DateTime? dataFinal = saldo.get_DataFinal();
- bool hasValue = dataFinal.HasValue;
- if (hasValue)
- {
- hasValue = await base.ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA?", "SIM", "NÃO", false);
- }
- if (hasValue)
- {
- dataFinal = null;
- saldo.set_DataFinal(dataFinal);
- saldo.set_ValorFinal(null);
- this.SelectedSaldo = await this._bancosContasServico.Save(saldo);
- this.SelectedBancosContas = this.SelectedBancosContas;
- }
- saldo = null;
- }
-
- public List<KeyValuePair<string, string>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- if (this.BancosContas.Where<Gestor.Model.Domain.Financeiro.BancosContas>((Gestor.Model.Domain.Financeiro.BancosContas x) => {
- if (x.get_Descricao() != this.SelectedBancosContas.get_Descricao())
- {
- return false;
- }
- return x.get_Id() != this.SelectedBancosContas.get_Id();
- }).Any<Gestor.Model.Domain.Financeiro.BancosContas>())
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs, "Descricao|DESCRIÇÃO", "NÃO É POSSÍVEL SALVAR MAIS DE UMA CONTA COM A MESMA DESCRIÇÃO.", true);
- }
- if (this.SelectedBancosContas.get_Id() == 0)
- {
- if (!this.DataAbertura.HasValue)
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs, "DataAbertura|ABERTURA", "É NECESSÁRIO PREENCHER A DATA DE ABERTURA DA CONTA.", true);
- }
- else if (DateTime.Compare(this.DataAbertura.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataAbertura.Value, new DateTime(9999, 12, 31)) > 0)
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs, "DataAbertura|ABERTURA", "DATA INVÁLIDA", true);
- }
- if (!this.ValorAbertura.HasValue)
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs, "ValorAbertura|VALOR", "É NECESSÁRIO PREENCHER O VALOR DE ABERTURA DA CONTA.", true);
- }
- }
- return keyValuePairs;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/CentroDeCustoViewmodel.cs b/Gestor.Application/ViewModels/Financeiro/CentroDeCustoViewmodel.cs
deleted file mode 100644
index ef57541..0000000
--- a/Gestor.Application/ViewModels/Financeiro/CentroDeCustoViewmodel.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class CentroDeCustoViewmodel : BaseFinanceiroViewModel
- {
- private readonly CentroServico _centroServico;
-
- private ObservableCollection<Centro> _centrosFiltrados = new ObservableCollection<Centro>();
-
- private bool _isExpanded;
-
- private Centro _selectedCentro;
-
- private bool _ativo;
-
- private long _ultimoId;
-
- public Centro CancelCentro;
-
- public bool Ativo
- {
- get
- {
- return this._ativo;
- }
- set
- {
- this._ativo = bool.Parse(value.ToString());
- base.OnPropertyChanged("Ativo");
- }
- }
-
- public List<Centro> Centros
- {
- get;
- set;
- }
-
- public ObservableCollection<Centro> CentrosFiltrados
- {
- get
- {
- return this._centrosFiltrados;
- }
- set
- {
- this._centrosFiltrados = value;
- this.IsExpanded = (value != null ? value.Count > 0 : false);
- base.OnPropertyChanged("CentrosFiltrados");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public Centro SelectedCentro
- {
- get
- {
- return this._selectedCentro;
- }
- set
- {
- this._selectedCentro = value;
- if (value.get_Id() > (long)0)
- {
- this._ultimoId = value.get_Id();
- }
- base.VerificarEnables(new long?(value.get_Id()));
- base.OnPropertyChanged("SelectedCentro");
- }
- }
-
- public CentroDeCustoViewmodel()
- {
- this._centroServico = new CentroServico();
- base.EnableMenu = true;
- this.Seleciona();
- }
-
- public async void CancelarAlteracao()
- {
- base.Loading(true);
- base.Alterar(false);
- if (this.SelectedCentro.get_Id() > (long)0)
- {
- await this.SelecionaCentro();
- }
- await this.SelecionaCentro(this.CentrosFiltrados.FirstOrDefault<Centro>((Centro x) => x.get_Id() == this._ultimoId));
- base.Loading(false);
- }
-
- public async Task<List<Centro>> Filtrar(string value)
- {
- List<Centro> centros = await Task.Run<List<Centro>>(() => this.FiltrarCentro(value));
- return centros;
- }
-
- public List<Centro> FiltrarCentro(string filter)
- {
- this.CentrosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Centro>(this.Centros) : new ObservableCollection<Centro>(
- from x in this.Centros
- where ValidationHelper.RemoveDiacritics(x.get_Descricao().Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))
- orderby this.Ativo descending, x.get_Descricao()
- select x));
- return this.CentrosFiltrados.ToList<Centro>();
- }
-
- public void Incluir()
- {
- long id;
- Centro selectedCentro = this.SelectedCentro;
- if (selectedCentro != null)
- {
- id = selectedCentro.get_Id();
- }
- else
- {
- id = (long)0;
- }
- this._ultimoId = id;
- Centro centro = new Centro();
- centro.set_Ativo(true);
- this.SelectedCentro = centro;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedCentro.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validate());
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedCentro = await this._centroServico.Save(this.SelectedCentro);
- if (this._centroServico.Sucesso)
- {
- await this.SelecionaCentro();
- await this.SelecionaCentro(this.CentrosFiltrados.First<Centro>((Centro x) => x.get_Id() == this.SelectedCentro.get_Id()));
- base.Alterar(false);
- base.ToggleSnackBar("CENTRO DE CUSTO SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- private async void Seleciona()
- {
- base.Loading(true);
- await base.PermissaoTela(29);
- await this.SelecionaCentro();
- await this.SelecionaCentro(this.CentrosFiltrados.FirstOrDefault<Centro>());
- base.Loading(false);
- }
-
- private async Task SelecionaCentro(Centro centros)
- {
- if (centros != null)
- {
- base.Loading(true);
- List<Centro> centros1 = await (new BaseServico()).BuscarCentroAsync();
- DomainBase.Copy<Centro, Centro>(this.CentrosFiltrados.First<Centro>((Centro x) => x.get_Id() == centros.get_Id()), centros1.First<Centro>((Centro x) => x.get_Id() == centros.get_Id()));
- this.SelectedCentro = this.CentrosFiltrados.First<Centro>((Centro x) => x.get_Id() == centros.get_Id());
- base.Loading(false);
- }
- else
- {
- base.Alterar(false);
- base.EnableMenu = false;
- base.EnableAlterar = false;
- }
- }
-
- private async Task SelecionaCentro()
- {
- List<Centro> centros = await (new BaseServico()).BuscarCentroAsync();
- CentroDeCustoViewmodel list = this;
- List<Centro> centros1 = centros;
- IOrderedEnumerable<Centro> ativo =
- from x in centros1
- orderby x.get_Ativo() descending
- select x;
- IOrderedEnumerable<Centro> centros2 = ativo.ThenBy<Centro, string>((Centro x) => x.get_Descricao());
- list.Centros = centros2.ThenBy<Centro, string>((Centro x) => x.get_Descricao()).ToList<Centro>();
- this.CentrosFiltrados = new ObservableCollection<Centro>(this.Centros);
- }
-
- public void SelecionaCentroDeCusto(Centro centro)
- {
- this.SelectedCentro = this.CentrosFiltrados.First<Centro>((Centro x) => x.get_Id() == centro.get_Id());
- }
-
- public async Task<List<KeyValuePair<string, string>>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- bool flag = true;
- List<Centro> centros = await (new BaseServico()).BuscarCentroAsync();
- if (centros.Count > 0)
- {
- centros.ForEach((Centro x) => {
- if (x.get_Id() == this.SelectedCentro.get_Id())
- {
- return;
- }
- if (x.get_Descricao() == this.SelectedCentro.get_Descricao() && x.get_IdEmpresa() == this.SelectedCentro.get_IdEmpresa())
- {
- flag = false;
- }
- });
- }
- if (!flag)
- {
- keyValuePairs.Add(new KeyValuePair<string, string>("Descricao", "UM CENTRO COM ESSE NOME JÁ EXISTE."));
- }
- List<KeyValuePair<string, string>> keyValuePairs1 = keyValuePairs;
- keyValuePairs = null;
- return keyValuePairs1;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/ContasDialogModel.cs b/Gestor.Application/ViewModels/Financeiro/ContasDialogModel.cs
deleted file mode 100644
index 8e112a4..0000000
--- a/Gestor.Application/ViewModels/Financeiro/ContasDialogModel.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Financeiro;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class ContasDialogModel : BaseViewModel
- {
- private ObservableCollection<BancosContas> _contasFiltradas;
-
- private BancosContas _conta;
-
- public BancosContas Conta
- {
- get
- {
- return this._conta;
- }
- set
- {
- this._conta = value;
- base.OnPropertyChanged("Conta");
- }
- }
-
- public ObservableCollection<BancosContas> ContasFiltradas
- {
- get
- {
- return this._contasFiltradas;
- }
- set
- {
- this._contasFiltradas = value;
- base.OnPropertyChanged("ContasFiltradas");
- }
- }
-
- public ContasDialogModel(List<BancosContas> contas)
- {
- this.ContasFiltradas = new ObservableCollection<BancosContas>(contas);
- this.Conta = this.ContasFiltradas.FirstOrDefault<BancosContas>();
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/CopiarClienteViewModel.cs b/Gestor.Application/ViewModels/Financeiro/CopiarClienteViewModel.cs
deleted file mode 100644
index 3bde895..0000000
--- a/Gestor.Application/ViewModels/Financeiro/CopiarClienteViewModel.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class CopiarClienteViewModel : BaseSegurosViewModel
- {
- private Cliente _selectedCliente;
-
- public Cliente SelectedCliente
- {
- get
- {
- return this._selectedCliente;
- }
- set
- {
- this._selectedCliente = value;
- base.OnPropertyChanged("SelectedCliente");
- }
- }
-
- public CopiarClienteViewModel()
- {
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/ExtratoContaViewModel.cs b/Gestor.Application/ViewModels/Financeiro/ExtratoContaViewModel.cs
deleted file mode 100644
index 114d175..0000000
--- a/Gestor.Application/ViewModels/Financeiro/ExtratoContaViewModel.cs
+++ /dev/null
@@ -1,552 +0,0 @@
-using ClosedXML.Excel;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Helpers;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Forms;
-using System.Windows.Media;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class ExtratoContaViewModel : BaseFinanceiroViewModel
- {
- private Geometry _maximizeRestore = Geometry.Parse((string)System.Windows.Application.Current.Resources["Restore"]);
-
- private string _head;
-
- private readonly FinanceiroServico _servico;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> _contas;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> _contasFilter;
-
- private Gestor.Model.Domain.Financeiro.BancosContas _selectedConta;
-
- private DateTime? _inicio;
-
- private DateTime? _fim;
-
- private static ObservableCollection<string> _bancosContas;
-
- private string _selectedBancosContas;
-
- private ObservableCollection<ExtratoConta> _extrato;
-
- private bool _saldoFinal;
-
- private bool _naoHaDados;
-
- public ObservableCollection<string> BancosContas
- {
- get
- {
- return ExtratoContaViewModel._bancosContas;
- }
- set
- {
- ExtratoContaViewModel._bancosContas = value;
- base.OnPropertyChanged("BancosContas");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> Contas
- {
- get
- {
- return this._contas;
- }
- set
- {
- this._contas = value;
- base.OnPropertyChanged("Contas");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas> ContasFilter
- {
- get
- {
- return this._contasFilter;
- }
- set
- {
- this._contasFilter = value;
- base.OnPropertyChanged("ContasFilter");
- }
- }
-
- public ObservableCollection<ExtratoConta> Extrato
- {
- get
- {
- return this._extrato;
- }
- set
- {
- this._extrato = value;
- this.NaoHaDados = (value == null ? true : value.Count == 0);
- base.OnPropertyChanged("Extrato");
- }
- }
-
- public DateTime? Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- base.OnPropertyChanged("Fim");
- }
- }
-
- public string Head
- {
- get
- {
- return this._head;
- }
- set
- {
- this._head = value;
- base.OnPropertyChanged("Head");
- }
- }
-
- public DateTime? Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public Geometry MaximizeRestore
- {
- get
- {
- return this._maximizeRestore;
- }
- set
- {
- this._maximizeRestore = value;
- base.OnPropertyChanged("MaximizeRestore");
- }
- }
-
- public bool NaoHaDados
- {
- get
- {
- return this._naoHaDados;
- }
- set
- {
- this._naoHaDados = value;
- base.OnPropertyChanged("NaoHaDados");
- }
- }
-
- public bool SaldoFinal
- {
- get
- {
- return this._saldoFinal;
- }
- set
- {
- this._saldoFinal = value;
- base.OnPropertyChanged("SaldoFinal");
- }
- }
-
- public string SelectedBancosContas
- {
- get
- {
- return this._selectedBancosContas;
- }
- set
- {
- this._selectedBancosContas = value;
- if (value == null || this.Contas == null || this.Contas.Count <= 0)
- {
- return;
- }
- if (value == "TODOS")
- {
- this.ContasFilter = this.Contas;
- }
- else if (value == "ATIVOS")
- {
- this.ContasFilter = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>((
- from x in this.Contas
- where x.get_Ativo()
- select x).ToList<Gestor.Model.Domain.Financeiro.BancosContas>());
- }
- else if (value == "INATIVOS")
- {
- this.ContasFilter = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>((
- from x in this.Contas
- where !x.get_Ativo()
- select x).ToList<Gestor.Model.Domain.Financeiro.BancosContas>());
- }
- base.OnPropertyChanged("SelectedBancosContas");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.BancosContas SelectedConta
- {
- get
- {
- return this._selectedConta;
- }
- set
- {
- this._selectedConta = value;
- base.OnPropertyChanged("SelectedConta");
- }
- }
-
- static ExtratoContaViewModel()
- {
- ExtratoContaViewModel._bancosContas = new ObservableCollection<string>()
- {
- "TODOS",
- "ATIVOS",
- "INATIVOS"
- };
- }
-
- public ExtratoContaViewModel(long id)
- {
- this._maximizeRestore = Geometry.Parse((string)System.Windows.Application.Current.Resources["Restore"]);
- DateTime date = Funcoes.GetNetworkTime().Date;
- int year = date.Year;
- date = Funcoes.GetNetworkTime().Date;
- this._inicio = new DateTime?(new DateTime(year, date.Month, 1));
- this._fim = new DateTime?(Funcoes.GetNetworkTime());
- this._selectedBancosContas = "TODOS";
- base();
- this._servico = new FinanceiroServico();
- this.BuscaInicial(id);
- }
-
- private async void BuscaInicial(long id)
- {
- Gestor.Model.Domain.Financeiro.BancosContas bancosConta;
- base.Loading(true);
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas = await (new BancosContasServico()).BuscarBancos();
- ExtratoContaViewModel observableCollection = this;
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas1 = bancosContas;
- observableCollection.Contas = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>(
- from x in bancosContas1
- orderby x.get_Descricao()
- select x);
- ExtratoContaViewModel extratoContaViewModel = this;
- List<Gestor.Model.Domain.Financeiro.BancosContas> bancosContas2 = bancosContas;
- extratoContaViewModel.ContasFilter = new ObservableCollection<Gestor.Model.Domain.Financeiro.BancosContas>(
- from x in bancosContas2
- orderby x.get_Descricao()
- select x);
- ExtratoContaViewModel extratoContaViewModel1 = this;
- bancosConta = (id > (long)0 ? this.Contas.FirstOrDefault<Gestor.Model.Domain.Financeiro.BancosContas>((Gestor.Model.Domain.Financeiro.BancosContas x) => x.get_Id() == id) : this.Contas.FirstOrDefault<Gestor.Model.Domain.Financeiro.BancosContas>());
- extratoContaViewModel1.SelectedConta = bancosConta;
- await this.GerarRelatorio();
- base.Loading(false);
- }
-
- public async Task GerarExcel()
- {
- string str;
- string str1;
- if (this.Extrato == null || this.Extrato.Count == 0)
- {
- base.ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO EM EXCEL", "OK", "", false);
- }
- else
- {
- List<ExtratoConta> list = this.Extrato.ToList<ExtratoConta>();
- string tempPath = "";
- str1 = "";
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (!configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 41))
- {
- tempPath = Path.GetTempPath();
- str1 = string.Format("{0}{1}.xlsx", tempPath, Guid.NewGuid());
- }
- else
- {
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (DialogResult.OK == folderBrowserDialog.ShowDialog())
- {
- tempPath = string.Concat(folderBrowserDialog.SelectedPath, "\\");
- Directory.CreateDirectory(tempPath);
- }
- else
- {
- str1 = null;
- return;
- }
- }
- string[] descricao = new string[] { tempPath, "EXTRATO CONTA - ", this.SelectedConta.get_Descricao(), " ", null, null };
- DateTime date = Functions.GetNetworkTime().Date;
- descricao[4] = date.ToShortDateString().Replace("/", "");
- descricao[5] = ".xlsx";
- str1 = string.Concat(descricao);
- }
- XLWorkbook xLWorkbook = new XLWorkbook();
- string str2 = string.Concat("EXTRATO CONTA - ", this.SelectedConta.get_Descricao());
- str = (str2.Length < 30 ? str2 : str2.Substring(0, 30));
- str2 = str;
- await Funcoes.GerarXls<ExtratoConta>(xLWorkbook, str2, list, new List<string>()).SaveAs(str1);
- Process.Start(str1);
- }
- str1 = null;
- }
-
- public async Task GerarRelatorio()
- {
- DateTime? dataInicio;
- bool flag;
- Sinal sinal;
- Sinal sinal1;
- string str;
- ExtratoContaViewModel.u003cu003ec__DisplayClass52_0 variable;
- if (this.SelectedConta != null && this.SelectedConta.get_Id() != 0)
- {
- DateTime? inicio = this.Inicio;
- if (inicio.HasValue)
- {
- inicio = this.Fim;
- if (inicio.HasValue)
- {
- BancosContasServico bancosContasServico = new BancosContasServico();
- Saldo saldo = await bancosContasServico.BuscarSaldoInicial(this.SelectedConta.get_Id());
- if (saldo != null)
- {
- dataInicio = saldo.get_DataInicio();
- }
- else
- {
- dataInicio = null;
- }
- inicio = dataInicio;
- DateTime? fim = this.Inicio;
- flag = (inicio.HasValue & fim.HasValue ? inicio.GetValueOrDefault() > fim.GetValueOrDefault() : false);
- if (!flag)
- {
- FinanceiroServico financeiroServico = this._servico;
- fim = this.Inicio;
- DateTime value = fim.Value;
- fim = this.Fim;
- List<ExtratoConta> extratoContas2 = await financeiroServico.BuscarLancamentosPorConta(value, fim.Value, this.SelectedConta.get_Id());
- List<ExtratoConta> extratoContas3 = extratoContas2;
- BancosContasServico bancosContasServico1 = bancosContasServico;
- fim = this.Inicio;
- Saldo saldo1 = await bancosContasServico1.BuscarSaldo(fim.Value, this.SelectedConta.get_Id());
- if (extratoContas3.Count != 0)
- {
- if (saldo1 == null)
- {
- Saldo saldo2 = new Saldo();
- saldo2.set_Conta(this.SelectedConta);
- saldo2.set_DataInicio(this.Inicio);
- saldo2.set_ValorInicio(decimal.Zero);
- saldo1 = saldo2;
- }
- fim = this.Inicio;
- saldo1.set_DataFinal(new DateTime?(fim.Value));
- decimal num1 = new decimal();
- saldo1.set_ValorFinal(new decimal?(num1));
- saldo1 = await bancosContasServico.FecharSaldo(saldo1);
- List<ExtratoConta> extratoContas4 = new List<ExtratoConta>();
- ExtratoConta extratoContum2 = new ExtratoConta();
- fim = this.Inicio;
- extratoContum2.set_Baixa(new DateTime?(fim.Value));
- extratoContum2.set_Fornecedor("SALDO INICIAL");
- decimal? valorFinal = saldo1.get_ValorFinal();
- extratoContum2.set_Valor(new decimal?(valorFinal.GetValueOrDefault()));
- valorFinal = saldo1.get_ValorFinal();
- sinal = (valorFinal.GetValueOrDefault() < decimal.Zero ? 1 : 0);
- extratoContum2.set_Sinal(sinal);
- extratoContum2.set_Bold(true);
- ExtratoConta extratoContum3 = extratoContum2;
- extratoContas4.Add(extratoContum3);
- decimal? valor = extratoContum3.get_Valor();
- List<ExtratoConta> extratoContas5 = extratoContas3;
- IOrderedEnumerable<ExtratoConta> extratoContas6 =
- from x in extratoContas5
- orderby x.get_Baixa()
- select x;
- (
- from x in extratoContas6
- group x by x.get_Baixa()).ToList<IGrouping<DateTime?, ExtratoConta>>().ForEach((IGrouping<DateTime?, ExtratoConta> g) => {
- decimal? nullable;
- decimal? nullable1;
- List<ExtratoConta> list = extratoContas3.Where<ExtratoConta>((ExtratoConta x) => {
- DateTime? baixa = x.get_Baixa();
- DateTime? key = g.Key;
- if (baixa.HasValue != key.HasValue)
- {
- return false;
- }
- if (!baixa.HasValue)
- {
- return true;
- }
- return baixa.GetValueOrDefault() == key.GetValueOrDefault();
- }).ToList<ExtratoConta>();
- ExtratoConta extratoContum = new ExtratoConta();
- extratoContum.set_Baixa(g.Key);
- extratoContum.set_Fornecedor("SALDO FINAL DO DIA");
- decimal? nullable2 = valor;
- List<ExtratoConta> extratoContas = list;
- Func<ExtratoConta, decimal?> u003cu003e9_524 = ExtratoContaViewModel.u003cu003ec.u003cu003e9__52_4;
- if (u003cu003e9_524 == null)
- {
- u003cu003e9_524 = (ExtratoConta x) => x.get_Valor();
- ExtratoContaViewModel.u003cu003ec.u003cu003e9__52_4 = u003cu003e9_524;
- }
- decimal? nullable3 = extratoContas.Sum<ExtratoConta>(u003cu003e9_524);
- if (nullable2.HasValue & nullable3.HasValue)
- {
- nullable1 = new decimal?(nullable2.GetValueOrDefault() + nullable3.GetValueOrDefault());
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- extratoContum.set_Valor(nullable1);
- nullable2 = valor;
- List<ExtratoConta> extratoContas1 = list;
- Func<ExtratoConta, decimal?> u003cu003e9_525 = ExtratoContaViewModel.u003cu003ec.u003cu003e9__52_5;
- if (u003cu003e9_525 == null)
- {
- u003cu003e9_525 = (ExtratoConta x) => x.get_Valor();
- ExtratoContaViewModel.u003cu003ec.u003cu003e9__52_5 = u003cu003e9_525;
- }
- nullable = extratoContas1.Sum<ExtratoConta>(u003cu003e9_525);
- nullable3 = (nullable2.HasValue & nullable.HasValue ? new decimal?(nullable2.GetValueOrDefault() + nullable.GetValueOrDefault()) : null);
- decimal num = new decimal();
- extratoContum.set_Sinal(((nullable3.GetValueOrDefault() < num) & nullable3.HasValue ? 1 : 0));
- extratoContum.set_Bold(true);
- ExtratoConta extratoContum1 = extratoContum;
- if (!this.SaldoFinal)
- {
- extratoContas4.AddRange(list);
- }
- extratoContas4.Add(extratoContum1);
- valor = extratoContum1.get_Valor();
- });
- List<ExtratoConta> extratoContas7 = extratoContas4;
- ExtratoConta extratoContum4 = new ExtratoConta();
- fim = this.Fim;
- extratoContum4.set_Baixa(new DateTime?(fim.Value));
- extratoContum4.set_Fornecedor("SALDO FINAL");
- extratoContum4.set_Valor(valor);
- valorFinal = valor;
- num1 = new decimal();
- sinal1 = ((valorFinal.GetValueOrDefault() < num1) & valorFinal.HasValue ? 1 : 0);
- extratoContum4.set_Sinal(sinal1);
- extratoContum4.set_Bold(true);
- extratoContas7.Add(extratoContum4);
- this.Extrato = new ObservableCollection<ExtratoConta>(extratoContas4);
- bancosContasServico = null;
- }
- else
- {
- this.NaoHaDados = true;
- variable = null;
- return;
- }
- }
- else
- {
- ExtratoContaViewModel extratoContaViewModel = this;
- string descricao = saldo.get_Conta().get_Descricao();
- fim = saldo.get_DataInicio();
- if (fim.HasValue)
- {
- str = fim.GetValueOrDefault().ToString("dd/MM/yyyy");
- }
- else
- {
- str = null;
- }
- extratoContaViewModel.ShowMessage(string.Concat("DATA DE INÍCIO É MENOR QUE A CRIAÇÃO DA CONTA ", descricao, ",\nDATA DE ABERTURA ", str), "OK", "", false);
- this.NaoHaDados = true;
- variable = null;
- return;
- }
- }
- }
- }
- variable = null;
- }
-
- public void LimparRelatorio()
- {
- this.Extrato = null;
- }
-
- public async Task Print()
- {
- DateTime dateTime;
- DateTime dateTime1;
- string str;
- if (this.Extrato == null || this.Extrato.Count == 0)
- {
- base.ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO", "OK", "", false);
- }
- else
- {
- string str1 = await Funcoes.GenerateTable<ExtratoConta>(this.Extrato.ToList<ExtratoConta>(), new List<string>(), false, false, "", null);
- TipoRelatorio tipoRelatorio = new TipoRelatorio();
- tipoRelatorio.set_Nome(string.Concat("EXTRATO CONTA - ", this.SelectedConta.get_Descricao()));
- DateTime? inicio = this.Inicio;
- dateTime = (inicio.HasValue ? inicio.GetValueOrDefault() : DateTime.MinValue);
- tipoRelatorio.set_Inicio(dateTime);
- inicio = this.Fim;
- dateTime1 = (inicio.HasValue ? inicio.GetValueOrDefault() : DateTime.MinValue);
- tipoRelatorio.set_Fim(dateTime1);
- TipoRelatorio tipoRelatorio1 = tipoRelatorio;
- TipoRelatorio tipoRelatorio2 = tipoRelatorio1;
- str = (tipoRelatorio1.get_Nome().Length < 30 ? tipoRelatorio1.get_Nome() : tipoRelatorio1.get_Nome().Substring(0, 30));
- tipoRelatorio2.set_Nome(str);
- string str2 = Funcoes.ExportarHtml(tipoRelatorio1, str1, "60", "portrait", false, "");
- string tempPath = Path.GetTempPath();
- string str3 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (new Regex(string.Concat("[", Regex.Escape(string.Concat(new string(Path.GetInvalidFileNameChars()), new string(Path.GetInvalidPathChars()))), "]"))).Replace(tipoRelatorio1.get_Nome(), ""), Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str3, true, Encoding.UTF8);
- streamWriter.Write(str2);
- streamWriter.Close();
- Process.Start(str3);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/FinanceiroViewModel.cs b/Gestor.Application/ViewModels/Financeiro/FinanceiroViewModel.cs
deleted file mode 100644
index 630e3db..0000000
--- a/Gestor.Application/ViewModels/Financeiro/FinanceiroViewModel.cs
+++ /dev/null
@@ -1,5973 +0,0 @@
-using ClosedXML.Excel;
-using CsQuery.ExtensionMethods;
-using Gestor.Application.Actions;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Relatorios;
-using Gestor.Common.Helpers;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-using Gestor.Model.Domain.Seguros;
-using Gestor.Model.Helper;
-using OfxSharpLib;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Forms;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class FinanceiroViewModel : BaseFinanceiroViewModel
- {
- private readonly FinanceiroServico _servico;
-
- private bool _enableIncluirNovo;
-
- private bool _enableChanges;
-
- private SinteticoFinanceiroTipo _sinteticoTipo;
-
- private Visibility _isVisibleData;
-
- private Visibility _isVisibleFornecedor = Visibility.Collapsed;
-
- private Visibility _isVisiblePersonalizado = Visibility.Collapsed;
-
- private Visibility _isVisibleFiltros = Visibility.Collapsed;
-
- private Visibility _isVisibleLancamento;
-
- private Visibility _isvisibleStatus;
-
- private FiltroLancamento _selectedFiltro;
-
- private FiltroLancamentoData _selectedFiltroData;
-
- private StatusLancamento _selectedStatus;
-
- private StatusLancamento _selectedStatusImportacao = 2;
-
- private Visibility _botaoSalvarVisibility;
-
- private DateTime? _inicio = new DateTime?(Funcoes.GetNetworkTime());
-
- private DateTime? _fim = new DateTime?(Funcoes.GetNetworkTime().AddDays(7));
-
- private Fornecedor _selectedFornecedor;
-
- private ObservableCollection<Saldo> _saldos = new ObservableCollection<Saldo>();
-
- private Saldo _selectedSaldo = new Saldo();
-
- private ObservableCollection<Lancamento> _lancamentos = new ObservableCollection<Lancamento>();
-
- private bool _dontSort;
-
- private ObservableCollection<Lancamento> _lancamentosFiltrados = new ObservableCollection<Lancamento>();
-
- private ObservableCollection<Lancamento> _lancamentosFiltradosCopia = new ObservableCollection<Lancamento>();
-
- private ObservableCollection<Lancamento> _lancamentosVinculo = new ObservableCollection<Lancamento>();
-
- private Lancamento _lancamentoVinculo;
-
- private Lancamento _selectedLancamento;
-
- private Fornecedor _fornecedorInclusao;
-
- private long _idLancamento;
-
- private string _historico;
-
- private string _observacao;
-
- private string _documento;
-
- private string _complemento;
-
- private string _competencia;
-
- private int _parcela;
-
- private double _dropDownHeight;
-
- private int _parcelas;
-
- public bool VencimentoAlterado;
-
- private DateTime _vencimento;
-
- private DateTime? _baixa;
-
- private DateTime? _pagamento;
-
- private decimal _valor;
-
- private decimal? _valorPago;
-
- private Gestor.Model.Common.Sinal _sinal;
-
- private Gestor.Model.Domain.Financeiro.Planos _plano;
-
- private Gestor.Model.Domain.Financeiro.Centro _centro;
-
- private BancosContas _conta;
-
- private Gestor.Model.Common.TipoPagamento _tipoPagamento;
-
- private List<Gestor.Model.Domain.Financeiro.Planos> _planosFiltro;
-
- private List<Gestor.Model.Domain.Financeiro.Centro> _centroFiltro;
-
- private List<BancosContas> _contaFiltro;
-
- private List<Gestor.Model.Domain.Financeiro.Planos> _planos;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> _planosFiltrados;
-
- private List<BancosContas> _contas;
-
- private ObservableCollection<BancosContas> _contasFiltradas;
-
- private List<Gestor.Model.Domain.Financeiro.Centro> _centros;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Centro> _centrosFiltrados;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro> _totalizacao;
-
- private Visibility _visibilityFornecedor;
-
- private Visibility _visibilityCentro;
-
- private Visibility _visibilityConta;
-
- private Visibility _alterando = Visibility.Collapsed;
-
- private bool _buscaHabilitada = true;
-
- private bool _alteracao = true;
-
- private List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> _filtroRelatorioPersonalizado;
-
- private List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> _filtros;
-
- private ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> _personalizadoSelecionado;
-
- private ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> _filtroRelatorioSelecionado = new ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>();
-
- private Visibility _visibilitySemValor = Visibility.Collapsed;
-
- private Gestor.Model.Domain.Relatorios.FiltroPersonalizado _filtro;
-
- private Type _tipoString = typeof(string);
-
- private Type _tipoEnum = typeof(Enum);
-
- private Type _tipoDateTime = typeof(DateTime);
-
- private Type _tipoDecimal = typeof(decimal);
-
- private Type _tipoInt = typeof(int);
-
- private Type _tipoLong = typeof(long);
-
- private string _valorIncial = "";
-
- private string _valorFinal = "";
-
- private bool _semValor;
-
- private List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> _filtroPersonalizado;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> _filtroPersonalizadoSelecionado = new ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
-
- private Visibility _visibleFiltros = Visibility.Collapsed;
-
- private Visibility _visibleOlho = Visibility.Collapsed;
-
- private bool importando;
-
- private bool _isExpanded;
-
- public bool Alteracao
- {
- get
- {
- return this._alteracao;
- }
- set
- {
- this._alteracao = value;
- base.OnPropertyChanged("Alteracao");
- }
- }
-
- public Visibility Alterando
- {
- get
- {
- return this._alterando;
- }
- set
- {
- this._alterando = value;
- base.OnPropertyChanged("Alterando");
- }
- }
-
- public DateTime? Baixa
- {
- get
- {
- return this._baixa;
- }
- set
- {
- this._baixa = value;
- base.OnPropertyChanged("Baixa");
- }
- }
-
- public Visibility BotaoSalvarVisibility
- {
- get
- {
- return this._isvisibleStatus;
- }
- set
- {
- this._isvisibleStatus = value;
- base.OnPropertyChanged("BotaoSalvarVisibility");
- }
- }
-
- public bool BuscaHabilitada
- {
- get
- {
- return this._buscaHabilitada;
- }
- set
- {
- this._buscaHabilitada = value;
- base.OnPropertyChanged("BuscaHabilitada");
- }
- }
-
- private bool Carregar { get; set; } = true;
-
- public Gestor.Model.Domain.Financeiro.Centro Centro
- {
- get
- {
- return this._centro;
- }
- set
- {
- this._centro = value;
- base.OnPropertyChanged("Centro");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Centro> CentroFiltro
- {
- get
- {
- return this._centroFiltro;
- }
- set
- {
- this._centroFiltro = value;
- base.OnPropertyChanged("CentroFiltro");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Centro> Centros
- {
- get
- {
- return this._centros;
- }
- set
- {
- this._centros = value;
- base.OnPropertyChanged("Centros");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Centro> CentrosFiltrados
- {
- get
- {
- return this._centrosFiltrados;
- }
- set
- {
- this._centrosFiltrados = value;
- base.OnPropertyChanged("CentrosFiltrados");
- }
- }
-
- public string CodigoBanco
- {
- get;
- set;
- }
-
- public string Competencia
- {
- get
- {
- return this._competencia;
- }
- set
- {
- this._competencia = value;
- base.OnPropertyChanged("Competencia");
- }
- }
-
- public string Complemento
- {
- get
- {
- return this._complemento;
- }
- set
- {
- this._complemento = value;
- base.OnPropertyChanged("Complemento");
- }
- }
-
- public BancosContas Conta
- {
- get
- {
- return this._conta;
- }
- set
- {
- this._conta = value;
- base.OnPropertyChanged("Conta");
- }
- }
-
- public List<BancosContas> ContaFiltro
- {
- get
- {
- return this._contaFiltro;
- }
- set
- {
- this._contaFiltro = value;
- base.OnPropertyChanged("ContaFiltro");
- }
- }
-
- public List<BancosContas> Contas
- {
- get
- {
- return this._contas;
- }
- set
- {
- this._contas = value;
- base.OnPropertyChanged("Contas");
- }
- }
-
- public ObservableCollection<BancosContas> ContasFiltradas
- {
- get
- {
- return this._contasFiltradas;
- }
- set
- {
- this._contasFiltradas = value;
- base.OnPropertyChanged("ContasFiltradas");
- }
- }
-
- public string Documento
- {
- get
- {
- return this._documento;
- }
- set
- {
- this._documento = value;
- base.OnPropertyChanged("Documento");
- }
- }
-
- public double DropDownHeight
- {
- get
- {
- return this._dropDownHeight;
- }
- set
- {
- this._dropDownHeight = value;
- base.OnPropertyChanged("DropDownHeight");
- }
- }
-
- public bool EnableChanges
- {
- get
- {
- return this._enableChanges;
- }
- set
- {
- this._enableChanges = value;
- base.OnPropertyChanged("EnableChanges");
- }
- }
-
- public bool EnableIncluirNovo
- {
- get
- {
- return this._enableIncluirNovo;
- }
- set
- {
- this._enableIncluirNovo = value;
- base.OnPropertyChanged("EnableIncluirNovo");
- }
- }
-
- public Gestor.Model.Domain.Relatorios.FiltroPersonalizado Filtro
- {
- get
- {
- return this._filtro;
- }
- set
- {
- char chr;
- this._filtro = value;
- this.VisibilitySemValor = (value != null ? Visibility.Visible : Visibility.Collapsed);
- base.OnPropertyChanged("Filtro");
- if (value == null)
- {
- return;
- }
- string name = value.get_Tipo().Name;
- if (name != null)
- {
- switch (name.Length)
- {
- case 3:
- {
- if (name == "int")
- {
- break;
- }
- return;
- }
- case 4:
- {
- chr = name[0];
- if (chr == 'E')
- {
- if (name == "Enum")
- {
- this.ValorInicial = null;
- this.ValorFinal = null;
- return;
- }
- return;
- }
- else
- {
- if (chr != 'l')
- {
- return;
- }
- if (name == "long")
- {
- break;
- }
- return;
- }
- }
- case 5:
- {
- chr = name[3];
- if (chr == '3')
- {
- if (name == "int32")
- {
- break;
- }
- return;
- }
- else
- {
- if (chr != '6')
- {
- return;
- }
- if (name == "int64")
- {
- break;
- }
- return;
- }
- }
- case 6:
- {
- if (name != "String")
- {
- return;
- }
- this.ValorInicial = "";
- this.ValorFinal = "";
- return;
- }
- case 7:
- {
- if (name != "Decimal")
- {
- return;
- }
- this.ValorInicial = "0,00";
- this.ValorFinal = "0,00";
- return;
- }
- case 8:
- {
- if (name == "DateTime")
- {
- this.ValorInicial = null;
- this.ValorFinal = null;
- return;
- }
- return;
- }
- default:
- {
- return;
- }
- }
- this.ValorInicial = "0";
- this.ValorFinal = "0";
- }
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> FiltroPersonalizado
- {
- get
- {
- return this._filtroPersonalizado;
- }
- set
- {
- this._filtroPersonalizado = value;
- base.OnPropertyChanged("FiltroPersonalizado");
- }
- }
-
- public AutoCompleteFilterPredicate<object> FiltroPersonalizadoItemFilter
- {
- get
- {
- AutoCompleteFilterPredicate<object> u003cu003e9_3690 = FinanceiroViewModel.u003cu003ec.u003cu003e9__369_0;
- if (u003cu003e9_3690 == null)
- {
- u003cu003e9_3690 = new AutoCompleteFilterPredicate<object>(FinanceiroViewModel.u003cu003ec.u003cu003e9, (string searchText, object obj) => ((Gestor.Model.Domain.Financeiro.FiltroPersonalizado)obj).get_Descricao().ToUpper().Contains(searchText.ToUpper()));
- FinanceiroViewModel.u003cu003ec.u003cu003e9__369_0 = u003cu003e9_3690;
- }
- return u003cu003e9_3690;
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> FiltroPersonalizadoSelecionado
- {
- get
- {
- return this._filtroPersonalizadoSelecionado;
- }
- set
- {
- this._filtroPersonalizadoSelecionado = value;
- base.OnPropertyChanged("FiltroPersonalizadoSelecionado");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> FiltroRelatorioSelecionado
- {
- get
- {
- return this._filtroRelatorioSelecionado;
- }
- set
- {
- this._filtroRelatorioSelecionado = value;
- base.OnPropertyChanged("FiltroRelatorioSelecionado");
- }
- }
-
- public List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> Filtros
- {
- get
- {
- return this._filtros;
- }
- set
- {
- this._filtros = value;
- base.OnPropertyChanged("Filtros");
- }
- }
-
- public DateTime? Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- if (value.HasValue && value.Value < new DateTime(1754, 1, 1))
- {
- value = new DateTime?(new DateTime(1754, 1, 1));
- }
- if (value.HasValue && value.Value > new DateTime(9999, 12, 31))
- {
- value = new DateTime?(new DateTime(9999, 12, 31));
- }
- this._fim = value;
- base.OnPropertyChanged("Fim");
- }
- }
-
- public Fornecedor FornecedorInclusao
- {
- get
- {
- return this._fornecedorInclusao;
- }
- set
- {
- //
- // Current member / type: System.Void Gestor.Application.ViewModels.Financeiro.FinanceiroViewModel::set_FornecedorInclusao(Gestor.Model.Domain.Financeiro.Fornecedor)
- // File path: C:\AggerSeguros\Gestor.Application.exe
- //
- // Product version: 0.0.0.0
- // Exception in: System.Void set_FornecedorInclusao(Gestor.Model.Domain.Financeiro.Fornecedor)
- //
- // Object reference not set to an instance of an object.
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331
- // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
- // at Telerik.JustDecompiler.Decompiler.PropertyDecompiler.DecompileMethod(MethodBody body, MethodSpecificContext& methodContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\PropertyDecompiler.cs:line 347
- //
- // mailto: JustDecompilePublicFeedback@telerik.com
-
- }
- }
-
- public string Historico
- {
- get
- {
- return this._historico;
- }
- set
- {
- this._historico = value;
- base.OnPropertyChanged("Historico");
- }
- }
-
- public long IdLancamento
- {
- get
- {
- return this._idLancamento;
- }
- set
- {
- this._idLancamento = value;
- base.OnPropertyChanged("IdLancamento");
- }
- }
-
- public bool Importando
- {
- get
- {
- return this.importando;
- }
- set
- {
- this.importando = value;
- base.OnPropertyChanged("Importando");
- }
- }
-
- public DateTime? Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- if (value.HasValue && value.Value < new DateTime(1754, 1, 1))
- {
- value = new DateTime?(new DateTime(1754, 1, 1));
- }
- if (value.HasValue && value.Value > new DateTime(9999, 12, 31))
- {
- value = new DateTime?(new DateTime(9999, 12, 31));
- }
- this._inicio = value;
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public Visibility IsVisibleData
- {
- get
- {
- return this._isVisibleData;
- }
- set
- {
- this._isVisibleData = value;
- base.OnPropertyChanged("IsVisibleData");
- }
- }
-
- public Visibility IsVisibleFiltros
- {
- get
- {
- return this._isVisibleFiltros;
- }
- set
- {
- this._isVisibleFiltros = value;
- base.OnPropertyChanged("IsVisibleFiltros");
- }
- }
-
- public Visibility IsVisibleFornecedor
- {
- get
- {
- return this._isVisibleFornecedor;
- }
- set
- {
- this._isVisibleFornecedor = value;
- base.OnPropertyChanged("IsVisibleFornecedor");
- }
- }
-
- public Visibility IsVisibleLancamento
- {
- get
- {
- return this._isVisibleLancamento;
- }
- set
- {
- this._isVisibleLancamento = value;
- base.OnPropertyChanged("IsVisibleLancamento");
- }
- }
-
- public Visibility IsVisiblePersonalizado
- {
- get
- {
- return this._isVisiblePersonalizado;
- }
- set
- {
- this._isVisiblePersonalizado = value;
- base.OnPropertyChanged("IsVisiblePersonalizado");
- }
- }
-
- public Visibility IsvisibleStatus
- {
- get
- {
- return this._isvisibleStatus;
- }
- set
- {
- this._isvisibleStatus = value;
- base.OnPropertyChanged("IsvisibleStatus");
- }
- }
-
- public ObservableCollection<Lancamento> Lancamentos
- {
- get
- {
- return this._lancamentos;
- }
- set
- {
- this._lancamentos = value;
- base.OnPropertyChanged("Lancamentos");
- }
- }
-
- private Lancamento LancamentoSelecionado
- {
- get;
- set;
- }
-
- public ObservableCollection<Lancamento> LancamentosFiltrados
- {
- get
- {
- return this._lancamentosFiltrados;
- }
- set
- {
- if (!this._dontSort)
- {
- Action saveSortLancamentos = Gestor.Application.Actions.Actions.SaveSortLancamentos;
- if (saveSortLancamentos != null)
- {
- saveSortLancamentos();
- }
- else
- {
- }
- }
- this._lancamentosFiltrados = value;
- this.Totalizar();
- base.OnPropertyChanged("LancamentosFiltrados");
- if (!this._dontSort)
- {
- Action sortLancamentos = Gestor.Application.Actions.Actions.SortLancamentos;
- if (sortLancamentos == null)
- {
- return;
- }
- sortLancamentos();
- }
- }
- }
-
- public ObservableCollection<Lancamento> LancamentosFiltradosCopia
- {
- get
- {
- return this._lancamentosFiltradosCopia;
- }
- set
- {
- this._lancamentosFiltradosCopia = value;
- base.OnPropertyChanged("LancamentosFiltradosCopia");
- }
- }
-
- public ObservableCollection<Lancamento> LancamentosVinculo
- {
- get
- {
- return this._lancamentosVinculo;
- }
- set
- {
- this._lancamentosVinculo = value;
- base.OnPropertyChanged("LancamentosVinculo");
- }
- }
-
- public Lancamento LancamentoVinculo
- {
- get
- {
- return this._lancamentoVinculo;
- }
- set
- {
- this._lancamentoVinculo = value;
- base.OnPropertyChanged("LancamentoVinculo");
- }
- }
-
- public bool NotImportando
- {
- get
- {
- return !this.Importando;
- }
- }
-
- public string Observacao
- {
- get
- {
- return this._observacao;
- }
- set
- {
- this._observacao = value;
- base.OnPropertyChanged("Observacao");
- }
- }
-
- public DateTime? Pagamento
- {
- get
- {
- return this._pagamento;
- }
- set
- {
- this._pagamento = value;
- base.OnPropertyChanged("Pagamento");
- }
- }
-
- public int Parcela
- {
- get
- {
- return this._parcela;
- }
- set
- {
- this._parcela = value;
- base.OnPropertyChanged("Parcela");
- }
- }
-
- public int Parcelas
- {
- get
- {
- return this._parcelas;
- }
- set
- {
- this._parcelas = value;
- base.OnPropertyChanged("Parcelas");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> PersonalizadoSelecionado
- {
- get
- {
- return this._personalizadoSelecionado;
- }
- set
- {
- this._personalizadoSelecionado = value;
- base.OnPropertyChanged("PersonalizadoSelecionado");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.Planos Plano
- {
- get
- {
- return this._plano;
- }
- set
- {
- this._plano = value;
- base.OnPropertyChanged("Plano");
- if (value == null || value.get_Id() == 0)
- {
- return;
- }
- this.Sinal = (this.importando ? this.Sinal : value.get_Sinal());
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Planos> Planos
- {
- get
- {
- return this._planos;
- }
- set
- {
- this._planos = value;
- base.OnPropertyChanged("Planos");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> PlanosFiltrados
- {
- get
- {
- return this._planosFiltrados;
- }
- set
- {
- this._planosFiltrados = value;
- base.OnPropertyChanged("PlanosFiltrados");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Planos> PlanosFiltro
- {
- get
- {
- return this._planosFiltro;
- }
- set
- {
- this._planosFiltro = value;
- base.OnPropertyChanged("PlanosFiltro");
- }
- }
-
- public List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> RelatorioFiltroPersonalizado
- {
- get
- {
- return this._filtroRelatorioPersonalizado;
- }
- set
- {
- this._filtroRelatorioPersonalizado = value;
- base.OnPropertyChanged("RelatorioFiltroPersonalizado");
- }
- }
-
- public ObservableCollection<Saldo> Saldos
- {
- get
- {
- return this._saldos;
- }
- set
- {
- this._saldos = value;
- base.OnPropertyChanged("Saldos");
- }
- }
-
- private bool Salvando
- {
- get;
- set;
- }
-
- public FiltroLancamento SelectedFiltro
- {
- get
- {
- return this._selectedFiltro;
- }
- set
- {
- this._selectedFiltro = value;
- this.LimparLancamentos();
- base.OnPropertyChanged("SelectedFiltro");
- }
- }
-
- public FiltroLancamentoData SelectedFiltroData
- {
- get
- {
- return this._selectedFiltroData;
- }
- set
- {
- this._selectedFiltroData = value;
- this.LimparLancamentos();
- base.OnPropertyChanged("SelectedFiltroData");
- }
- }
-
- public Fornecedor SelectedFornecedor
- {
- get
- {
- return this._selectedFornecedor;
- }
- set
- {
- this._selectedFornecedor = value;
- this.LimparLancamentos();
- base.OnPropertyChanged("SelectedFornecedor");
- }
- }
-
- public Lancamento SelectedLancamento
- {
- get
- {
- return this._selectedLancamento;
- }
- set
- {
- bool id;
- bool flag;
- bool id1;
- if (value != null && value.get_Id() != 0)
- {
- this.IdLancamento = value.get_Id();
- }
- else if (this.importando)
- {
- this.IdLancamento = (long)0;
- }
- if (value == null || value.get_Id() <= (long)0)
- {
- id = false;
- }
- else
- {
- Usuario usuario = Recursos.Usuario;
- if (usuario != null)
- {
- id = usuario.get_Id() > (long)0;
- }
- else
- {
- id = false;
- }
- }
- this.EnableIncluirNovo = id;
- this._selectedLancamento = value;
- if (value == null || value.get_Id() <= (long)0)
- {
- flag = false;
- }
- else
- {
- Usuario usuario1 = Recursos.Usuario;
- if (usuario1 != null)
- {
- flag = usuario1.get_Id() > (long)0;
- }
- else
- {
- flag = false;
- }
- }
- base.EnableButtons = flag;
- Usuario usuario2 = Recursos.Usuario;
- if (usuario2 != null)
- {
- id1 = usuario2.get_Id() > (long)0;
- }
- else
- {
- id1 = false;
- }
- this.EnableChanges = id1;
- this.Alteracao = (value == null ? false : value.get_Controle().get_Id() > (long)0);
- base.OnPropertyChanged("SelectedLancamento");
- this.Feed(value);
- if (value == null || value.get_Id() == 0)
- {
- return;
- }
- this.LancamentoSelecionado = value;
- }
- }
-
- public Saldo SelectedSaldo
- {
- get
- {
- return this._selectedSaldo;
- }
- set
- {
- this._selectedSaldo = value;
- base.OnPropertyChanged("SelectedSaldo");
- }
- }
-
- public StatusLancamento SelectedStatus
- {
- get
- {
- return this._selectedStatus;
- }
- set
- {
- this._selectedStatus = value;
- this.LimparLancamentos();
- base.OnPropertyChanged("SelectedStatus");
- }
- }
-
- public StatusLancamento SelectedStatusImportacao
- {
- get
- {
- return this._selectedStatusImportacao;
- }
- set
- {
- this._selectedStatusImportacao = value;
- base.OnPropertyChanged("SelectedStatusImportacao");
- }
- }
-
- public bool SemValor
- {
- get
- {
- return this._semValor;
- }
- set
- {
- this._semValor = value;
- if (value)
- {
- this.ValorInicial = null;
- this.ValorFinal = null;
- }
- base.OnPropertyChanged("SemValor");
- }
- }
-
- public Gestor.Model.Common.Sinal Sinal
- {
- get
- {
- return this._sinal;
- }
- set
- {
- this._sinal = value;
- base.OnPropertyChanged("Sinal");
- }
- }
-
- public SinteticoFinanceiroTipo SinteticoTipo
- {
- get
- {
- return this._sinteticoTipo;
- }
- set
- {
- this._sinteticoTipo = value;
- base.OnPropertyChanged("SinteticoTipo");
- }
- }
-
- public Type TipoDateTime
- {
- get
- {
- return this._tipoDateTime;
- }
- set
- {
- this._tipoDateTime = value;
- base.OnPropertyChanged("TipoDateTime");
- }
- }
-
- public Type TipoDecimal
- {
- get
- {
- return this._tipoDecimal;
- }
- set
- {
- this._tipoDecimal = value;
- base.OnPropertyChanged("TipoDecimal");
- }
- }
-
- public Type TipoEnum
- {
- get
- {
- return this._tipoEnum;
- }
- set
- {
- this._tipoEnum = value;
- base.OnPropertyChanged("TipoEnum");
- }
- }
-
- public Type TipoInt
- {
- get
- {
- return this._tipoInt;
- }
- set
- {
- this._tipoInt = value;
- base.OnPropertyChanged("TipoInt");
- }
- }
-
- public Type TipoLong
- {
- get
- {
- return this._tipoLong;
- }
- set
- {
- this._tipoLong = value;
- base.OnPropertyChanged("TipoLong");
- }
- }
-
- public Gestor.Model.Common.TipoPagamento TipoPagamento
- {
- get
- {
- return this._tipoPagamento;
- }
- set
- {
- this._tipoPagamento = value;
- base.OnPropertyChanged("TipoPagamento");
- }
- }
-
- public Type TipoString
- {
- get
- {
- return this._tipoString;
- }
- set
- {
- this._tipoString = value;
- base.OnPropertyChanged("TipoString");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro> Totalizacao
- {
- get
- {
- return this._totalizacao;
- }
- set
- {
- this._totalizacao = value;
- base.OnPropertyChanged("Totalizacao");
- }
- }
-
- public Func<List<KeyValuePair<string, string>>> ValidationEvent
- {
- get
- {
- return new Func<List<KeyValuePair<string, string>>>(this.ValidateIncluir);
- }
- }
-
- public decimal Valor
- {
- get
- {
- return this._valor;
- }
- set
- {
- this._valor = value;
- if (this.Vencimento <= Funcoes.GetNetworkTime().Date)
- {
- this.ValorPago = new decimal?(value);
- }
- base.OnPropertyChanged("Valor");
- }
- }
-
- public string ValorFinal
- {
- get
- {
- return this._valorFinal;
- }
- set
- {
- this._valorFinal = value;
- base.OnPropertyChanged("ValorFinal");
- }
- }
-
- public string ValorInicial
- {
- get
- {
- return this._valorIncial;
- }
- set
- {
- this._valorIncial = value;
- base.OnPropertyChanged("ValorInicial");
- }
- }
-
- public decimal? ValorPago
- {
- get
- {
- return this._valorPago;
- }
- set
- {
- this._valorPago = value;
- base.OnPropertyChanged("ValorPago");
- }
- }
-
- public DateTime Vencimento
- {
- get
- {
- return this._vencimento;
- }
- set
- {
- if (this.Alterando == Visibility.Visible && value != this.VencimentoAnt)
- {
- this.VencimentoAlterado = true;
- }
- this.VencimentoAnt = value;
- this._vencimento = value;
- base.OnPropertyChanged("Vencimento");
- }
- }
-
- public DateTime VencimentoAnt
- {
- get;
- set;
- }
-
- public Visibility VisibilityCentro
- {
- get
- {
- return this._visibilityCentro;
- }
- set
- {
- this._visibilityCentro = value;
- base.OnPropertyChanged("VisibilityCentro");
- }
- }
-
- public Visibility VisibilityConta
- {
- get
- {
- return this._visibilityConta;
- }
- set
- {
- this._visibilityConta = value;
- base.OnPropertyChanged("VisibilityConta");
- }
- }
-
- public Visibility VisibilityFornecedor
- {
- get
- {
- return this._visibilityFornecedor;
- }
- set
- {
- this._visibilityFornecedor = value;
- base.OnPropertyChanged("VisibilityFornecedor");
- }
- }
-
- public Visibility VisibilitySemValor
- {
- get
- {
- return this._visibilitySemValor;
- }
- set
- {
- this._visibilitySemValor = value;
- base.OnPropertyChanged("VisibilitySemValor");
- }
- }
-
- public Visibility VisibleFiltros
- {
- get
- {
- return this._visibleFiltros;
- }
- set
- {
- this._visibleFiltros = value;
- base.OnPropertyChanged("VisibleFiltros");
- }
- }
-
- public Visibility VisibleOlho
- {
- get
- {
- return this._visibleOlho;
- }
- set
- {
- this._visibleOlho = value;
- base.OnPropertyChanged("VisibleOlho");
- }
- }
-
- public FinanceiroViewModel()
- {
- this._servico = new FinanceiroServico();
- this.RelatorioFiltroPersonalizado = Funcoes.PopularFiltroFinanceiro();
- this.BuscaInicial();
- }
-
- public async void AdcionarFiltroPersonalizado()
- {
- string str;
- DateTime dateTime;
- decimal num;
- int num1;
- long num2;
- List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> filtroPersonalizados;
- List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> filtroPersonalizados1;
- if (this.Filtro != null)
- {
- if (this.SemValor)
- {
- filtroPersonalizados = (this.PersonalizadoSelecionado == null ? new List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>() : (
- from x in this.PersonalizadoSelecionado
- where x.get_Propriedade() == this.Filtro.get_Propriedade()
- select x).ToList<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>());
- List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> filtroPersonalizados2 = filtroPersonalizados;
- if (filtroPersonalizados2.Count > 0)
- {
- filtroPersonalizados2.ForEach((Gestor.Model.Domain.Relatorios.FiltroPersonalizado x) => this.PersonalizadoSelecionado.Remove(x));
- }
- str = string.Concat(this.Filtro.get_Nome(), ": EM BRANCO");
- }
- else
- {
- filtroPersonalizados1 = (this.PersonalizadoSelecionado == null ? new List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>() : this.PersonalizadoSelecionado.Where<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>((Gestor.Model.Domain.Relatorios.FiltroPersonalizado x) => {
- if (x.get_Propriedade() != this.Filtro.get_Propriedade())
- {
- return false;
- }
- return x.get_SemValor();
- }).ToList<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>());
- List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> filtroPersonalizados3 = filtroPersonalizados1;
- if (filtroPersonalizados3.Count > 0)
- {
- filtroPersonalizados3.ForEach((Gestor.Model.Domain.Relatorios.FiltroPersonalizado x) => this.PersonalizadoSelecionado.Remove(x));
- }
- string name = this.Filtro.get_Tipo().Name;
- if (name == "DateTime")
- {
- if (!DateTime.TryParse(this.ValorInicial, out dateTime) || !DateTime.TryParse(this.ValorFinal, out dateTime) || DateTime.Parse(this.ValorInicial) > DateTime.Parse(this.ValorFinal))
- {
- await base.ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE.", "OK", "", false);
- return;
- }
- else
- {
- str = string.Format("{0}: {1:d} até {2:d}", this.Filtro.get_Nome(), DateTime.Parse(this.ValorInicial), DateTime.Parse(this.ValorFinal));
- }
- }
- else if (name == "Decimal")
- {
- if (!decimal.TryParse(this.ValorInicial, out num) || !decimal.TryParse(this.ValorFinal, out num) || Math.Abs(decimal.Parse(this.ValorInicial)) > Math.Abs(decimal.Parse(this.ValorFinal)))
- {
- await base.ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE.", "OK", "", false);
- return;
- }
- else
- {
- str = string.Format("{0}: {1:n2} até {2:n2}", this.Filtro.get_Nome(), decimal.Parse(this.ValorInicial), decimal.Parse(this.ValorFinal));
- }
- }
- else if (name == "Int32")
- {
- if (!int.TryParse(this.ValorInicial, out num1) || !int.TryParse(this.ValorFinal, out num1) || int.Parse(this.ValorInicial) > int.Parse(this.ValorFinal))
- {
- await base.ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE.", "OK", "", false);
- return;
- }
- else
- {
- str = string.Format("{0}: {1:n0} até {2:n0}", this.Filtro.get_Nome(), int.Parse(this.ValorInicial), int.Parse(this.ValorFinal));
- }
- }
- else if (name != "Int64")
- {
- if (!string.IsNullOrEmpty(this.ValorInicial))
- {
- str = string.Concat(this.Filtro.get_Nome(), " = ", this.ValorInicial);
- }
- else
- {
- await base.ShowMessage("O VALOR DEVE SER PREENCHIDO CORRETAMENTE.", "OK", "", false);
- return;
- }
- }
- else if (!long.TryParse(this.ValorInicial, out num2) || !long.TryParse(this.ValorFinal, out num2) || long.Parse(this.ValorInicial) > (long)int.Parse(this.ValorFinal))
- {
- await base.ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE.", "OK", "", false);
- return;
- }
- else
- {
- str = string.Format("{0}: {1:n0} até {2:n0}", this.Filtro.get_Nome(), long.Parse(this.ValorInicial), long.Parse(this.ValorFinal));
- }
- }
- if (this.PersonalizadoSelecionado == null)
- {
- this.PersonalizadoSelecionado = new ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>();
- }
- ObservableCollection<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> personalizadoSelecionado = this.PersonalizadoSelecionado;
- Gestor.Model.Domain.Relatorios.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Relatorios.FiltroPersonalizado();
- filtroPersonalizado.set_Nome(this.Filtro.get_Nome());
- filtroPersonalizado.set_Propriedade(this.Filtro.get_Propriedade());
- filtroPersonalizado.set_Tipo(this.Filtro.get_Tipo());
- filtroPersonalizado.set_ValorIncial(this.ValorInicial);
- filtroPersonalizado.set_ValorFinal(this.ValorFinal);
- filtroPersonalizado.set_SemValor(this.SemValor);
- filtroPersonalizado.set_Descricao(str);
- personalizadoSelecionado.Add(filtroPersonalizado);
- this.Filtro = null;
- this.ValorInicial = string.Empty;
- this.ValorFinal = string.Empty;
- this.PesquisaPersonalizada();
- }
- }
-
- public void AdicionarFiltro(Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtro)
- {
- if (filtro == null)
- {
- return;
- }
- if (this.FiltroPersonalizadoSelecionado == null)
- {
- this.FiltroPersonalizadoSelecionado = new ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- }
- this.VisibleFiltros = Visibility.Visible;
- if (this.FiltroPersonalizadoSelecionado.Any<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((Gestor.Model.Domain.Financeiro.FiltroPersonalizado x) => {
- if (x.get_Id() != filtro.get_Id())
- {
- return false;
- }
- return x.get_Tipo() == filtro.get_Tipo();
- }))
- {
- return;
- }
- this.FiltroPersonalizadoSelecionado.Add(filtro);
- this.FiltrarPersonalizado();
- }
-
- public void AdicionarFiltros()
- {
- ExtensionMethods.ForEach<Gestor.Model.Domain.Financeiro.Planos>(
- from x in this.PlanosFiltro
- where x.get_Selecionado()
- select x, (Gestor.Model.Domain.Financeiro.Planos x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Id(x.get_Id());
- filtroPersonalizado.set_Tipo(1);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- this.AdicionarFiltro(filtroPersonalizado);
- });
- this.PlanosFiltro = new List<Gestor.Model.Domain.Financeiro.Planos>(
- from x in this.Planos
- orderby x.get_Descricao()
- select x);
- ExtensionMethods.ForEach<BancosContas>(
- from x in this.ContaFiltro
- where x.get_Selecionado()
- select x, (BancosContas x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Id(x.get_Id());
- filtroPersonalizado.set_Tipo(3);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- this.AdicionarFiltro(filtroPersonalizado);
- });
- this.ContaFiltro = new List<BancosContas>(
- from x in this.Contas
- orderby x.get_Descricao()
- select x);
- ExtensionMethods.ForEach<Gestor.Model.Domain.Financeiro.Centro>(
- from x in this.CentroFiltro
- where x.get_Selecionado()
- select x, (Gestor.Model.Domain.Financeiro.Centro x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Id(x.get_Id());
- filtroPersonalizado.set_Tipo(2);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- this.AdicionarFiltro(filtroPersonalizado);
- x.set_Selecionado(false);
- });
- this.CentroFiltro = new List<Gestor.Model.Domain.Financeiro.Centro>(
- from x in this.Centros
- orderby x.get_Descricao()
- select x);
- }
-
- private async Task AdicionarParcelaRange()
- {
- base.Loading(true);
- List<Lancamento> lancamentos = new List<Lancamento>();
- ObservableCollection<Lancamento> lancamentosFiltrados = this.LancamentosFiltrados;
- IEnumerable<Lancamento> selecionado =
- from x in lancamentosFiltrados
- where x.get_Selecionado()
- select x;
- List<Lancamento> list = selecionado.Select<Lancamento, Lancamento>((Lancamento x) => {
- Lancamento lancamento = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Centro(x.get_Controle().get_Centro());
- controleFinanceiro.set_Fornecedor(x.get_Controle().get_Fornecedor());
- controleFinanceiro.set_Historico(x.get_Controle().get_Historico());
- controleFinanceiro.set_Id(x.get_Controle().get_Id());
- controleFinanceiro.set_Parcelas(x.get_Controle().get_Parcelas() + 1);
- controleFinanceiro.set_Plano(x.get_Controle().get_Plano());
- lancamento.set_Controle(controleFinanceiro);
- lancamento.set_Historico(x.get_Historico());
- lancamento.set_Observacao(x.get_Observacao());
- lancamento.set_Vencimento(x.get_Vencimento().AddMonths(1));
- lancamento.set_Conta(x.get_Conta());
- lancamento.set_Parcela(x.get_Parcela() + 1);
- lancamento.set_Documento(x.get_Documento());
- lancamento.set_Sinal(x.get_Sinal());
- lancamento.set_TipoPagamento(x.get_TipoPagamento());
- lancamento.set_Valor(x.get_Valor());
- return lancamento;
- }).ToList<Lancamento>();
- foreach (Lancamento lancamento1 in list)
- {
- if (await this._servico.BuscarLancamento(lancamento1.get_Controle().get_Id(), lancamento1.get_Parcela()) != null)
- {
- continue;
- }
- lancamentos.Add(lancamento1);
- }
- await this._servico.IncluirRange(lancamentos);
- if (this._servico.Sucesso)
- {
- await this.Buscar();
- base.ToggleSnackBar("INCLUSÃO DE PARCELA REALIZADA COM SUCESSO", true);
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- lancamentos = null;
- }
-
- public async Task AlterarLancamentos(Lancamento lancamentoAtual, bool alterarVencimento, bool alterarValores)
- {
- Func<Lancamento, bool> func = null;
- List<Lancamento> lancamentos = await this._servico.BuscarLancamentosPorControle(lancamentoAtual.get_Controle().get_Id());
- int num = 1;
- List<Lancamento> lancamentos1 = lancamentos;
- Func<Lancamento, bool> func1 = func;
- if (func1 == null)
- {
- Func<Lancamento, bool> parcela = (Lancamento l) => l.get_Parcela() > lancamentoAtual.get_Parcela();
- Func<Lancamento, bool> func2 = parcela;
- func = parcela;
- func1 = func2;
- }
- foreach (Lancamento lancamento in lancamentos1.Where<Lancamento>(func1))
- {
- if (!lancamento.get_Baixado())
- {
- if (alterarVencimento)
- {
- lancamento.set_Vencimento(lancamentoAtual.get_Vencimento().AddMonths(num));
- }
- if (alterarValores)
- {
- lancamento.set_Valor(lancamentoAtual.get_Valor());
- }
- await this._servico.Save(lancamento);
- }
- num++;
- }
- this.SelectedLancamento = lancamentoAtual;
- }
-
- public async Task Atualizar(List<Lancamento> list)
- {
- DateTime? baixa;
- DateTime? nullable;
- string str;
- bool flag;
- base.Loading(true);
- List<Lancamento> lancamentos = new List<Lancamento>();
- List<Lancamento> lancamentos1 = new List<Lancamento>();
- List<Lancamento> lancamentos2 = new List<Lancamento>();
- foreach (Lancamento lancamento in list)
- {
- if (lancamento.get_Baixado())
- {
- continue;
- }
- if (!lancamento.get_Selecionado())
- {
- baixa = null;
- lancamento.set_Baixa(baixa);
- }
- baixa = lancamento.get_Baixa();
- if (baixa.HasValue)
- {
- Saldo saldo = await this.VerificaSaldo(lancamento.get_Conta().get_Id(), false);
- if (saldo == null)
- {
- continue;
- }
- baixa = saldo.get_DataInicio();
- nullable = lancamento.get_Baixa();
- flag = (baixa.HasValue & nullable.HasValue ? baixa.GetValueOrDefault() > nullable.GetValueOrDefault() : false);
- if (flag)
- {
- continue;
- }
- }
- if (lancamento.get_Selecionado())
- {
- str = (lancamento.get_Observacao() == null ? "" : string.Concat("\n ", lancamento.get_Observacao()));
- string str1 = str;
- Lancamento lancamento1 = lancamento;
- object[] id = new object[] { Recursos.Usuario.get_Id(), Recursos.Usuario.get_Nome(), null, null };
- DateTime networkTime = Funcoes.GetNetworkTime();
- id[2] = networkTime.ToString("F").ToUpper();
- id[3] = str1;
- lancamento1.set_Observacao(string.Format("BAIXA AGRUPADA REALIZADA PELO USUARIO {0} {1} EM {2}{3}", id));
- }
- List<KeyValuePair<string, string>> keyValuePairs = lancamento.Validate();
- if (keyValuePairs != null && keyValuePairs.Count > 0)
- {
- continue;
- }
- nullable = lancamento.get_Baixa();
- if (!nullable.HasValue)
- {
- lancamentos.Add(lancamento);
- }
- else
- {
- lancamentos1.Add(lancamento);
- }
- lancamentos2.Add(lancamento);
- }
- if (lancamentos2.Count != 0)
- {
- object[] count = new object[] { lancamentos.Count, Environment.NewLine, lancamentos1.Count, Environment.NewLine, Environment.NewLine };
- if (await base.ShowMessage(string.Format("{0} LANÇAMENTOS SERÃO ATUALIZADOS.{1}{2} LANÇAMENTOS SERÃO BAIXADOS.{3}{4}DESEJA REALMENTE PROSSEGUIR?", count), "SIM", "NÃO", false))
- {
- await this._servico.Atualizar(lancamentos2);
- if (this._servico.Sucesso)
- {
- if (await base.ShowMessage("DESEJA GERAR O RELATÓRIO NOVAMENTE?", "SIM,", "NÃO", false))
- {
- await this.Buscar();
- }
- base.ToggleSnackBar("ATUALIZAÇÃO REALIZADA COM SUCESSO", true);
- await this.CarregarSaldos();
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- await base.ShowMessage("NÃO HÁ LANÇAMENTOS PARA SEREM ATUALIZADOS.", "OK", "", false);
- base.Loading(false);
- }
- lancamentos = null;
- lancamentos1 = null;
- lancamentos2 = null;
- }
-
- public void Bind()
- {
- //
- // Current member / type: System.Void Gestor.Application.ViewModels.Financeiro.FinanceiroViewModel::Bind()
- // File path: C:\AggerSeguros\Gestor.Application.exe
- //
- // Product version: 0.0.0.0
- // Exception in: System.Void Bind()
- //
- // Object reference not set to an instance of an object.
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331
- // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
- // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
- // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 133
- //
- // mailto: JustDecompilePublicFeedback@telerik.com
-
- }
-
- public void BindImportando()
- {
- //
- // Current member / type: System.Void Gestor.Application.ViewModels.Financeiro.FinanceiroViewModel::BindImportando()
- // File path: C:\AggerSeguros\Gestor.Application.exe
- //
- // Product version: 0.0.0.0
- // Exception in: System.Void BindImportando()
- //
- // Object reference not set to an instance of an object.
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331
- // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
- // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
- // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 133
- //
- // mailto: JustDecompilePublicFeedback@telerik.com
-
- }
-
- private async void BuscaInicial()
- {
- base.Loading(true);
- this.Planos = await (new PlanoServico()).BuscarPlanos();
- FinanceiroViewModel observableCollection = this;
- List<Gestor.Model.Domain.Financeiro.Planos> planos = this.Planos;
- IEnumerable<Gestor.Model.Domain.Financeiro.Planos> ativo =
- from x in planos
- where x.get_Ativo()
- select x;
- observableCollection.PlanosFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>(
- from x in ativo
- orderby x.get_Descricao()
- select x);
- this.Contas = await (new BancosContasServico()).BuscarBancos();
- FinanceiroViewModel financeiroViewModel = this;
- List<BancosContas> contas = this.Contas;
- IEnumerable<BancosContas> bancosContas =
- from x in contas
- where x.get_Ativo()
- select x;
- financeiroViewModel.ContasFiltradas = new ObservableCollection<BancosContas>(
- from x in bancosContas
- orderby x.get_Descricao()
- select x);
- this.Centros = await (new CentroServico()).BuscarCentros();
- FinanceiroViewModel observableCollection1 = this;
- List<Gestor.Model.Domain.Financeiro.Centro> centros = this.Centros;
- IEnumerable<Gestor.Model.Domain.Financeiro.Centro> ativo1 =
- from x in centros
- where x.get_Ativo()
- select x;
- observableCollection1.CentrosFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Centro>(
- from x in ativo1
- orderby x.get_Descricao()
- select x);
- FinanceiroViewModel planos1 = this;
- List<Gestor.Model.Domain.Financeiro.Planos> planos2 = this.Planos;
- planos1.PlanosFiltro = new List<Gestor.Model.Domain.Financeiro.Planos>(
- from x in planos2
- orderby x.get_Descricao()
- select x);
- FinanceiroViewModel bancosContas1 = this;
- List<BancosContas> contas1 = this.Contas;
- bancosContas1.ContaFiltro = new List<BancosContas>(
- from x in contas1
- orderby x.get_Descricao()
- select x);
- FinanceiroViewModel centros1 = this;
- List<Gestor.Model.Domain.Financeiro.Centro> centros2 = this.Centros;
- centros1.CentroFiltro = new List<Gestor.Model.Domain.Financeiro.Centro>(
- from x in centros2
- orderby x.get_Descricao()
- select x);
- this.PopularFiltro();
- await this.Buscar();
- base.Loading(false);
- }
-
- public async Task Buscar()
- {
- List<Lancamento> list;
- bool flag;
- List<long> nums;
- List<long> list1;
- List<long> nums1;
- List<long> list2;
- List<long> nums2;
- this.Importando = false;
- DateTime? inicio = this.Inicio;
- if (inicio.HasValue)
- {
- inicio = this.Fim;
- if (inicio.HasValue)
- {
- inicio = this.Inicio;
- DateTime? fim = this.Fim;
- flag = (inicio.HasValue & fim.HasValue ? inicio.GetValueOrDefault() > fim.GetValueOrDefault() : false);
- if (!flag)
- {
- this.PersonalizadoSelecionado = null;
- switch (this.SelectedFiltro)
- {
- case 1:
- {
- FinanceiroServico financeiroServico = this._servico;
- fim = this.Inicio;
- DateTime value = fim.Value;
- fim = this.Fim;
- list = await financeiroServico.BuscarLancamentosPorBaixa(value, fim.Value);
- break;
- }
- case 2:
- {
- FinanceiroServico financeiroServico1 = this._servico;
- fim = this.Inicio;
- DateTime dateTime = fim.Value;
- fim = this.Fim;
- list = await financeiroServico1.BuscarLancamentosPorPagamento(dateTime, fim.Value);
- break;
- }
- case 3:
- {
- if (this.SelectedFornecedor != null)
- {
- list = await this._servico.BuscarLancamentosPorFornecedor(this.SelectedFornecedor.get_Id(), this.SelectedStatus);
- break;
- }
- else
- {
- return;
- }
- }
- case 4:
- {
- FinanceiroServico financeiroServico2 = this._servico;
- fim = this.Inicio;
- DateTime value1 = fim.Value;
- fim = this.Fim;
- list = await financeiroServico2.BuscarLancamentosPorLancamento(value1, fim.Value, this.SelectedStatus);
- break;
- }
- case 5:
- {
- FinanceiroServico financeiroServico3 = this._servico;
- fim = this.Inicio;
- DateTime dateTime1 = fim.Value;
- fim = this.Fim;
- List<Lancamento> lancamentos = await financeiroServico3.BuscarLancamentosPersonalizados(dateTime1, fim.Value, this.SelectedStatus, this.SelectedFiltroData);
- if (this.FiltroPersonalizadoSelecionado != null)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizadoSelecionado = this.FiltroPersonalizadoSelecionado;
- IEnumerable<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> tipo =
- from x in filtroPersonalizadoSelecionado
- where x.get_Tipo() == 0
- select x;
- nums = (
- from x in tipo
- select x.get_Id()).ToList<long>();
- }
- else
- {
- nums = new List<long>();
- }
- List<long> nums3 = nums;
- if (this.FiltroPersonalizadoSelecionado != null)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> observableCollection = this.FiltroPersonalizadoSelecionado;
- IEnumerable<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizados =
- from x in observableCollection
- where x.get_Tipo() == 2
- select x;
- list1 = (
- from x in filtroPersonalizados
- select x.get_Id()).ToList<long>();
- }
- else
- {
- list1 = new List<long>();
- }
- List<long> nums4 = list1;
- if (this.FiltroPersonalizadoSelecionado != null)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizadoSelecionado1 = this.FiltroPersonalizadoSelecionado;
- IEnumerable<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> tipo1 =
- from x in filtroPersonalizadoSelecionado1
- where x.get_Tipo() == 1
- select x;
- nums1 = (
- from x in tipo1
- select x.get_Id()).ToList<long>();
- }
- else
- {
- nums1 = new List<long>();
- }
- List<long> nums5 = nums1;
- if (this.FiltroPersonalizadoSelecionado != null)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> observableCollection1 = this.FiltroPersonalizadoSelecionado;
- IEnumerable<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizados1 =
- from x in observableCollection1
- where x.get_Tipo() == 3
- select x;
- list2 = (
- from x in filtroPersonalizados1
- select x.get_Id()).ToList<long>();
- }
- else
- {
- list2 = new List<long>();
- }
- List<long> nums6 = list2;
- if (this.FiltroPersonalizadoSelecionado != null)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizadoSelecionado2 = this.FiltroPersonalizadoSelecionado;
- IEnumerable<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> tipo2 =
- from x in filtroPersonalizadoSelecionado2
- where x.get_Tipo() == 4
- select x;
- nums2 = (
- from x in tipo2
- select x.get_Id()).ToList<long>();
- }
- else
- {
- nums2 = new List<long>();
- }
- List<long> nums7 = nums2;
- list = lancamentos.Where<Lancamento>((Lancamento x) => {
- if (nums3.Count != 0 && (x.get_Controle().get_Fornecedor() == null || !nums3.Contains(x.get_Controle().get_Fornecedor().get_Id())) || nums4.Count != 0 && (x.get_Controle().get_Centro() == null || !nums4.Contains(x.get_Controle().get_Centro().get_Id())) || nums5.Count != 0 && (x.get_Controle().get_Plano() == null || !nums5.Contains(x.get_Controle().get_Plano().get_Id())) || nums6.Count != 0 && (x.get_Conta() == null || !nums6.Contains(x.get_Conta().get_Id())))
- {
- return false;
- }
- if (nums7.Count == 0)
- {
- return true;
- }
- return nums7.Contains((long)x.get_Sinal());
- }).ToList<Lancamento>();
- break;
- }
- default:
- {
- FinanceiroServico financeiroServico4 = this._servico;
- fim = this.Inicio;
- DateTime value2 = fim.Value;
- fim = this.Fim;
- list = await financeiroServico4.BuscarLancamentos(value2, fim.Value, this.SelectedStatus);
- break;
- }
- }
- List<Lancamento> lancamentos1 = list;
- lancamentos1.ForEach((Lancamento x) => x.Initialize());
- this.Lancamentos = new ObservableCollection<Lancamento>(list);
- this.LancamentosFiltrados = this.Lancamentos;
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- this.SelectedLancamento = this.LancamentosFiltrados.FirstOrDefault<Lancamento>();
- await this.CarregarSaldos();
- return;
- }
- else
- {
- await base.ShowMessage("A DATA DE INÍCIO NÃO PODE SER SUPERIOR A DATA FINAL.", "OK", "", false);
- return;
- }
- }
- }
- await base.ShowMessage("NECESSÁRIO PREENCHER TANTO A DATA DE INÍCIO QUANTO A DATA FINAL PARA REALIZAR A PESQUISA.", "OK", "", false);
- }
-
- internal async Task BuscarLancamentosVinculo()
- {
- DateTime vencimento;
- DateTime? dataInicio;
- DateTime valueOrDefault;
- if (this.SelectedLancamento.get_Conta() != null)
- {
- Saldo saldo = this.Saldos.FirstOrDefault<Saldo>((Saldo x) => x.get_Id() == this.SelectedLancamento.get_Conta().get_Id());
- if (saldo != null)
- {
- dataInicio = saldo.get_DataInicio();
- }
- else
- {
- dataInicio = null;
- }
- }
- else
- {
- vencimento = this.SelectedLancamento.get_Vencimento();
- dataInicio = new DateTime?(vencimento.AddDays(-5));
- }
- DateTime? nullable = dataInicio;
- if (nullable.HasValue)
- {
- valueOrDefault = nullable.GetValueOrDefault();
- }
- else
- {
- vencimento = this.SelectedLancamento.get_Vencimento();
- valueOrDefault = vencimento.AddDays(-5);
- }
- DateTime dateTime = valueOrDefault;
- List<Lancamento> list = await this._servico.BuscarLancamentosPorFornecedor(this.FornecedorInclusao.get_Id(), dateTime, this.Sinal);
- ObservableCollection<Lancamento> lancamentos = this.Lancamentos;
- List<long> nums = (
- from x in lancamentos
- select x.get_Id()).ToList<long>();
- list = (
- from x in list
- where !nums.Contains(x.get_Id())
- select x).ToList<Lancamento>();
- this.LancamentosVinculo = new ObservableCollection<Lancamento>(list);
- }
-
- public void CancelarAlteracao()
- {
- this.LancamentosFiltrados = this.LancamentosFiltradosCopia;
- this.SelectedLancamento = this.LancamentosFiltrados.FirstOrDefault<Lancamento>((Lancamento x) => {
- long? nullable;
- long id = x.get_Id();
- Lancamento lancamentoSelecionado = this.LancamentoSelecionado;
- if (lancamentoSelecionado != null)
- {
- nullable = new long?(lancamentoSelecionado.get_Id());
- }
- else
- {
- nullable = null;
- }
- long? nullable1 = nullable;
- return id == nullable1.GetValueOrDefault() & nullable1.HasValue;
- });
- }
-
- public async Task CarregarSaldos()
- {
- this.Saldos = new ObservableCollection<Saldo>();
- BancosContasServico bancosContasServico = new BancosContasServico();
- foreach (BancosContas contasFiltrada in this.ContasFiltradas)
- {
- Saldo saldo = await bancosContasServico.BuscarSaldoAberto(contasFiltrada.get_Id());
- if (saldo == null)
- {
- continue;
- }
- DateTime date = Funcoes.GetNetworkTime().Date;
- saldo.set_DataFinal(new DateTime?(date.AddDays(1)));
- saldo = await bancosContasServico.FecharSaldo(saldo);
- this.Saldos.Add(saldo);
- }
- this.SelectedSaldo = this.Saldos.FirstOrDefault<Saldo>();
- bancosContasServico = null;
- }
-
- private Tuple<DateTime, DateTime> CorrigeLancamentos(OfxDocument lancamentos, List<string> codigoBanco)
- {
- DateTime? nullable;
- DateTime? nullable1;
- DateTime? nullable2;
- if (!this.VerificaFiltroErrado(lancamentos))
- {
- if (this.VerificaDataInvertida(lancamentos))
- {
- return new Tuple<DateTime, DateTime>(lancamentos.get_StatementEnd(), lancamentos.get_StatementStart());
- }
- return new Tuple<DateTime, DateTime>(lancamentos.get_StatementStart(), lancamentos.get_StatementEnd());
- }
- Transaction transaction = (
- from lanc in lancamentos.get_Transactions()
- orderby lanc.get_Date()
- select lanc).First<Transaction>();
- if (transaction != null)
- {
- nullable1 = new DateTime?(transaction.get_Date());
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- nullable = nullable1;
- DateTime value = nullable.Value;
- Transaction transaction1 = (
- from lanc in lancamentos.get_Transactions()
- orderby lanc.get_Date() descending
- select lanc).First<Transaction>();
- if (transaction1 != null)
- {
- nullable2 = new DateTime?(transaction1.get_Date());
- }
- else
- {
- nullable = null;
- nullable2 = nullable;
- }
- nullable = nullable2;
- return new Tuple<DateTime, DateTime>(value, nullable.Value);
- }
-
- public void DeSelecionarLancamento(Lancamento lancamento)
- {
- Lancamento lancamento1 = (lancamento.get_Id() > (long)0 ? this.LancamentosFiltrados.First<Lancamento>((Lancamento x) => x.get_Id() == lancamento.get_Id()) : this.LancamentosFiltrados.First<Lancamento>((Lancamento x) => {
- long? nullable;
- long? nullable1;
- long? nullable2;
- long? nullable3;
- long? nullable4;
- if (x.get_Id() == lancamento.get_Id())
- {
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- nullable1 = new long?(fornecedor.get_Id());
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- long? nullable5 = nullable1;
- ControleFinanceiro controleFinanceiro = lancamento.get_Controle();
- if (controleFinanceiro != null)
- {
- Fornecedor fornecedor1 = controleFinanceiro.get_Fornecedor();
- if (fornecedor1 != null)
- {
- nullable2 = new long?(fornecedor1.get_Id());
- }
- else
- {
- nullable = null;
- nullable2 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable2 = nullable;
- }
- long? nullable6 = nullable2;
- if (nullable5.GetValueOrDefault() == nullable6.GetValueOrDefault() & nullable5.HasValue == nullable6.HasValue && x.get_Valor() == lancamento.get_Valor() && x.get_Vencimento() == lancamento.get_Vencimento())
- {
- ControleFinanceiro controle1 = x.get_Controle();
- if (controle1 != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle1.get_Plano();
- if (plano != null)
- {
- nullable3 = new long?(plano.get_Id());
- }
- else
- {
- nullable = null;
- nullable3 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable3 = nullable;
- }
- nullable6 = nullable3;
- ControleFinanceiro controleFinanceiro1 = lancamento.get_Controle();
- if (controleFinanceiro1 != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano1 = controleFinanceiro1.get_Plano();
- if (plano1 != null)
- {
- nullable4 = new long?(plano1.get_Id());
- }
- else
- {
- nullable = null;
- nullable4 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable4 = nullable;
- }
- nullable5 = nullable4;
- return nullable6.GetValueOrDefault() == nullable5.GetValueOrDefault() & nullable6.HasValue == nullable5.HasValue;
- }
- }
- return false;
- }));
- lancamento1.set_Selecionado(false);
- if (!lancamento1.get_Baixado())
- {
- DateTime? nullable7 = null;
- lancamento1.set_Baixa(nullable7);
- nullable7 = null;
- lancamento1.set_Pagamento(nullable7);
- lancamento1.set_ValorPago(new decimal?(new decimal()));
- }
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- this.Totalizar();
- }
-
- public async Task Excluir()
- {
- bool flag;
- long? nullable;
- object historico;
- bool flag1;
- long num;
- Lancamento lancamento;
- if (this.SelectedLancamento != null && this.SelectedLancamento.get_Id() != 0)
- {
- base.Loading(true);
- lancamento = await this._servico.BuscarLancamento(this.SelectedLancamento.get_Id());
- Saldo saldo = await this.VerificaSaldo(this.SelectedLancamento.get_Conta().get_Id(), true);
- if (saldo != null)
- {
- DateTime? dataInicio = saldo.get_DataInicio();
- DateTime? baixa = lancamento.get_Baixa();
- flag = (dataInicio.HasValue & baixa.HasValue ? dataInicio.GetValueOrDefault() > baixa.GetValueOrDefault() : false);
- if (flag)
- {
- await base.ShowMessage("LANÇAMENTO NÃO PODE SER EXCLUÍDO POIS NÃO POSSUI SALDO ABERTO PARA O PERÍODO.", "OK", "", false);
- base.Loading(false);
- }
- else if (!await base.ShowMessage("DESEJA REAMENTE EXCLUIR O LANÇAMENTO SELECIONADO?", "SIM", "NÃO", false))
- {
- base.Loading(false);
- }
- else if (await this._servico.Excluir(this.SelectedLancamento))
- {
- FinanceiroViewModel financeiroViewModel = this;
- Lancamento selectedLancamento = this.SelectedLancamento;
- if (selectedLancamento != null)
- {
- nullable = new long?(selectedLancamento.get_Id());
- }
- else
- {
- nullable = null;
- }
- object obj = nullable;
- Lancamento selectedLancamento1 = this.SelectedLancamento;
- if (selectedLancamento1 != null)
- {
- historico = selectedLancamento1.get_Historico();
- }
- else
- {
- historico = null;
- }
- string str = string.Format("EXCLUIU O LANÇAMENTO DO ID {0} HISTORICO: {1}", obj, historico);
- Lancamento lancamento1 = this.SelectedLancamento;
- if (lancamento1 != null)
- {
- lancamento1.get_Id();
- flag1 = false;
- }
- else
- {
- flag1 = true;
- }
- num = (flag1 ? (long)0 : this.SelectedLancamento.get_Id());
- financeiroViewModel.RegistrarAcao(str, num, new TipoTela?(25), null);
- base.ToggleSnackBar("EXCLUSÃO REALIZADA COM SUCESSO", true);
- await this.Buscar();
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- }
- lancamento = null;
- }
-
- public async Task ExcluirBaixa()
- {
- bool flag;
- if (this.SelectedLancamento != null && this.SelectedLancamento.get_Id() != 0)
- {
- base.Loading(true);
- DateTime? baixa = await this._servico.BuscarLancamento(this.SelectedLancamento.get_Id()).get_Baixa();
- if (!baixa.HasValue)
- {
- await base.ShowMessage("LANÇAMENTO AINDA NÃO BAIXADO. PROCESSO INTERROMPIDO", "OK", "", false);
- base.Loading(false);
- }
- else if (await base.ShowMessage("DESEJA REAMENTE EXCLUIR A BAIXA DO LANÇAMENTO SELECIONADO?", "SIM", "NÃO", false))
- {
- Saldo saldo = await this.VerificaSaldo(this.SelectedLancamento.get_Conta().get_Id(), true);
- if (saldo != null)
- {
- baixa = saldo.get_DataInicio();
- DateTime? nullable = this.SelectedLancamento.get_Baixa();
- flag = (baixa.HasValue & nullable.HasValue ? baixa.GetValueOrDefault() > nullable.GetValueOrDefault() : false);
- if (!flag)
- {
- nullable = null;
- this.SelectedLancamento.set_Baixa(nullable);
- this.SelectedLancamento.set_ValorPago(new decimal?(new decimal()));
- nullable = null;
- this.SelectedLancamento.set_Pagamento(nullable);
- this.SelectedLancamento.set_Baixado(false);
- this.SelectedLancamento = await this._servico.Save(this.SelectedLancamento);
- if (this.importando)
- {
- this.BindImportando();
- this.LancamentosFiltrados = this.Lancamentos;
- base.Loading(false);
- }
- else if (this._servico.Sucesso)
- {
- base.ToggleSnackBar("EXCLUSÃO DE BAIXA REALIZADA COM SUCESSO", true);
- await this.Buscar();
- base.Loading(false);
- }
- }
- else
- {
- await base.ShowMessage("LANÇAMENTO NÃO PODE TER SUA BAIXA EXCLUÍDA POIS NÃO POSSUI SALDO ABERTO PARA O PERÍODO.", "OK", "", false);
- base.Loading(false);
- }
- }
- }
- else
- {
- base.Loading(false);
- }
- }
- }
-
- public async Task ExcluirBaixaRange()
- {
- bool flag;
- List<Lancamento> lancamentos;
- ObservableCollection<Lancamento> lancamentosFiltrados = this.LancamentosFiltrados;
- List<Lancamento> list = lancamentosFiltrados.Where<Lancamento>((Lancamento x) => {
- if (x.get_Selecionado() && x.get_Controle().get_Plano() != null)
- {
- return true;
- }
- if (!x.get_Historico().Equals("TRANSFERÊNCIA ENTRE CONTAS") || !x.get_Selecionado())
- {
- return false;
- }
- return x.get_Controle().get_Plano() == null;
- }).ToList<Lancamento>();
- if (list.Count == 0)
- {
- await base.ShowMessage("NÃO HÁ LANÇAMENTOS SELECIONADOS, SELECIONE-OS ANTES DE EXCLUIR A BAIXA.", "OK", "", false);
- }
- else if (await base.ShowMessage("DESEJA REAMENTE EXCLUIR A BAIXA DOS LANÇAMENTOS SELECIONADOS?", "SIM", "NÃO", false))
- {
- base.Loading(true);
- lancamentos = new List<Lancamento>();
- bool flag1 = false;
- foreach (Lancamento lancamento in list)
- {
- Saldo saldo = await this.VerificaSaldo(lancamento.get_Conta().get_Id(), false);
- if (saldo == null || !lancamento.get_Baixado())
- {
- continue;
- }
- DateTime? dataInicio = saldo.get_DataInicio();
- DateTime? baixa = lancamento.get_Baixa();
- flag = (dataInicio.HasValue & baixa.HasValue ? dataInicio.GetValueOrDefault() > baixa.GetValueOrDefault() : false);
- if (!flag)
- {
- baixa = null;
- lancamento.set_Baixa(baixa);
- lancamento.set_ValorPago(new decimal?(new decimal()));
- baixa = null;
- lancamento.set_Pagamento(baixa);
- lancamentos.Add(lancamento);
- lancamento = null;
- }
- else
- {
- flag1 = true;
- }
- }
- if (lancamentos.Count != 0)
- {
- bool flag2 = flag1;
- if (flag2)
- {
- flag2 = !await base.ShowMessage(string.Concat("HÁ LANÇAMENTOS SELECIONADOS QUE NÃO PODERÃO TER A BAIXA EXCLUÍDA. ", Environment.NewLine, "DESEJA PROSSEGUIR COM A EXCLUSÃO DA BAIXA DOS DEMAIS LANÇAMENTOS?"), "SIM", "NÃO", false);
- }
- if (!flag2)
- {
- await this._servico.Atualizar(lancamentos);
- if (this._servico.Sucesso)
- {
- base.ToggleSnackBar(string.Format("EXCLUSÃO DE BAIXA DE {0} DO TOTAL DE {1} LANÇAMENTOS SELECIONADOS REALIZADA COM SUCESSO.", lancamentos.Count, list.Count), true);
- await this.Buscar();
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- await base.ShowMessage("NÃO FOI POSSÍVEL FAZER A EXCLUSÃO, POIS NÃO HÁ LANÇAMENTOS BAIXADOS DENTRO DO ÚLTIMO SALDO ABERTO. PROCESSO INTERROMPIDO", "OK", "", false);
- base.Loading(false);
- }
- }
- list = null;
- lancamentos = null;
- }
-
- public void ExcluirFiltro(Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtro)
- {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = this.FiltroPersonalizadoSelecionado.First<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((Gestor.Model.Domain.Financeiro.FiltroPersonalizado x) => {
- if (x.get_Id() != filtro.get_Id())
- {
- return false;
- }
- return x.get_Tipo() == filtro.get_Tipo();
- });
- this.FiltroPersonalizadoSelecionado.Remove(filtroPersonalizado);
- this.FiltroPersonalizadoSelecionado = new ObservableCollection<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>(this.FiltroPersonalizadoSelecionado);
- this.FiltrarPersonalizado();
- }
-
- public async Task ExcluirRange()
- {
- int? nullable;
- bool flag1;
- List<Lancamento> lancamentos;
- ObservableCollection<Lancamento> lancamentosFiltrados = this.LancamentosFiltrados;
- List<Lancamento> list = (
- from x in lancamentosFiltrados
- where x.get_Selecionado()
- select x).ToList<Lancamento>();
- if (list.Count == 0)
- {
- await base.ShowMessage("NÃO HÁ LANÇAMENTOS SELECIONADOS, SELECIONE-OS ANTES DE EXCLUIR.", "OK", "", false);
- }
- else if (await base.ShowMessage("DESEJA REAMENTE EXCLUIR OS LANÇAMENTOS SELECIONADOS? ESSE PROCESSO É IRREVERSÍVEL.", "SIM", "NÃO", false))
- {
- base.Loading(true);
- List<Lancamento> lancamentos1 = new List<Lancamento>();
- ObservableCollection<Lancamento> observableCollection = this.LancamentosFiltrados;
- List<Lancamento> list1 = observableCollection.Where<Lancamento>((Lancamento x) => {
- if (!x.get_Selecionado())
- {
- return false;
- }
- return x.get_Historico().Equals("TRANSFERÊNCIA ENTRE CONTAS");
- }).ToList<Lancamento>();
- list1.ForEach((Lancamento x) => {
- Lancamento lancamento = list1.FirstOrDefault<Lancamento>((Lancamento z) => {
- if (z.get_Controle().get_Id() != this.x.get_Controle().get_Id() || !(this.x.get_Valor() == z.get_Valor()))
- {
- return false;
- }
- return this.x.get_Sinal() != z.get_Sinal();
- });
- if (lancamento == null || lancamentos1.Where<Lancamento>((Lancamento z) => {
- if ((object)z == (object)x)
- {
- return true;
- }
- return (object)z == (object)lancamento;
- }).ToList<Lancamento>().Count > 0)
- {
- return;
- }
- lancamentos1.AddRange(new List<Lancamento>()
- {
- x,
- lancamento
- });
- });
- List<Lancamento> lancamentos2 = list1;
- if (lancamentos2 != null)
- {
- nullable = new int?(lancamentos2.Count);
- }
- else
- {
- nullable = null;
- }
- int? nullable1 = nullable;
- int count = lancamentos1.Count;
- bool valueOrDefault = !(nullable1.GetValueOrDefault() == count & nullable1.HasValue);
- if (valueOrDefault)
- {
- valueOrDefault = !await base.ShowMessage(string.Concat("HÁ TRANSFERÊNCIA ENTRE CONTAS SELECIONADOS QUE NÃO PODERÃO TER A BAIXA EXCLUÍDA, PARA EXCLUIR É NECESSÁRIO SELECIONAR O DÉBITO E O CRÉDITO DA TRANSFERENCIA", Environment.NewLine, "DESEJA PROSSEGUIR COM A EXCLUSÃO DOS DEMAIS LANÇAMENTOS?"), "SIM", "NÃO", false);
- }
- if (!valueOrDefault)
- {
- bool flag2 = false;
- lancamentos = new List<Lancamento>();
- List<Lancamento> lancamentos3 = list;
- IOrderedEnumerable<Lancamento> id =
- from x in lancamentos3
- orderby x.get_Controle().get_Id()
- select x;
- foreach (Lancamento lancamento1 in id.ThenByDescending<Lancamento, int>((Lancamento x) => x.get_Parcela()).ToList<Lancamento>())
- {
- if (lancamento1.get_Baixado())
- {
- Saldo saldo = await this.VerificaSaldo(lancamento1.get_Conta().get_Id(), false);
- if (saldo == null)
- {
- continue;
- }
- DateTime? dataInicio = saldo.get_DataInicio();
- DateTime? baixa = lancamento1.get_Baixa();
- flag1 = (dataInicio.HasValue & baixa.HasValue ? dataInicio.GetValueOrDefault() > baixa.GetValueOrDefault() : false);
- if (flag1)
- {
- flag2 = true;
- continue;
- }
- }
- Lancamento lancamento2 = await this._servico.BuscarLancamento(lancamento1.get_Controle().get_Id(), lancamento1.get_Parcela() + 1);
- Lancamento lancamento3 = lancamento2;
- if (lancamento3 != null)
- {
- List<Lancamento> lancamentos4 = await this._servico.BuscarLancamentosPorControle(lancamento1.get_Controle().get_Id());
- lancamentos = lancamentos4.Where<Lancamento>((Lancamento c) => {
- if (c.get_Baixado())
- {
- return false;
- }
- return c.get_Parcela() >= lancamento1.get_Parcela() + 1;
- }).AsEnumerable<Lancamento>().ToList<Lancamento>();
- }
- if (lancamento3 == null || !lancamentos1.All<Lancamento>((Lancamento l) => l.get_Id() != lancamento3.get_Id()))
- {
- if (lancamento1.get_Controle().get_Plano() != null)
- {
- lancamentos1.Add(lancamento1);
- }
- }
- else
- {
- flag2 = true;
- }
- }
- if (lancamentos1.Count != 0 || lancamentos.Count != 0)
- {
- valueOrDefault = flag2;
- if (valueOrDefault)
- {
- valueOrDefault = !await base.ShowMessage(string.Concat("HÁ LANÇAMENTOS SELECIONADOS QUE NÃO PODERÃO SER EXCLUÍDOS. ", Environment.NewLine, "DESEJA PROSSEGUIR COM A EXCLUSÃO DOS DEMAIS LANÇAMENTOS?"), "SIM", "NÃO", false);
- }
- if (!valueOrDefault)
- {
- valueOrDefault = lancamentos.Count > 0;
- if (valueOrDefault)
- {
- valueOrDefault = await base.ShowMessage("DESEJA EXCLUIR LANÇAMENTOS/PARCELAS CADASTRADOS ACIMA DAS SELECIONADAS.", "SIM", "NÃO", false);
- }
- if (valueOrDefault)
- {
- lancamentos1.AddRange(lancamentos);
- }
- if (await this._servico.Excluir(lancamentos1))
- {
- if (lancamentos1 != null && lancamentos1.Count > 0)
- {
- lancamentos1.ForEach((Lancamento x) => {
- bool flag;
- FinanceiroViewModel u003cu003e4_this = this;
- string str = string.Format("EXCLUIU O LANÇAMENTO DO ID {0} HISTORICO: {1}", (x != null ? new long?(x.get_Id()) : null), (x != null ? x.get_Historico() : null));
- if (x != null)
- {
- x.get_Id();
- flag = false;
- }
- else
- {
- flag = true;
- }
- u003cu003e4_this.RegistrarAcao(str, (flag ? (long)0 : x.get_Id()), new TipoTela?(25), null);
- });
- }
- base.ToggleSnackBar(string.Format("EXCLUSÃO DE {0} DO TOTAL DE {1} LANÇAMENTOS SELECIONADOS REALIZADA COM SUCESSO.", lancamentos1.Count, list.Count), true);
- await this.Buscar();
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- base.Loading(false);
- }
- }
- else
- {
- await base.ShowMessage("OS LANÇAMENTOS SELECIONADOS NÃO PODEM SER EXCLUÍDOS. NENHUMA ALTERAÇÃO FOI FEITA", "OK", "", false);
- base.Loading(false);
- }
- }
- else
- {
- base.Loading(false);
- }
- }
- list = null;
- lancamentos = null;
- }
-
- public void Feed(Lancamento lancamento)
- {
- bool id;
- Fornecedor fornecedor;
- Gestor.Model.Domain.Financeiro.Planos plano;
- BancosContas bancosConta;
- if (lancamento == null || this.Salvando)
- {
- return;
- }
- if (!this.importando && lancamento.get_Controle().get_Plano() == null)
- {
- return;
- }
- Fornecedor fornecedor1 = lancamento.get_Controle().get_Fornecedor();
- if (fornecedor1 != null)
- {
- id = fornecedor1.get_Id() == (long)0;
- }
- else
- {
- id = false;
- }
- if (id)
- {
- fornecedor = null;
- }
- else
- {
- fornecedor = lancamento.get_Controle().get_Fornecedor();
- }
- this.FornecedorInclusao = fornecedor;
- if (lancamento.get_Controle().get_Plano() != null)
- {
- plano = this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == lancamento.get_Controle().get_Plano().get_Id());
- }
- else
- {
- plano = null;
- }
- this.Plano = plano;
- this.Centro = this.CentrosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>((Gestor.Model.Domain.Financeiro.Centro x) => x.get_Id() == lancamento.get_Controle().get_Centro().get_Id());
- if (lancamento.get_Conta() != null)
- {
- bancosConta = this.ContasFiltradas.FirstOrDefault<BancosContas>((BancosContas x) => x.get_Id() == lancamento.get_Conta().get_Id());
- }
- else
- {
- bancosConta = null;
- }
- this.Conta = bancosConta;
- this.TipoPagamento = lancamento.get_TipoPagamento();
- this.Historico = lancamento.get_Historico();
- this.Observacao = lancamento.get_Observacao();
- this.Complemento = lancamento.get_Complemento();
- this.Competencia = lancamento.get_Competencia();
- this.Documento = lancamento.get_Documento();
- this.Parcela = lancamento.get_Parcela();
- this.Parcelas = lancamento.get_Controle().get_Parcelas();
- this.Valor = lancamento.get_Valor();
- this.ValorPago = lancamento.get_ValorPago();
- this.Vencimento = lancamento.get_Vencimento();
- this.Pagamento = lancamento.get_Pagamento();
- this.Baixa = lancamento.get_Baixa();
- this.Sinal = lancamento.get_Sinal();
- this.CodigoBanco = lancamento.get_CodigoBanco();
- }
-
- public void FeedImportando(Lancamento lancamento)
- {
- BancosContas bancosConta;
- Gestor.Model.Domain.Financeiro.Planos plano;
- if (lancamento == null || this.Salvando)
- {
- return;
- }
- if (!this.importando && lancamento.get_Controle().get_Plano() == null)
- {
- return;
- }
- if (this.Conta == null)
- {
- bancosConta = this.ContasFiltradas.FirstOrDefault<BancosContas>((BancosContas x) => x.get_Id() == lancamento.get_Conta().get_Id());
- }
- else
- {
- bancosConta = null;
- }
- this.Conta = bancosConta;
- this.SelectedLancamento.set_Id(lancamento.get_Id());
- this.SelectedLancamento.get_Controle().set_Id(lancamento.get_Controle().get_Id());
- this.SelectedLancamento.get_Controle().set_Historico(lancamento.get_Controle().get_Historico());
- this.SelectedLancamento.set_Baixado(lancamento.get_Baixa().HasValue);
- decimal? valorPago = this.SelectedLancamento.get_ValorPago();
- this.IdLancamento = lancamento.get_Id();
- if (lancamento.get_Controle().get_Plano() != null)
- {
- plano = this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == lancamento.get_Controle().get_Plano().get_Id());
- }
- else
- {
- plano = null;
- }
- this.Plano = plano;
- this.Centro = this.CentrosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>((Gestor.Model.Domain.Financeiro.Centro x) => x.get_Id() == lancamento.get_Controle().get_Centro().get_Id());
- this.TipoPagamento = lancamento.get_TipoPagamento();
- this.Historico = lancamento.get_Historico();
- this.Observacao = lancamento.get_Observacao();
- this.Complemento = lancamento.get_Complemento();
- this.Documento = lancamento.get_Documento();
- this.Parcela = lancamento.get_Parcela();
- this.Parcelas = lancamento.get_Controle().get_Parcelas();
- this.Valor = lancamento.get_Valor();
- this.ValorPago = valorPago;
- this.Vencimento = lancamento.get_Vencimento();
- this.Pagamento = (lancamento.get_Pagamento().HasValue ? lancamento.get_Pagamento() : this.Pagamento);
- }
-
- public List<Lancamento> Filtrar(string filter)
- {
- this._dontSort = true;
- this.LancamentosFiltrados = (string.IsNullOrWhiteSpace(filter) ? this.Lancamentos : new ObservableCollection<Lancamento>(this.Lancamentos.Where<Lancamento>((Lancamento x) => {
- bool plano;
- bool centro;
- bool fornecedor;
- if ((x.get_Historico() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Historico().Trim()).Contains(filter)) && (x.get_Documento() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Documento().Trim()).Contains(filter)) && (x.get_Competencia() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Competencia().Trim()).Contains(filter)) && (x.get_Complemento() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Complemento().Trim()).Contains(filter)) && (x.get_Observacao() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Observacao().Trim()).Contains(filter)) && !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Vencimento().ToString(CultureInfo.CurrentCulture).Trim()).ToUpper().Contains(filter) && (!x.get_Baixa().HasValue || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Baixa().ToString().Trim()).ToUpper().Contains(filter)) && (!x.get_Pagamento().HasValue || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Pagamento().ToString().Trim()).ToUpper().Contains(filter)) && (x.get_Conta() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Conta().get_Descricao().Trim()).ToUpper().Contains(filter)) && (x.get_Controle().get_Historico() == null || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Controle().get_Historico().Trim()).ToUpper().Contains(filter)) && !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(EnumHelper.GetDescription<Gestor.Model.Common.Sinal>(x.get_Sinal()).Trim()).Contains(filter))
- {
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = false;
- }
- if (!plano || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Controle().get_Plano().get_Descricao().Trim()).ToUpper().Contains(filter))
- {
- x.get_TipoPagamento();
- if (!Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(EnumHelper.GetDescription<Gestor.Model.Common.TipoPagamento>(x.get_TipoPagamento()).Trim()).ToUpper().Contains(filter))
- {
- ControleFinanceiro controleFinanceiro = x.get_Controle();
- if (controleFinanceiro != null)
- {
- centro = controleFinanceiro.get_Centro();
- }
- else
- {
- centro = false;
- }
- if (!centro || !Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Controle().get_Centro().get_Descricao().Trim()).ToUpper().Contains(filter))
- {
- ControleFinanceiro controle1 = x.get_Controle();
- if (controle1 != null)
- {
- fornecedor = controle1.get_Fornecedor();
- }
- else
- {
- fornecedor = false;
- }
- if (!fornecedor)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Controle().get_Fornecedor().get_Nome().Trim()).ToUpper().Contains(filter);
- }
- }
- }
- }
- return true;
- })));
- this._dontSort = false;
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- return this.LancamentosFiltrados.ToList<Lancamento>();
- }
-
- public List<Lancamento> FiltrarLancamento(long id)
- {
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(
- from x in this.Lancamentos
- where x.get_Id() == id
- select x);
- return this.LancamentosFiltrados.ToList<Lancamento>();
- }
-
- public List<Lancamento> FiltrarLancamento(Lancamento lancamento)
- {
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(this.Lancamentos.Where<Lancamento>((Lancamento x) => {
- if (!(x.get_Valor() == lancamento.get_Valor()) || !(x.get_Vencimento() == lancamento.get_Vencimento()))
- {
- return false;
- }
- return x.get_Historico() == lancamento.get_Historico();
- }));
- return this.LancamentosFiltrados.ToList<Lancamento>();
- }
-
- public async Task<List<Lancamento>> FiltrarLancamento(string value)
- {
- List<Lancamento> lancamentos = await Task.Run<List<Lancamento>>(() => this.Filtrar(value));
- return lancamentos;
- }
-
- public void FiltrarPersonalizado()
- {
- List<long> nums = (this.FiltroPersonalizadoSelecionado != null ? (
- from x in this.FiltroPersonalizadoSelecionado
- where x.get_Tipo() == 0
- select x.get_Id()).ToList<long>() : new List<long>());
- List<long> nums1 = (this.FiltroPersonalizadoSelecionado != null ? (
- from x in this.FiltroPersonalizadoSelecionado
- where x.get_Tipo() == 2
- select x.get_Id()).ToList<long>() : new List<long>());
- List<long> nums2 = (this.FiltroPersonalizadoSelecionado != null ? (
- from x in this.FiltroPersonalizadoSelecionado
- where x.get_Tipo() == 1
- select x.get_Id()).ToList<long>() : new List<long>());
- List<long> nums3 = (this.FiltroPersonalizadoSelecionado != null ? (
- from x in this.FiltroPersonalizadoSelecionado
- where x.get_Tipo() == 3
- select x.get_Id()).ToList<long>() : new List<long>());
- List<long> nums4 = (this.FiltroPersonalizadoSelecionado != null ? (
- from x in this.FiltroPersonalizadoSelecionado
- where x.get_Tipo() == 4
- select x.get_Id()).ToList<long>() : new List<long>());
- List<Lancamento> list = this.Lancamentos.Where<Lancamento>((Lancamento x) => {
- if (nums.Count != 0 && (x.get_Controle().get_Fornecedor() == null || !nums.Contains(x.get_Controle().get_Fornecedor().get_Id())) || nums1.Count != 0 && (x.get_Controle().get_Centro() == null || !nums1.Contains(x.get_Controle().get_Centro().get_Id())) || nums2.Count != 0 && (x.get_Controle().get_Plano() == null || !nums2.Contains(x.get_Controle().get_Plano().get_Id())) || nums3.Count != 0 && (x.get_Conta() == null || !nums3.Contains(x.get_Conta().get_Id())))
- {
- return false;
- }
- if (nums4.Count == 0)
- {
- return true;
- }
- return nums4.Contains((long)x.get_Sinal());
- }).ToList<Lancamento>();
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(list);
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- this.SelectedLancamento = this.LancamentosFiltrados.FirstOrDefault<Lancamento>();
- }
-
- public List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> FiltrarPersonalizado(string filter)
- {
- if (this.FiltroPersonalizado == null)
- {
- this.PopularFiltro();
- }
- return (
- from x in this.FiltroPersonalizado
- where Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Descricao().Trim()).ToUpper().Contains(filter.ToUpper())
- select x).ToList<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- }
-
- public void FiltroImportacao()
- {
- if (!this.importando)
- {
- return;
- }
- switch (this.SelectedStatusImportacao)
- {
- case 0:
- {
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(
- from x in this.Lancamentos
- where !x.get_Baixado()
- select x);
- return;
- }
- case 1:
- {
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(
- from x in this.Lancamentos
- where x.get_Baixado()
- select x);
- return;
- }
- case 2:
- {
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(this.Lancamentos);
- return;
- }
- default:
- {
- return;
- }
- }
- }
-
- internal async Task<List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>> FiltroPersonalizadoTask(string value)
- {
- List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizados = await Task.Run<List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>>(() => this.FiltrarPersonalizado(value));
- return filtroPersonalizados;
- }
-
- public async Task GerarExcel(List<Lancamento> relatorioGrid)
- {
- List<string> list;
- string str1;
- FinanceiroViewModel.u003cu003ec__DisplayClass266_0 variable;
- bool flag = await base.ShowMessage(string.Concat("DESEJA AGRUPAR POR ", EnumHelper.GetDescription<SinteticoFinanceiroTipo>(this.SinteticoTipo)), "SIM", "NÃO", false);
- XLWorkbook xLWorkbook = new XLWorkbook();
- string str2 = "LANÇAMENTOS FINANCEIROS";
- List<RelatorioLancamentos> relatorioLancamentos = new List<RelatorioLancamentos>();
- List<Lancamento> lancamentos = new List<Lancamento>();
- List<Lancamento> lancamentos1 = relatorioGrid;
- bool flag1 = lancamentos1.Any<Lancamento>((Lancamento x) => x.get_Selecionado());
- relatorioGrid.ToList<Lancamento>().ForEach((Lancamento lancamentoGrid) => {
- decimal? valorPago;
- if (flag1 && !lancamentoGrid.get_Selecionado())
- {
- return;
- }
- Lancamento lancamento2 = (Lancamento)lancamentoGrid.Clone();
- lancamento2.set_Valor((lancamento2.get_Sinal() == 1 ? -lancamento2.get_Valor() : lancamento2.get_Valor()));
- Lancamento lancamento1 = lancamento2;
- if (lancamento2.get_Sinal() == 1)
- {
- decimal? nullable = lancamento2.get_ValorPago();
- valorPago = (nullable.HasValue ? new decimal?(-nullable.GetValueOrDefault()) : null);
- }
- else
- {
- valorPago = lancamento2.get_ValorPago();
- }
- lancamento1.set_ValorPago(valorPago);
- lancamentos.Add(lancamento2);
- });
- IEnumerable<IGrouping<string, Lancamento>> groupings = lancamentos.GroupBy<Lancamento, string>((Lancamento lancamento) => {
- object descricao;
- if (this.SinteticoTipo == 1)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = lancamento.get_Controle().get_Centro();
- if (centro != null)
- {
- descricao = centro.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- }
- else if (this.SinteticoTipo == null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = lancamento.get_Controle().get_Plano();
- if (plano != null)
- {
- descricao = plano.get_Nome();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- else
- {
- if (this.SinteticoTipo != 3)
- {
- Fornecedor fornecedor = lancamento.get_Controle().get_Fornecedor();
- if (fornecedor != null)
- {
- return fornecedor.get_Nome();
- }
- return null;
- }
- BancosContas conta = lancamento.get_Conta();
- if (conta != null)
- {
- descricao = conta.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- return descricao;
- });
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros = groupings.Select<IGrouping<string, Lancamento>, Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((IGrouping<string, Lancamento> lancamento) => {
- Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sinteticoFinanceiro = new Gestor.Model.Domain.Relatorios.SinteticoFinanceiro();
- sinteticoFinanceiro.set_Agrupamento(lancamento.Key ?? "TRANSFERÊNCIAS");
- sinteticoFinanceiro.set_Valor(new decimal?(lancamento.Sum<Lancamento>((Lancamento sintetic) => sintetic.get_Valor())));
- sinteticoFinanceiro.set_ValorPago(new decimal?(lancamento.Sum<Lancamento>((Lancamento sintetic) => sintetic.get_ValorPago()).GetValueOrDefault()));
- return sinteticoFinanceiro;
- }).ToList<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>();
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros1 = sinteticoFinanceiros;
- sinteticoFinanceiros = (
- from lancamento in sinteticoFinanceiros1
- orderby lancamento.get_Agrupamento()
- select lancamento).ToList<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>();
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros2 = sinteticoFinanceiros;
- Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sinteticoFinanceiro1 = new Gestor.Model.Domain.Relatorios.SinteticoFinanceiro();
- sinteticoFinanceiro1.set_Agrupamento("TOTAL");
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros3 = sinteticoFinanceiros;
- sinteticoFinanceiro1.set_Valor(sinteticoFinanceiros3.Sum<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sintetic) => sintetic.get_Valor()));
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros4 = sinteticoFinanceiros;
- sinteticoFinanceiro1.set_ValorPago(sinteticoFinanceiros4.Sum<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sintetic) => sintetic.get_ValorPago()));
- sinteticoFinanceiros2.Add(sinteticoFinanceiro1);
- xLWorkbook = await Funcoes.GerarXls<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>(xLWorkbook, "SINTÉTICO", sinteticoFinanceiros, null);
- if (!flag)
- {
- relatorioLancamentos = FinanceiroViewModel.GerarRelatorio(lancamentos);
- List<RelatorioLancamentos> relatorioLancamentos1 = relatorioLancamentos;
- RelatorioLancamentos relatorioLancamento = new RelatorioLancamentos();
- relatorioLancamento.set_Fornecedor("TOTAL");
- List<RelatorioLancamentos> relatorioLancamentos2 = relatorioLancamentos;
- relatorioLancamento.set_Valor(relatorioLancamentos2.Sum<RelatorioLancamentos>((RelatorioLancamentos lancamento) => lancamento.get_Valor()));
- List<RelatorioLancamentos> relatorioLancamentos3 = relatorioLancamentos;
- relatorioLancamento.set_ValorPago(relatorioLancamentos3.Sum<RelatorioLancamentos>((RelatorioLancamentos lancamento) => lancamento.get_ValorPago()));
- relatorioLancamentos1.Add(relatorioLancamento);
- xLWorkbook = await Funcoes.GerarXls<RelatorioLancamentos>(xLWorkbook, str2, relatorioLancamentos, null);
- }
- else
- {
- switch (this.SinteticoTipo)
- {
- case 0:
- {
- List<Lancamento> lancamentos2 = lancamentos;
- list = lancamentos2.Select<Lancamento, string>((Lancamento x) => {
- object descricao;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle.get_Plano();
- if (plano != null)
- {
- descricao = plano.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- return descricao;
- }).Distinct<string>().ToList<string>();
- foreach (string str3 in list)
- {
- List<Lancamento> list1 = lancamentos.Where<Lancamento>((Lancamento lancamento) => {
- string descricao;
- string str;
- if (string.IsNullOrWhiteSpace(str3))
- {
- ControleFinanceiro controle = lancamento.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle.get_Plano();
- if (plano != null)
- {
- str = plano.get_Descricao();
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- return string.IsNullOrEmpty(str);
- }
- ControleFinanceiro controleFinanceiro = lancamento.get_Controle();
- if (controleFinanceiro != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano1 = controleFinanceiro.get_Plano();
- if (plano1 != null)
- {
- descricao = plano1.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- }
- else
- {
- descricao = null;
- }
- return descricao == str3;
- }).ToList<Lancamento>();
- if (list1.Count == 0)
- {
- continue;
- }
- relatorioLancamentos = FinanceiroViewModel.GerarRelatorio(list1);
- List<RelatorioLancamentos> relatorioLancamentos4 = relatorioLancamentos;
- RelatorioLancamentos relatorioLancamento1 = new RelatorioLancamentos();
- relatorioLancamento1.set_Fornecedor("TOTAL");
- List<Lancamento> lancamentos3 = list1;
- relatorioLancamento1.set_Valor(lancamentos3.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_Valor()));
- List<Lancamento> lancamentos4 = list1;
- relatorioLancamento1.set_ValorPago(lancamentos4.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_ValorPago()));
- relatorioLancamentos4.Add(relatorioLancamento1);
- str1 = (!string.IsNullOrWhiteSpace(str3) ? str3.ValidaNomePlanilha("", 0) : "TRANSFERENCIAS");
- str2 = str1;
- xLWorkbook = await Funcoes.GerarXls<RelatorioLancamentos>(xLWorkbook, str2, relatorioLancamentos, null);
- }
- break;
- }
- case 1:
- {
- List<Lancamento> lancamentos5 = lancamentos;
- list = lancamentos5.Select<Lancamento, string>((Lancamento lancamento) => {
- object descricao;
- ControleFinanceiro controle = lancamento.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = controle.get_Centro();
- if (centro != null)
- {
- descricao = centro.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- return descricao;
- }).Distinct<string>().ToList<string>();
- foreach (string str4 in list)
- {
- List<Lancamento> list2 = lancamentos.Where<Lancamento>((Lancamento lanamento) => {
- string descricao;
- string str;
- if (string.IsNullOrWhiteSpace(str4))
- {
- ControleFinanceiro controle = lanamento.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = controle.get_Centro();
- if (centro != null)
- {
- str = centro.get_Descricao();
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- return string.IsNullOrEmpty(str);
- }
- ControleFinanceiro controleFinanceiro = lanamento.get_Controle();
- if (controleFinanceiro != null)
- {
- Gestor.Model.Domain.Financeiro.Centro centro1 = controleFinanceiro.get_Centro();
- if (centro1 != null)
- {
- descricao = centro1.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- }
- else
- {
- descricao = null;
- }
- return descricao == str4;
- }).ToList<Lancamento>();
- if (list2.Count == 0)
- {
- continue;
- }
- relatorioLancamentos = FinanceiroViewModel.GerarRelatorio(list2);
- List<RelatorioLancamentos> relatorioLancamentos5 = relatorioLancamentos;
- RelatorioLancamentos relatorioLancamento2 = new RelatorioLancamentos();
- relatorioLancamento2.set_Fornecedor("TOTAL");
- List<Lancamento> lancamentos6 = list2;
- relatorioLancamento2.set_Valor(lancamentos6.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_Valor()));
- List<Lancamento> lancamentos7 = list2;
- relatorioLancamento2.set_ValorPago(lancamentos7.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_ValorPago()));
- relatorioLancamentos5.Add(relatorioLancamento2);
- str2 = str4.ValidaNomePlanilha("", 0);
- xLWorkbook = await Funcoes.GerarXls<RelatorioLancamentos>(xLWorkbook, str2, relatorioLancamentos, null);
- }
- break;
- }
- case 2:
- {
- List<Lancamento> lancamentos8 = lancamentos;
- list = lancamentos8.Select<Lancamento, string>((Lancamento lancamento) => {
- object nome;
- ControleFinanceiro controle = lancamento.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- nome = fornecedor.get_Nome();
- }
- else
- {
- nome = null;
- }
- }
- else
- {
- nome = null;
- }
- if (nome == null)
- {
- nome = "";
- }
- return nome;
- }).Distinct<string>().ToList<string>();
- foreach (string str5 in list)
- {
- List<Lancamento> list3 = lancamentos.Where<Lancamento>((Lancamento lancamento) => {
- string nome;
- string str;
- if (string.IsNullOrWhiteSpace(str5))
- {
- ControleFinanceiro controle = lancamento.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- str = fornecedor.get_Nome();
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- return string.IsNullOrEmpty(str);
- }
- ControleFinanceiro controleFinanceiro = lancamento.get_Controle();
- if (controleFinanceiro != null)
- {
- Fornecedor fornecedor1 = controleFinanceiro.get_Fornecedor();
- if (fornecedor1 != null)
- {
- nome = fornecedor1.get_Nome();
- }
- else
- {
- nome = null;
- }
- }
- else
- {
- nome = null;
- }
- return nome == str5;
- }).ToList<Lancamento>();
- if (list3.Count == 0)
- {
- continue;
- }
- relatorioLancamentos = FinanceiroViewModel.GerarRelatorio(list3);
- List<RelatorioLancamentos> relatorioLancamentos6 = relatorioLancamentos;
- RelatorioLancamentos relatorioLancamento3 = new RelatorioLancamentos();
- relatorioLancamento3.set_Fornecedor("TOTAL");
- List<Lancamento> lancamentos9 = list3;
- relatorioLancamento3.set_Valor(lancamentos9.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_Valor()));
- List<Lancamento> lancamentos10 = list3;
- relatorioLancamento3.set_ValorPago(lancamentos10.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_ValorPago()));
- relatorioLancamentos6.Add(relatorioLancamento3);
- str2 = str5.ValidaNomePlanilha("", 0);
- xLWorkbook = await Funcoes.GerarXls<RelatorioLancamentos>(xLWorkbook, str2, relatorioLancamentos, null);
- }
- break;
- }
- case 3:
- {
- List<Lancamento> lancamentos11 = lancamentos;
- list = lancamentos11.Select<Lancamento, string>((Lancamento x) => {
- object descricao;
- BancosContas conta = x.get_Conta();
- if (conta != null)
- {
- descricao = conta.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- return descricao;
- }).Distinct<string>().ToList<string>();
- foreach (string str6 in list)
- {
- if (string.IsNullOrWhiteSpace(str6))
- {
- continue;
- }
- List<Lancamento> list4 = lancamentos.Where<Lancamento>((Lancamento lancamento) => {
- string descricao;
- string str;
- if (string.IsNullOrWhiteSpace(str6))
- {
- BancosContas conta = lancamento.get_Conta();
- if (conta != null)
- {
- str = conta.get_Descricao();
- }
- else
- {
- str = null;
- }
- return string.IsNullOrEmpty(str);
- }
- BancosContas bancosConta = lancamento.get_Conta();
- if (bancosConta != null)
- {
- descricao = bancosConta.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- return descricao == str6;
- }).ToList<Lancamento>();
- if (list4.Count == 0)
- {
- continue;
- }
- relatorioLancamentos = FinanceiroViewModel.GerarRelatorio(list4);
- List<RelatorioLancamentos> relatorioLancamentos7 = relatorioLancamentos;
- RelatorioLancamentos relatorioLancamento4 = new RelatorioLancamentos();
- relatorioLancamento4.set_Fornecedor("TOTAL");
- List<Lancamento> lancamentos12 = list4;
- relatorioLancamento4.set_Valor(lancamentos12.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_Valor()));
- List<Lancamento> lancamentos13 = list4;
- relatorioLancamento4.set_ValorPago(lancamentos13.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_ValorPago()));
- relatorioLancamentos7.Add(relatorioLancamento4);
- str2 = str6.ValidaNomePlanilha("", 0);
- xLWorkbook = await Funcoes.GerarXls<RelatorioLancamentos>(xLWorkbook, str2, relatorioLancamentos, null);
- }
- break;
- }
- }
- }
- string tempPath = "";
- string str7 = "";
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (!configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 41))
- {
- tempPath = Path.GetTempPath();
- str7 = string.Format("{0}{1}.xlsx", tempPath, Guid.NewGuid());
- }
- else
- {
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (DialogResult.OK == folderBrowserDialog.ShowDialog())
- {
- tempPath = string.Concat(folderBrowserDialog.SelectedPath, "\\");
- Directory.CreateDirectory(tempPath);
- }
- else
- {
- variable = null;
- str2 = null;
- return;
- }
- }
- string[] strArrays = new string[] { tempPath, str2, " ", null, null };
- DateTime date = Functions.GetNetworkTime().Date;
- strArrays[3] = date.ToShortDateString().Replace("/", "");
- strArrays[4] = ".xlsx";
- str7 = string.Concat(strArrays);
- }
- xLWorkbook.SaveAs(str7);
- Process.Start(str7);
- variable = null;
- str2 = null;
- }
-
- private async Task<string> GerarHtml(List<Lancamento> relatorioGrid, bool posicao = false)
- {
- DateTime dateTime;
- DateTime dateTime1;
- int num;
- string str1;
- TipoRelatorio tipoRelatorio = new TipoRelatorio();
- tipoRelatorio.set_Nome("RELATÓRIO FINANCEIRO");
- DateTime? inicio = this.Inicio;
- dateTime = (inicio.HasValue ? inicio.GetValueOrDefault() : DateTime.MinValue);
- tipoRelatorio.set_Inicio(dateTime);
- inicio = this.Fim;
- dateTime1 = (inicio.HasValue ? inicio.GetValueOrDefault() : DateTime.MinValue);
- tipoRelatorio.set_Fim(dateTime1);
- TipoRelatorio tipoRelatorio1 = tipoRelatorio;
- switch (this.SelectedFiltro)
- {
- case 0:
- {
- tipoRelatorio1.set_Nome("RELATORIO FINANCEIRO - VENCIMENTO");
- break;
- }
- case 1:
- {
- tipoRelatorio1.set_Nome("RELATORIO FINANCEIRO - BAIXA");
- break;
- }
- case 2:
- {
- tipoRelatorio1.set_Nome("RELATORIO FINANCEIRO - PAGAMENTO");
- break;
- }
- case 3:
- {
- tipoRelatorio1.set_Nome(this.SelectedFornecedor.get_Nome());
- tipoRelatorio1.set_Inicio(DateTime.MinValue);
- tipoRelatorio1.set_Fim(DateTime.MinValue);
- break;
- }
- }
- List<string> strs = Funcoes.OcultarColunasDescricao(typeof(Sintetico), "FINANCEIRO");
- List<Lancamento> lancamentos = new List<Lancamento>();
- List<Lancamento> lancamentos1 = relatorioGrid;
- bool flag = lancamentos1.Any<Lancamento>((Lancamento x) => x.get_Selecionado());
- relatorioGrid.ToList<Lancamento>().ForEach((Lancamento lancamentoGrid) => {
- decimal? valorPago;
- if (flag && !lancamentoGrid.get_Selecionado())
- {
- return;
- }
- Lancamento lancamento2 = (Lancamento)lancamentoGrid.Clone();
- lancamento2.set_Valor((lancamento2.get_Sinal() == 1 ? -lancamento2.get_Valor() : lancamento2.get_Valor()));
- Lancamento lancamento1 = lancamento2;
- if (lancamento2.get_Sinal() == 1)
- {
- decimal? nullable = lancamento2.get_ValorPago();
- valorPago = (nullable.HasValue ? new decimal?(-nullable.GetValueOrDefault()) : null);
- }
- else
- {
- valorPago = lancamento2.get_ValorPago();
- }
- lancamento1.set_ValorPago(valorPago);
- lancamentos.Add(lancamento2);
- });
- IEnumerable<IGrouping<string, Lancamento>> groupings = lancamentos.GroupBy<Lancamento, string>((Lancamento lancamento) => {
- object descricao;
- if (this.SinteticoTipo == 1)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = lancamento.get_Controle().get_Centro();
- if (centro != null)
- {
- descricao = centro.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- }
- else if (this.SinteticoTipo == null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = lancamento.get_Controle().get_Plano();
- if (plano != null)
- {
- descricao = plano.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- else
- {
- if (this.SinteticoTipo != 3)
- {
- Fornecedor fornecedor = lancamento.get_Controle().get_Fornecedor();
- if (fornecedor != null)
- {
- return fornecedor.get_Nome();
- }
- return null;
- }
- BancosContas conta = lancamento.get_Conta();
- if (conta != null)
- {
- descricao = conta.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- return descricao;
- });
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> list = groupings.Select<IGrouping<string, Lancamento>, Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((IGrouping<string, Lancamento> lancamento) => {
- Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sinteticoFinanceiro = new Gestor.Model.Domain.Relatorios.SinteticoFinanceiro();
- sinteticoFinanceiro.set_Agrupamento(lancamento.Key ?? "TRANSFERÊNCIAS");
- sinteticoFinanceiro.set_Valor(new decimal?(lancamento.Sum<Lancamento>((Lancamento sintetic) => sintetic.get_Valor())));
- sinteticoFinanceiro.set_ValorPago(new decimal?(lancamento.Sum<Lancamento>((Lancamento sintetic) => sintetic.get_ValorPago()).GetValueOrDefault()));
- return sinteticoFinanceiro;
- }).ToList<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>();
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros = list;
- list = (
- from lancamento in sinteticoFinanceiros
- orderby lancamento.get_Agrupamento()
- select lancamento).ToList<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>();
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros1 = list;
- Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sinteticoFinanceiro1 = new Gestor.Model.Domain.Relatorios.SinteticoFinanceiro();
- sinteticoFinanceiro1.set_Agrupamento("TOTAL");
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros2 = list;
- sinteticoFinanceiro1.set_Valor(sinteticoFinanceiros2.Sum<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sintetic) => sintetic.get_Valor()));
- List<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro> sinteticoFinanceiros3 = list;
- sinteticoFinanceiro1.set_ValorPago(sinteticoFinanceiros3.Sum<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>((Gestor.Model.Domain.Relatorios.SinteticoFinanceiro sintetic) => sintetic.get_ValorPago()));
- sinteticoFinanceiros1.Add(sinteticoFinanceiro1);
- string str2 = await Funcoes.GenerateTable<Gestor.Model.Domain.Relatorios.SinteticoFinanceiro>(list, strs, false, false, "", null);
- string str3 = Funcoes.CreateCard(string.Concat("SINTÉTICO ", EnumHelper.GetDescription<SinteticoFinanceiroTipo>(this.SinteticoTipo)), str2, false);
- IEnumerable<IGrouping<string, Lancamento>> groupings1 = lancamentos.GroupBy<Lancamento, string>((Lancamento lancamento) => {
- object descricao;
- if (this.SinteticoTipo == 1)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = lancamento.get_Controle().get_Centro();
- if (centro != null)
- {
- descricao = centro.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- descricao = "";
- }
- }
- else if (this.SinteticoTipo == null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = lancamento.get_Controle().get_Plano();
- if (plano != null)
- {
- descricao = plano.get_Nome();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- else
- {
- if (this.SinteticoTipo != 3)
- {
- Fornecedor fornecedor = lancamento.get_Controle().get_Fornecedor();
- if (fornecedor != null)
- {
- return fornecedor.get_Nome();
- }
- return null;
- }
- BancosContas conta = lancamento.get_Conta();
- if (conta != null)
- {
- descricao = conta.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- if (descricao == null)
- {
- return "";
- }
- }
- return descricao;
- });
- List<string> list1 = (
- from lancamento in groupings1
- select lancamento.Key).Distinct<string>().ToList<string>();
- foreach (string str4 in list1)
- {
- List<Lancamento> list2 = lancamentos.Where<Lancamento>((Lancamento lancamento) => {
- string descricao;
- string nome;
- string str;
- string nome1;
- if (this.SinteticoTipo == 1)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = lancamento.get_Controle().get_Centro();
- if (centro != null)
- {
- descricao = centro.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- return descricao == str4;
- }
- if (this.SinteticoTipo == null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = lancamento.get_Controle().get_Plano();
- if (plano != null)
- {
- nome = plano.get_Nome();
- }
- else
- {
- nome = null;
- }
- return nome == str4;
- }
- if (this.SinteticoTipo == 3)
- {
- BancosContas conta = lancamento.get_Conta();
- if (conta != null)
- {
- str = conta.get_Descricao();
- }
- else
- {
- str = null;
- }
- return str == str4;
- }
- Fornecedor fornecedor = lancamento.get_Controle().get_Fornecedor();
- if (fornecedor != null)
- {
- nome1 = fornecedor.get_Nome();
- }
- else
- {
- nome1 = null;
- }
- return nome1 == str4;
- }).ToList<Lancamento>();
- if (list2.Count == 0)
- {
- continue;
- }
- List<Lancamento> lancamentos2 = list2;
- Lancamento lancamento3 = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- Fornecedor fornecedor1 = new Fornecedor();
- fornecedor1.set_Nome("TOTAL");
- controleFinanceiro.set_Fornecedor(fornecedor1);
- lancamento3.set_Controle(controleFinanceiro);
- List<Lancamento> lancamentos3 = list2;
- lancamento3.set_Valor(lancamentos3.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_Valor()));
- List<Lancamento> lancamentos4 = list2;
- lancamento3.set_ValorPago(lancamentos4.Sum<Lancamento>((Lancamento lancamento) => lancamento.get_ValorPago()));
- lancamentos2.Add(lancamento3);
- string str5 = await Funcoes.GenerateTable<RelatorioLancamentos>(FinanceiroViewModel.GerarRelatorio(list2), new List<string>(), false, false, "", null);
- str3 = string.Concat(str3, Funcoes.CreateCard(str4, str5, false));
- }
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- num = (configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 14) ? 70 : 50);
- int num1 = num;
- TipoRelatorio tipoRelatorio2 = tipoRelatorio1;
- string str6 = str3;
- if (str6 == null)
- {
- str6 = "";
- }
- string str7 = num1.ToString();
- str1 = (posicao ? "landscape" : "portrait");
- string str8 = Funcoes.ExportarHtml(tipoRelatorio2, str6, str7, str1, false, "");
- tipoRelatorio1 = null;
- str3 = null;
- return str8;
- }
-
- private static List<RelatorioLancamentos> GerarRelatorio(List<Lancamento> lancamentos)
- {
- return lancamentos.Select<Lancamento, RelatorioLancamentos>((Lancamento x) => {
- string nome;
- string descricao;
- string str;
- string descricao1;
- string str1;
- string nome1;
- RelatorioLancamentos relatorioLancamento = new RelatorioLancamentos();
- Fornecedor fornecedor = x.get_Controle().get_Fornecedor();
- if (fornecedor != null)
- {
- nome = fornecedor.get_Nome();
- }
- else
- {
- nome = null;
- }
- relatorioLancamento.set_Fornecedor(nome);
- relatorioLancamento.set_Historico(x.get_Historico());
- relatorioLancamento.set_Observacao(x.get_Observacao());
- relatorioLancamento.set_Documento(x.get_Documento());
- relatorioLancamento.set_Parcela(x.get_Parcela());
- relatorioLancamento.set_Vencimento(x.get_Vencimento());
- relatorioLancamento.set_Valor(x.get_Valor());
- relatorioLancamento.set_Baixa(x.get_Baixa());
- relatorioLancamento.set_ValorPago(x.get_ValorPago());
- relatorioLancamento.set_Pagamento(x.get_Pagamento());
- Gestor.Model.Domain.Financeiro.Planos plano = x.get_Controle().get_Plano();
- if (plano != null)
- {
- descricao = plano.get_Descricao();
- }
- else
- {
- descricao = null;
- }
- relatorioLancamento.set_Plano(descricao);
- Gestor.Model.Domain.Financeiro.Planos plano1 = x.get_Controle().get_Plano();
- if (plano1 != null)
- {
- str = plano1.get_Plano().get_Descricao();
- }
- else
- {
- str = null;
- }
- relatorioLancamento.set_Planos(str);
- Gestor.Model.Domain.Financeiro.Centro centro = x.get_Controle().get_Centro();
- if (centro != null)
- {
- descricao1 = centro.get_Descricao();
- }
- else
- {
- descricao1 = null;
- }
- relatorioLancamento.set_Centro(descricao1);
- BancosContas conta = x.get_Conta();
- if (conta != null)
- {
- str1 = conta.get_Descricao();
- }
- else
- {
- str1 = null;
- }
- relatorioLancamento.set_Conta(str1);
- Fornecedor fornecedor1 = x.get_Controle().get_Fornecedor();
- if (fornecedor1 != null)
- {
- nome1 = fornecedor1.get_Nome();
- }
- else
- {
- nome1 = null;
- }
- relatorioLancamento.set_Sinal((nome1 == "TOTAL" ? "" : EnumHelper.GetDescription<Gestor.Model.Common.Sinal>(x.get_Sinal())));
- relatorioLancamento.set_Competencia(x.get_Competencia());
- return relatorioLancamento;
- }).ToList<RelatorioLancamentos>();
- }
-
- public void IncluirLancamento()
- {
- Gestor.Model.Common.TipoPagamento? nullable;
- bool hasValue;
- bool flag;
- bool hasValue1;
- Gestor.Model.Common.TipoPagamento? tipoPagamento;
- Gestor.Model.Common.Sinal sinal;
- this.Alterando = Visibility.Visible;
- this.BuscaHabilitada = false;
- Fornecedor selectedFornecedor = null;
- if (this.SelectedFiltro == 3 && this.SelectedFornecedor != null && this.SelectedFornecedor.get_Id() > (long)0)
- {
- selectedFornecedor = this.SelectedFornecedor;
- }
- this.VisibilityFornecedor = (selectedFornecedor == null ? Visibility.Visible : Visibility.Collapsed);
- Fornecedor fornecedor = selectedFornecedor;
- if (fornecedor != null)
- {
- hasValue = fornecedor.get_IdPlano().HasValue;
- }
- else
- {
- hasValue = false;
- }
- Gestor.Model.Domain.Financeiro.Planos plano = (hasValue ? this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => {
- long id = x.get_Id();
- long? idPlano = selectedFornecedor.get_IdPlano();
- return id == idPlano.GetValueOrDefault() & idPlano.HasValue;
- }) ?? this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>() : this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>());
- Fornecedor fornecedor1 = selectedFornecedor;
- if (fornecedor1 != null)
- {
- flag = fornecedor1.get_IdConta().HasValue;
- }
- else
- {
- flag = false;
- }
- BancosContas bancosConta = (flag ? this.ContasFiltradas.FirstOrDefault<BancosContas>((BancosContas x) => {
- long id = x.get_Id();
- long? idConta = selectedFornecedor.get_IdConta();
- return id == idConta.GetValueOrDefault() & idConta.HasValue;
- }) ?? this.ContasFiltradas.FirstOrDefault<BancosContas>() : this.ContasFiltradas.FirstOrDefault<BancosContas>());
- Fornecedor fornecedor2 = selectedFornecedor;
- if (fornecedor2 != null)
- {
- hasValue1 = fornecedor2.get_IdCentro().HasValue;
- }
- else
- {
- hasValue1 = false;
- }
- Gestor.Model.Domain.Financeiro.Centro centro = (hasValue1 ? this.CentrosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>((Gestor.Model.Domain.Financeiro.Centro x) => {
- long id = x.get_Id();
- long? idCentro = selectedFornecedor.get_IdCentro();
- return id == idCentro.GetValueOrDefault() & idCentro.HasValue;
- }) ?? this.CentrosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>() : this.CentrosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>());
- Fornecedor fornecedor3 = selectedFornecedor;
- if (fornecedor3 != null)
- {
- tipoPagamento = fornecedor3.get_TipoPagamento();
- }
- else
- {
- nullable = null;
- tipoPagamento = nullable;
- }
- nullable = tipoPagamento;
- Gestor.Model.Common.TipoPagamento valueOrDefault = nullable.GetValueOrDefault();
- DateTime date = Funcoes.GetNetworkTime().Date;
- Lancamento lancamento = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Fornecedor(selectedFornecedor);
- controleFinanceiro.set_Centro(centro);
- controleFinanceiro.set_Plano(plano);
- controleFinanceiro.set_Parcelas(1);
- lancamento.set_Controle(controleFinanceiro);
- lancamento.set_Conta(bancosConta);
- lancamento.set_Vencimento(date);
- lancamento.set_Parcela(1);
- lancamento.set_TipoPagamento(valueOrDefault);
- this.SelectedLancamento = lancamento;
- this.FornecedorInclusao = selectedFornecedor ?? new Fornecedor();
- this.Historico = "";
- this.Documento = "";
- this.Competencia = "";
- this.Complemento = "";
- this.Plano = plano;
- this.Centro = centro;
- this.Conta = bancosConta;
- Gestor.Model.Domain.Financeiro.Planos plano1 = this.Plano;
- if (plano1 != null)
- {
- sinal = plano1.get_Sinal();
- }
- else
- {
- sinal = 0;
- }
- this.Sinal = sinal;
- this.Parcelas = 1;
- this.Parcela = 0;
- this.Vencimento = date;
- this.Valor = decimal.Zero;
- DateTime? nullable1 = null;
- this.Baixa = nullable1;
- this.ValorPago = new decimal?(new decimal());
- nullable1 = null;
- this.Pagamento = nullable1;
- this.TipoPagamento = valueOrDefault;
- this.Observacao = "";
- this.Alteracao = false;
- this.VisibilityCentro = (this.CentrosFiltrados.Count > 1 ? Visibility.Visible : Visibility.Collapsed);
- this.VisibilityConta = (this.ContasFiltradas.Count > 1 ? Visibility.Visible : Visibility.Collapsed);
- }
-
- public async void IncluirParcela()
- {
- bool controle;
- Visibility visibility;
- Visibility visibility1;
- ObservableCollection<Lancamento> lancamentosFiltrados = this.LancamentosFiltrados;
- if (lancamentosFiltrados.Any<Lancamento>((Lancamento x) => x.get_Selecionado()))
- {
- ObservableCollection<Lancamento> observableCollection = this.LancamentosFiltrados;
- if (observableCollection.Count<Lancamento>((Lancamento x) => x.get_Selecionado()) == 1)
- {
- FinanceiroViewModel financeiroViewModel = this;
- ObservableCollection<Lancamento> lancamentosFiltrados1 = this.LancamentosFiltrados;
- financeiroViewModel.SelectedLancamento = lancamentosFiltrados1.FirstOrDefault<Lancamento>((Lancamento x) => x.get_Selecionado());
- }
- ObservableCollection<Lancamento> observableCollection1 = this.LancamentosFiltrados;
- if (observableCollection1.Count<Lancamento>((Lancamento x) => x.get_Selecionado()) <= 1)
- {
- Lancamento selectedLancamento = this.SelectedLancamento;
- if (selectedLancamento != null)
- {
- controle = selectedLancamento.get_Controle();
- }
- else
- {
- controle = false;
- }
- if (controle && this.SelectedLancamento.get_Controle().get_Id() != 0)
- {
- this.VisibilityFornecedor = Visibility.Collapsed;
- this.Alterando = Visibility.Visible;
- this.BuscaHabilitada = false;
- Lancamento lancamento = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Centro(this.SelectedLancamento.get_Controle().get_Centro());
- controleFinanceiro.set_Fornecedor(this.SelectedLancamento.get_Controle().get_Fornecedor());
- controleFinanceiro.set_Historico(this.SelectedLancamento.get_Controle().get_Historico());
- controleFinanceiro.set_Id(this.SelectedLancamento.get_Controle().get_Id());
- controleFinanceiro.set_Parcelas(this.SelectedLancamento.get_Controle().get_Parcelas() + 1);
- controleFinanceiro.set_Plano(this.SelectedLancamento.get_Controle().get_Plano());
- lancamento.set_Controle(controleFinanceiro);
- lancamento.set_Historico(this.SelectedLancamento.get_Historico());
- lancamento.set_Observacao(this.SelectedLancamento.get_Observacao());
- DateTime vencimento = this.SelectedLancamento.get_Vencimento();
- lancamento.set_Vencimento(vencimento.AddMonths(1));
- lancamento.set_Conta(this.SelectedLancamento.get_Conta());
- lancamento.set_Parcela(this.SelectedLancamento.get_Parcela() + 1);
- lancamento.set_Documento(this.SelectedLancamento.get_Documento());
- lancamento.set_Sinal(this.SelectedLancamento.get_Sinal());
- lancamento.set_TipoPagamento(this.SelectedLancamento.get_TipoPagamento());
- lancamento.set_Valor(this.SelectedLancamento.get_Valor());
- this.SelectedLancamento = lancamento;
- FinanceiroViewModel financeiroViewModel1 = this;
- visibility = (this.CentrosFiltrados.Count > 1 ? Visibility.Visible : Visibility.Collapsed);
- financeiroViewModel1.VisibilityCentro = visibility;
- FinanceiroViewModel financeiroViewModel2 = this;
- visibility1 = (this.ContasFiltradas.Count > 1 ? Visibility.Visible : Visibility.Collapsed);
- financeiroViewModel2.VisibilityConta = visibility1;
- }
- }
- else if (await base.ShowMessage("HÁ MAIS DE UM LANÇAMENTO SELECIONADO, DESEJA FAZER A INCLUSÃO DE NOVAS PARCELAS PARA TODOS OS LANÇAMENTOS SELECIONADOS?", "SIM", "NÃO", false))
- {
- await this.AdicionarParcelaRange();
- }
- }
- else
- {
- await base.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM LANCAMENTOS PARA INCLUIR UMA NOVA PARCELA.", "OK", "", false);
- }
- }
-
- public void LimparFiltros()
- {
- this.FiltroPersonalizadoSelecionado = null;
- this.VisibleFiltros = Visibility.Collapsed;
- }
-
- public void LimparLancamentos()
- {
- this.Lancamentos = new ObservableCollection<Lancamento>();
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>();
- this.LimparFiltros();
- }
-
- public async Task ParseOfx(BancosContas conta)
- {
- FinanceiroViewModel.u003cu003ec__DisplayClass256_1 variable = null;
- Func<string, bool> func2 = null;
- this.SelectedStatusImportacao = 2;
- this.Importando = true;
- this.VisibleFiltros = Visibility.Collapsed;
- List<OfxDocument> ofxDocuments = await base.ImportarOfx();
- if (ofxDocuments == null || ofxDocuments.Count == 0)
- {
- this.Importando = false;
- }
- else
- {
- List<string> strs = new List<string>()
- {
- "0237",
- "033"
- };
- List<Lancamento> lancamentos = new List<Lancamento>();
- foreach (OfxDocument ofxDocument in ofxDocuments)
- {
- Tuple<DateTime, DateTime> tuple = this.CorrigeLancamentos(ofxDocument, strs);
- ofxDocument.set_StatementStart(tuple.Item1);
- ofxDocument.set_StatementEnd(tuple.Item2);
- FinanceiroServico financeiroServico = this._servico;
- DateTime statementStart = ofxDocument.get_StatementStart();
- DateTime dateTime2 = statementStart.AddDays(-5);
- statementStart = ofxDocument.get_StatementEnd();
- List<Lancamento> lancamentos1 = await financeiroServico.BuscarLancamentos(dateTime2, statementStart.AddDays(5), conta.get_Id());
- List<Lancamento> lancamentos2 = lancamentos1;
- ofxDocument.get_Transactions().ForEach((Transaction t) => {
- DateTime dateTime1;
- bool length;
- string str;
- string str1;
- string str2;
- string str3;
- string str4;
- if (t.get_Date() < ofxDocument.get_StatementStart().AddDays(-5) && t.get_Date() < ofxDocument.get_StatementEnd().AddDays(5))
- {
- List<string> cSu0024u003cu003e8_locals1 = strs;
- Func<string, bool> u003cu003e9_2 = func2;
- if (u003cu003e9_2 == null)
- {
- FinanceiroViewModel.u003cu003ec__DisplayClass256_1 cSu0024u003cu003e8_locals2 = variable;
- Func<string, bool> func = (string c) => c == this.x.get_Account().get_BankId().Trim();
- Func<string, bool> func1 = func;
- cSu0024u003cu003e8_locals2.u003cu003e9__2 = func;
- u003cu003e9_2 = func1;
- }
- if (!cSu0024u003cu003e8_locals1.Any<string>(u003cu003e9_2))
- {
- return;
- }
- }
- Gestor.Model.Common.Sinal sinal = (t.get_Amount() < decimal.Zero ? 1 : 0);
- Lancamento lancamento = lancamentos2.FirstOrDefault<Lancamento>((Lancamento l) => {
- if ((!l.get_ValorPago().HasValue || !(Math.Abs(l.get_ValorPago().Value) > decimal.Zero) || !(Math.Abs(l.get_ValorPago().Value) == Math.Abs(t.get_Amount()))) && !(Math.Abs(l.get_Valor()) == Math.Abs(t.get_Amount())) || l.get_Sinal() != sinal || l.get_Documento() == null || !t.get_TransactionId().Contains(l.get_Documento()))
- {
- return false;
- }
- DateTime? pagamento = l.get_Pagamento();
- DateTime date = t.get_Date();
- if ((pagamento.HasValue ? pagamento.GetValueOrDefault() == date : false) || l.get_Vencimento() == t.get_Date())
- {
- return true;
- }
- DateTime vencimento = l.get_Vencimento();
- date = t.get_Date();
- if (vencimento < date.AddDays(-5))
- {
- return false;
- }
- DateTime dateTime = l.get_Vencimento();
- date = t.get_Date();
- return dateTime <= date.AddDays(5);
- });
- Gestor.Model.Common.TipoPagamento tipoPagamento = t.get_TransType().ParseTransactionType();
- string transactionId = t.get_TransactionId();
- length = (transactionId != null ? transactionId.Trim().Length > 50 : false);
- if (length)
- {
- string transactionId1 = t.get_TransactionId();
- if (transactionId1 != null)
- {
- string str5 = transactionId1.Trim();
- if (str5 != null)
- {
- str = str5.Substring(0, 50);
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- }
- else
- {
- string transactionId2 = t.get_TransactionId();
- if (transactionId2 != null)
- {
- str = transactionId2.Trim();
- }
- else
- {
- str = null;
- }
- }
- string str6 = str;
- if (lancamento == null)
- {
- Lancamento lancamento1 = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Fornecedor(null);
- controleFinanceiro.set_Centro(this.Centros.FirstOrDefault<Gestor.Model.Domain.Financeiro.Centro>());
- controleFinanceiro.set_Plano(null);
- controleFinanceiro.set_Parcelas(1);
- string memo = t.get_Memo();
- if (memo != null)
- {
- str1 = memo.Trim();
- }
- else
- {
- str1 = null;
- }
- controleFinanceiro.set_Historico(str1);
- lancamento1.set_Controle(controleFinanceiro);
- lancamento1.set_Valor(Math.Abs(t.get_Amount()));
- lancamento1.set_ValorPago(new decimal?(Math.Abs(t.get_Amount())));
- string memo1 = t.get_Memo();
- if (memo1 != null)
- {
- str2 = memo1.Trim();
- }
- else
- {
- str2 = null;
- }
- lancamento1.set_Historico(str2);
- lancamento1.set_Sinal((t.get_Amount() < decimal.Zero ? 1 : 0));
- lancamento1.set_Conta(conta);
- lancamento1.set_Vencimento(t.get_Date());
- lancamento1.set_Baixa(new DateTime?(t.get_Date()));
- lancamento1.set_Pagamento(new DateTime?(t.get_Date()));
- string transactionId3 = t.get_TransactionId();
- if (transactionId3 != null)
- {
- str3 = transactionId3.Trim();
- }
- else
- {
- str3 = null;
- }
- lancamento1.set_Documento(str3);
- lancamento1.set_TipoPagamento(tipoPagamento);
- dateTime1 = t.get_Date();
- lancamento1.set_Competencia(dateTime1.ToString("MM/yyyy"));
- lancamento1.set_Parcela(1);
- string transactionId4 = t.get_TransactionId();
- if (transactionId4 != null)
- {
- str4 = transactionId4.Trim();
- }
- else
- {
- str4 = null;
- }
- lancamento1.set_CodigoBanco(str4);
- lancamento1.set_Baixado(false);
- lancamento = lancamento1;
- }
- else
- {
- lancamento.set_Baixado(lancamento.get_Baixa().HasValue);
- lancamento.set_Conta(conta);
- lancamento.set_ValorPago(new decimal?(Math.Abs(t.get_Amount())));
- dateTime1 = t.get_Date();
- lancamento.set_Competencia(dateTime1.ToString("MM/yyyy"));
- lancamento.set_Baixa((!lancamento.get_Baixa().HasValue ? new DateTime?(t.get_Date()) : lancamento.get_Baixa()));
- lancamento.set_Pagamento((!lancamento.get_Pagamento().HasValue ? new DateTime?(t.get_Date()) : lancamento.get_Pagamento()));
- lancamento.set_Documento(str6);
- lancamento.set_CodigoBanco(t.get_TransactionId());
- lancamento.set_TipoPagamento((lancamento.get_TipoPagamento() == null ? tipoPagamento : lancamento.get_TipoPagamento()));
- }
- lancamentos.Add(lancamento);
- });
- }
- this.Lancamentos = new ObservableCollection<Lancamento>(lancamentos);
- this.LancamentosFiltrados = this.Lancamentos;
- ExtensionMethods.ForEach<Lancamento>(this.LancamentosFiltrados, (Lancamento x) => this.SelecionarLancamento(x));
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- }
- }
-
- public void PesquisaPersonalizada()
- {
- List<Gestor.Model.Domain.Relatorios.FiltroPersonalizado> list = (
- from x in this.PersonalizadoSelecionado
- where !x.get_Propriedade().Contains(".")
- select x).ToList<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>();
- List<Lancamento> list1 = this.Lancamentos.ToList<Lancamento>().CustomWhere<Lancamento>(list, false);
- (
- from x in this.PersonalizadoSelecionado
- where x.get_Propriedade().Contains(".")
- select x).ToList<Gestor.Model.Domain.Relatorios.FiltroPersonalizado>().ForEach((Gestor.Model.Domain.Relatorios.FiltroPersonalizado x) => {
- string str = x.get_Nome();
- if (str == "FORNECEDOR")
- {
- list1 = list1.Where<Lancamento>((Lancamento l) => {
- bool nomeSocial;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- nomeSocial = (fornecedor != null ? fornecedor.get_NomeSocial() : false);
- }
- else
- {
- nomeSocial = false;
- }
- if (!nomeSocial)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(l.get_Controle().get_Fornecedor().get_NomeSocial().ToLower().Trim()).Contains(Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(x.get_ValorIncial().ToLower().Trim()));
- }).ToList<Lancamento>();
- return;
- }
- if (str == "FORNECEDOR ATIVO")
- {
- if (x.get_ValorIncial().Trim().Equals("SIM"))
- {
- List<Lancamento> lancamentos = list1;
- Func<Lancamento, bool> u003cu003e9_3584 = FinanceiroViewModel.u003cu003ec.u003cu003e9__358_4;
- if (u003cu003e9_3584 == null)
- {
- u003cu003e9_3584 = (Lancamento l) => {
- bool flag;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- fornecedor.get_Ativo();
- flag = true;
- }
- else
- {
- flag = false;
- }
- }
- else
- {
- flag = false;
- }
- if (!flag)
- {
- return false;
- }
- return l.get_Controle().get_Fornecedor().get_Ativo();
- };
- FinanceiroViewModel.u003cu003ec.u003cu003e9__358_4 = u003cu003e9_3584;
- }
- list1 = lancamentos.Where<Lancamento>(u003cu003e9_3584).ToList<Lancamento>();
- return;
- }
- if (x.get_ValorIncial().Equals("NÃO"))
- {
- List<Lancamento> lancamentos1 = list1;
- Func<Lancamento, bool> u003cu003e9_3585 = FinanceiroViewModel.u003cu003ec.u003cu003e9__358_5;
- if (u003cu003e9_3585 == null)
- {
- u003cu003e9_3585 = (Lancamento l) => {
- bool flag;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- fornecedor.get_Ativo();
- flag = true;
- }
- else
- {
- flag = false;
- }
- }
- else
- {
- flag = false;
- }
- if (!flag)
- {
- return false;
- }
- return !l.get_Controle().get_Fornecedor().get_Ativo();
- };
- FinanceiroViewModel.u003cu003ec.u003cu003e9__358_5 = u003cu003e9_3585;
- }
- list1 = lancamentos1.Where<Lancamento>(u003cu003e9_3585).ToList<Lancamento>();
- return;
- }
- }
- else
- {
- if (str == "CONTA")
- {
- list1 = list1.Where<Lancamento>((Lancamento l) => {
- bool descricao;
- BancosContas conta = l.get_Conta();
- descricao = (conta != null ? conta.get_Descricao() : false);
- if (!descricao)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(l.get_Conta().get_Descricao().ToLower().Trim()).Contains(Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(x.get_ValorIncial().ToLower().Trim()));
- }).ToList<Lancamento>();
- return;
- }
- if (str == "PLANO DE CONTAS")
- {
- list1 = list1.Where<Lancamento>((Lancamento l) => {
- bool descricao;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle.get_Plano();
- descricao = (plano != null ? plano.get_Descricao() : false);
- }
- else
- {
- descricao = false;
- }
- if (!descricao)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(l.get_Controle().get_Plano().get_Descricao().ToLower().Trim()).Contains(Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(x.get_ValorIncial().ToLower().Trim()));
- }).ToList<Lancamento>();
- return;
- }
- if (str == "CENTRO DE CUSTO")
- {
- list1 = list1.Where<Lancamento>((Lancamento l) => {
- bool descricao;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Centro centro = controle.get_Centro();
- descricao = (centro != null ? centro.get_Descricao() : false);
- }
- else
- {
- descricao = false;
- }
- if (!descricao)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(l.get_Controle().get_Centro().get_Descricao().ToLower().Trim()).Contains(Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(x.get_ValorIncial().ToLower().Trim()));
- }).ToList<Lancamento>();
- return;
- }
- if (str != "PLANO")
- {
- return;
- }
- list1 = list1.Where<Lancamento>((Lancamento l) => {
- bool nome;
- ControleFinanceiro controle = l.get_Controle();
- if (controle != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle.get_Plano();
- nome = (plano != null ? plano.get_Nome() : false);
- }
- else
- {
- nome = false;
- }
- if (!nome)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(l.get_Controle().get_Plano().get_Nome().ToLower().Trim()).Contains(Gestor.Common.Validation.ValidationHelper.AlphanumericAndSpace(x.get_ValorIncial().ToLower().Trim()));
- }).ToList<Lancamento>();
- }
- });
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(list1);
- }
-
- public async void PopularFiltro()
- {
- if (this.FiltroPersonalizado == null || this.FiltroPersonalizado.Count <= 0)
- {
- this.FiltroPersonalizado = new List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- List<Fornecedor> fornecedors = await (new BaseServico()).BuscarFornecedor();
- List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> list = fornecedors.Select<Fornecedor, Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((Fornecedor x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Tipo(0);
- filtroPersonalizado.set_Descricao(string.Concat(x.get_Nome(), " ", x.get_Documento()));
- filtroPersonalizado.set_Id(x.get_Id());
- return filtroPersonalizado;
- }).ToList<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- this.FiltroPersonalizado.AddRange(list);
- List<Gestor.Model.Domain.Financeiro.Centro> centros = this.Centros;
- list = centros.Select<Gestor.Model.Domain.Financeiro.Centro, Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((Gestor.Model.Domain.Financeiro.Centro x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Tipo(2);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- filtroPersonalizado.set_Id(x.get_Id());
- return filtroPersonalizado;
- }).ToList<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- this.FiltroPersonalizado.AddRange(list);
- List<Gestor.Model.Domain.Financeiro.Planos> planos = this.Planos;
- list = planos.Select<Gestor.Model.Domain.Financeiro.Planos, Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((Gestor.Model.Domain.Financeiro.Planos x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Tipo(1);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- filtroPersonalizado.set_Id(x.get_Id());
- return filtroPersonalizado;
- }).ToList<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- this.FiltroPersonalizado.AddRange(list);
- List<BancosContas> contas = this.Contas;
- list = contas.Select<BancosContas, Gestor.Model.Domain.Financeiro.FiltroPersonalizado>((BancosContas x) => {
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado.set_Tipo(3);
- filtroPersonalizado.set_Descricao(x.get_Descricao());
- filtroPersonalizado.set_Id(x.get_Id());
- return filtroPersonalizado;
- }).ToList<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>();
- this.FiltroPersonalizado.AddRange(list);
- List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizados = this.FiltroPersonalizado;
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado1 = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado1.set_Descricao(EnumHelper.GetDescription<Gestor.Model.Common.Sinal>(0));
- filtroPersonalizado1.set_Id((long)0);
- filtroPersonalizado1.set_Tipo(4);
- filtroPersonalizados.Add(filtroPersonalizado1);
- List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado> filtroPersonalizados1 = this.FiltroPersonalizado;
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado filtroPersonalizado2 = new Gestor.Model.Domain.Financeiro.FiltroPersonalizado();
- filtroPersonalizado2.set_Descricao(EnumHelper.GetDescription<Gestor.Model.Common.Sinal>(1));
- filtroPersonalizado2.set_Id((long)1);
- filtroPersonalizado2.set_Tipo(4);
- filtroPersonalizados1.Add(filtroPersonalizado2);
- }
- }
-
- public async Task Print(List<Lancamento> relatorioGrid, bool posicao = false)
- {
- string tempPath = Path.GetTempPath();
- string str = await this.GerarHtml(relatorioGrid, posicao);
- string str1 = string.Format("{0}RELATORIO FINANCEIRO_{1:ddMMyyyyhhmmss}.html", tempPath, Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8);
- streamWriter.Write(str);
- streamWriter.Close();
- Process.Start(str1);
- tempPath = null;
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar(Transferencia transferencia)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = transferencia.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validar(transferencia));
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Historico("TRANSFERÊNCIA ENTRE CONTAS");
- controleFinanceiro.set_Parcelas(2);
- ControleFinanceiro controleFinanceiro1 = controleFinanceiro;
- Lancamento lancamento = new Lancamento();
- lancamento.set_Controle(controleFinanceiro1);
- lancamento.set_Historico("TRANSFERÊNCIA ENTRE CONTAS");
- lancamento.set_Vencimento(transferencia.get_Data());
- lancamento.set_Conta(transferencia.get_Origem());
- lancamento.set_Valor(transferencia.get_Valor());
- lancamento.set_ValorPago(new decimal?(transferencia.get_Valor()));
- lancamento.set_Pagamento(new DateTime?(transferencia.get_Data()));
- lancamento.set_Baixa(new DateTime?(transferencia.get_Data()));
- lancamento.set_Parcela(1);
- lancamento.set_Sinal(1);
- lancamento.set_TipoPagamento(11);
- Lancamento lancamento1 = lancamento;
- Lancamento lancamento2 = new Lancamento();
- lancamento2.set_Controle(controleFinanceiro1);
- lancamento2.set_Historico("TRANSFERÊNCIA ENTRE CONTAS");
- lancamento2.set_Vencimento(transferencia.get_Data());
- lancamento2.set_Conta(transferencia.get_Destino());
- lancamento2.set_Valor(transferencia.get_Valor());
- lancamento2.set_ValorPago(new decimal?(transferencia.get_Valor()));
- lancamento2.set_Pagamento(new DateTime?(transferencia.get_Data()));
- lancamento2.set_Baixa(new DateTime?(transferencia.get_Data()));
- lancamento2.set_Parcela(2);
- lancamento2.set_Sinal(0);
- lancamento2.set_TipoPagamento(11);
- if (await this._servico.Transferir(lancamento1, lancamento2))
- {
- await this.CarregarSaldos();
- base.ToggleSnackBar("TRANSFERÊNCIA REALIZADA COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- DateTime? nullable;
- DateTime vencimento;
- decimal? nullable1;
- DateTime? pagamento;
- DateTime? baixa;
- string str;
- long? nullable2;
- object historico;
- bool flag;
- long num;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedLancamento.Validate();
- if (keyValuePairs1 == null)
- {
- keyValuePairs1 = new List<KeyValuePair<string, string>>();
- }
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- List<KeyValuePair<string, string>> keyValuePairs3 = keyValuePairs2;
- keyValuePairs3.AddRange(await this.Validar());
- keyValuePairs3 = null;
- if (keyValuePairs2.Count > 0)
- {
- keyValuePairs = keyValuePairs2;
- }
- else if (this.SelectedLancamento.get_Controle().get_Id() != (long)0 || this.SelectedLancamento.get_Controle().get_Parcelas() <= 0)
- {
- if (this.SelectedLancamento.get_Controle().get_Id() == 0)
- {
- this.VencimentoAlterado = false;
- }
- this.SelectedLancamento = await this._servico.Save(this.SelectedLancamento);
- if (this.VencimentoAlterado && this.SelectedLancamento.get_Controle().get_Parcelas() > 1)
- {
- if (await base.ShowMessage("DESEJA ALTERAR O VENCIMENTO PARA OS PRÓXIMOS LANÇAMENTOS?", "SIM", "NÃO", false))
- {
- await this.AlterarLancamentos(this.SelectedLancamento, true, false);
- }
- this.VencimentoAlterado = false;
- }
- if (this.SelectedLancamento.get_Controle().get_Parcelas() > 1)
- {
- if (await base.ShowMessage("DESEJA ALTERAR O VALOR PARA OS PRÓXIMOS LANÇAMENTOS?", "SIM", "NÃO", false))
- {
- await this.AlterarLancamentos(this.SelectedLancamento, false, true);
- }
- }
- if (this._servico.Sucesso)
- {
- await this.Buscar();
- base.ToggleSnackBar("LANÇAMENTO SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- List<Lancamento> lancamentos = new List<Lancamento>();
- for (int i = 1; i <= this.SelectedLancamento.get_Controle().get_Parcelas(); i++)
- {
- Lancamento lancamento = new Lancamento();
- ControleFinanceiro controleFinanceiro = new ControleFinanceiro();
- controleFinanceiro.set_Centro(this.SelectedLancamento.get_Controle().get_Centro());
- controleFinanceiro.set_Fornecedor(this.SelectedLancamento.get_Controle().get_Fornecedor());
- controleFinanceiro.set_Historico(this.SelectedLancamento.get_Controle().get_Historico());
- controleFinanceiro.set_Id(this.SelectedLancamento.get_Controle().get_Id());
- controleFinanceiro.set_Parcelas(this.SelectedLancamento.get_Controle().get_Parcelas());
- controleFinanceiro.set_Plano(this.SelectedLancamento.get_Controle().get_Plano());
- lancamento.set_Controle(controleFinanceiro);
- lancamento.set_Historico(this.SelectedLancamento.get_Historico());
- lancamento.set_Observacao(this.SelectedLancamento.get_Observacao());
- lancamento.set_Complemento(this.SelectedLancamento.get_Complemento());
- lancamento.set_Competencia(this.SelectedLancamento.get_Competencia());
- if (i == 1)
- {
- vencimento = this.SelectedLancamento.get_Vencimento();
- }
- else
- {
- DateTime dateTime = this.SelectedLancamento.get_Vencimento();
- vencimento = dateTime.AddMonths(i - 1);
- }
- lancamento.set_Vencimento(vencimento);
- lancamento.set_Conta(this.SelectedLancamento.get_Conta());
- nullable1 = (i == 1 ? this.SelectedLancamento.get_ValorPago() : new decimal?(new decimal()));
- lancamento.set_ValorPago(nullable1);
- if (i == 1)
- {
- pagamento = this.SelectedLancamento.get_Pagamento();
- }
- else
- {
- nullable = null;
- pagamento = nullable;
- }
- lancamento.set_Pagamento(pagamento);
- if (i == 1)
- {
- baixa = this.SelectedLancamento.get_Baixa();
- }
- else
- {
- nullable = null;
- baixa = nullable;
- }
- lancamento.set_Baixa(baixa);
- lancamento.set_Parcela(i);
- str = (i == 1 ? this.SelectedLancamento.get_Documento() : "");
- lancamento.set_Documento(str);
- lancamento.set_Sinal(this.SelectedLancamento.get_Sinal());
- lancamento.set_TipoPagamento(this.SelectedLancamento.get_TipoPagamento());
- lancamento.set_Valor(this.SelectedLancamento.get_Valor());
- lancamentos.Add(lancamento);
- }
- List<Lancamento> lancamentos1 = await this._servico.AddRange(lancamentos);
- this.SelectedLancamento = lancamentos1.FirstOrDefault<Lancamento>();
- FinanceiroViewModel financeiroViewModel = this;
- Lancamento selectedLancamento = this.SelectedLancamento;
- if (selectedLancamento != null)
- {
- nullable2 = new long?(selectedLancamento.get_Id());
- }
- else
- {
- nullable2 = null;
- }
- object obj = nullable2;
- Lancamento selectedLancamento1 = this.SelectedLancamento;
- if (selectedLancamento1 != null)
- {
- historico = selectedLancamento1.get_Historico();
- }
- else
- {
- historico = null;
- }
- string str1 = string.Format("INSERIU O LANÇAMENTO DO ID {0} HISTORICO: {1}", obj, historico);
- Lancamento lancamento1 = this.SelectedLancamento;
- if (lancamento1 != null)
- {
- lancamento1.get_Id();
- flag = false;
- }
- else
- {
- flag = true;
- }
- num = (flag ? (long)0 : this.SelectedLancamento.get_Id());
- financeiroViewModel.RegistrarAcao(str1, num, new TipoTela?(25), null);
- this.VencimentoAlterado = false;
- keyValuePairs = null;
- }
- keyValuePairs2 = null;
- return keyValuePairs;
- }
-
- public async Task<bool> SalvarImportacao(List<Lancamento> list)
- {
- bool flag;
- DateTime? baixa;
- DateTime? nullable;
- string[] strArrays;
- bool flag1;
- bool flag2;
- string historico;
- object obj;
- bool flag3;
- long num;
- Lancamento lancamento = null;
- List<Lancamento> lancamentos = new List<Lancamento>();
- List<Lancamento> lancamentos1 = new List<Lancamento>();
- List<Lancamento> lancamentos2 = new List<Lancamento>();
- List<Lancamento> lancamentos3 = new List<Lancamento>();
- foreach (Lancamento lancamento in list)
- {
- if (lancamento.get_Baixado())
- {
- continue;
- }
- if (!lancamento.get_Selecionado())
- {
- baixa = null;
- lancamento.set_Baixa(baixa);
- }
- baixa = lancamento.get_Baixa();
- if (baixa.HasValue)
- {
- Saldo saldo = await this.VerificaSaldo(lancamento.get_Conta().get_Id(), false);
- if (saldo == null)
- {
- continue;
- }
- baixa = saldo.get_DataInicio();
- nullable = lancamento.get_Baixa();
- flag1 = (baixa.HasValue & nullable.HasValue ? baixa.GetValueOrDefault() > nullable.GetValueOrDefault() : false);
- if (flag1)
- {
- continue;
- }
- }
- string observacao = lancamento.get_Observacao();
- if (observacao != null)
- {
- strArrays = observacao.Split(new char[] { '\n' });
- }
- else
- {
- strArrays = null;
- }
- string[] strArrays1 = strArrays;
- StringBuilder stringBuilder = new StringBuilder();
- string str = "IMPORTAÇÃO OFX REALIZADA PELO USUÁRIO";
- if (strArrays1 != null)
- {
- string[] strArrays2 = strArrays1;
- for (int i = 0; i < (int)strArrays2.Length; i++)
- {
- string str1 = strArrays2[i];
- if (str1.IndexOf(str, StringComparison.InvariantCulture) != 0)
- {
- stringBuilder.Append(string.Concat(str1, "\n"));
- }
- }
- }
- Lancamento lancamento1 = lancamento;
- object[] id = new object[] { stringBuilder, Recursos.Usuario.get_Id(), Recursos.Usuario.get_Nome(), null };
- DateTime networkTime = Funcoes.GetNetworkTime();
- id[3] = networkTime.ToString("F").ToUpper();
- lancamento1.set_Observacao(string.Format("{0}IMPORTAÇÃO OFX REALIZADA PELO USUÁRIO {1} {2} EM {3}", id));
- if (lancamento.get_Id() <= (long)0)
- {
- lancamentos2.Add(lancamento);
- }
- else
- {
- nullable = lancamento.get_Baixa();
- if (!nullable.HasValue)
- {
- lancamentos.Add(lancamento);
- }
- else
- {
- lancamentos1.Add(lancamento);
- }
- }
- lancamentos3.Add(lancamento);
- }
- if (lancamentos3.Count != 0)
- {
- object[] count = new object[] { lancamentos2.Count, Environment.NewLine, lancamentos.Count, Environment.NewLine, lancamentos1.Count, Environment.NewLine, Environment.NewLine };
- if (await base.ShowMessage(string.Format("{0} LANÇAMENTOS SERÃO CRIADOS.{1}{2} LANÇAMENTOS SERÃO ATUALIZADOS.{3}{4} LANÇAMENTOS SERÃO BAIXADOS.{5}{6}DESEJA REALMENTE PROSSEGUIR?", count), "SIM", "NÃO", false))
- {
- bool flag4 = true;
- foreach (Lancamento lancamento2 in lancamentos3)
- {
- await this._servico.Save(lancamento2);
- flag4 = (flag4 ? this._servico.Sucesso : false);
- flag2 = (lancamento2 == null ? false : lancamento2.get_Id() != (long)0);
- if (flag2 & flag4)
- {
- FinanceiroViewModel financeiroViewModel = this;
- object id1 = lancamento2.get_Id();
- Lancamento lancamento3 = lancamento2;
- if (lancamento3 != null)
- {
- obj = lancamento3.get_Historico();
- }
- else
- {
- obj = null;
- }
- string str2 = string.Format("BAIXOU/ATUALIZOU O LANÇAMENTO DO ID {0}POR IMPORTAÇÃO HISTORICO: {1}", id1, obj);
- Lancamento lancamento4 = lancamento2;
- if (lancamento4 != null)
- {
- lancamento4.get_Id();
- flag3 = false;
- }
- else
- {
- flag3 = true;
- }
- num = (flag3 ? (long)0 : lancamento2.get_Id());
- financeiroViewModel.RegistrarAcao(str2, num, new TipoTela?(25), null);
- }
- else if (lancamento2 != null & flag4)
- {
- FinanceiroViewModel financeiroViewModel1 = this;
- Lancamento lancamento5 = lancamento2;
- if (lancamento5 != null)
- {
- historico = lancamento5.get_Historico();
- }
- else
- {
- historico = null;
- }
- financeiroViewModel1.RegistrarAcao(string.Concat("INSERIU O LANÇAMENTO POR IMPORTAÇÃO HISTORICO: ", historico), (long)0, new TipoTela?(25), null);
- }
- }
- if (flag4)
- {
- await this.Buscar();
- base.ToggleSnackBar("ATUALIZAÇÃO REALIZADA COM SUCESSO", true);
- await this.CarregarSaldos();
- flag = true;
- }
- else
- {
- await base.ShowMessage("HOUVERAM PROBLEMAS AO INCLUIR OU ATUALIZAR LANÇAMENTOS, FAVOR CONFERIR A IMPORTAÇÃO.", "OK", "", false);
- flag = false;
- }
- }
- else
- {
- base.Loading(false);
- flag = false;
- }
- }
- else
- {
- await base.ShowMessage("NÃO HÁ LANÇAMENTOS PARA SEREM ATUALIZADOS.", "OK", "", false);
- base.Loading(false);
- flag = false;
- }
- lancamentos = null;
- lancamentos1 = null;
- lancamentos2 = null;
- lancamentos3 = null;
- return flag;
- }
-
- public void SelecionarLancamento(Lancamento lancamento)
- {
- Lancamento lancamento1 = (lancamento.get_Id() > (long)0 ? this.LancamentosFiltrados.First<Lancamento>((Lancamento x) => x.get_Id() == lancamento.get_Id()) : this.LancamentosFiltrados.First<Lancamento>((Lancamento x) => {
- long? nullable;
- long? nullable1;
- long? nullable2;
- long? nullable3;
- long? nullable4;
- if (x.get_Id() == lancamento.get_Id())
- {
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- Fornecedor fornecedor = controle.get_Fornecedor();
- if (fornecedor != null)
- {
- nullable1 = new long?(fornecedor.get_Id());
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- long? nullable5 = nullable1;
- ControleFinanceiro controleFinanceiro = lancamento.get_Controle();
- if (controleFinanceiro != null)
- {
- Fornecedor fornecedor1 = controleFinanceiro.get_Fornecedor();
- if (fornecedor1 != null)
- {
- nullable2 = new long?(fornecedor1.get_Id());
- }
- else
- {
- nullable = null;
- nullable2 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable2 = nullable;
- }
- long? nullable6 = nullable2;
- if (nullable5.GetValueOrDefault() == nullable6.GetValueOrDefault() & nullable5.HasValue == nullable6.HasValue && x.get_Valor() == lancamento.get_Valor() && x.get_Vencimento() == lancamento.get_Vencimento())
- {
- ControleFinanceiro controle1 = x.get_Controle();
- if (controle1 != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano = controle1.get_Plano();
- if (plano != null)
- {
- nullable3 = new long?(plano.get_Id());
- }
- else
- {
- nullable = null;
- nullable3 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable3 = nullable;
- }
- nullable6 = nullable3;
- ControleFinanceiro controleFinanceiro1 = lancamento.get_Controle();
- if (controleFinanceiro1 != null)
- {
- Gestor.Model.Domain.Financeiro.Planos plano1 = controleFinanceiro1.get_Plano();
- if (plano1 != null)
- {
- nullable4 = new long?(plano1.get_Id());
- }
- else
- {
- nullable = null;
- nullable4 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable4 = nullable;
- }
- nullable5 = nullable4;
- if (nullable6.GetValueOrDefault() == nullable5.GetValueOrDefault() & nullable6.HasValue == nullable5.HasValue)
- {
- return lancamento.get_Documento() == x.get_Documento();
- }
- }
- }
- return false;
- }));
- DateTime date = Funcoes.GetNetworkTime().Date;
- lancamento1.set_Selecionado(true);
- Lancamento lancamento2 = lancamento1;
- DateTime? baixa = lancamento1.get_Baixa();
- lancamento2.set_Baixa(new DateTime?((baixa.HasValue ? baixa.GetValueOrDefault() : lancamento1.get_Pagamento().GetValueOrDefault(date))));
- baixa = lancamento1.get_Pagamento();
- lancamento1.set_Pagamento(new DateTime?(baixa.GetValueOrDefault(date)));
- Lancamento lancamento3 = lancamento1;
- decimal? valorPago = lancamento1.get_ValorPago();
- decimal num = new decimal();
- lancamento3.set_ValorPago(((valorPago.GetValueOrDefault() == num) & valorPago.HasValue ? new decimal?(lancamento.get_Valor()) : lancamento1.get_ValorPago()));
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- this.Totalizar();
- }
-
- public void SelecionarTodos()
- {
- List<Lancamento> list = this.LancamentosFiltrados.ToList<Lancamento>();
- list.ForEach((Lancamento x) => {
- DateTime? baixa;
- decimal num;
- x.set_Selecionado(!x.get_Selecionado());
- if (x.get_Baixado() || this.importando)
- {
- return;
- }
- if (!x.get_Selecionado())
- {
- baixa = null;
- x.set_Baixa(baixa);
- baixa = null;
- x.set_Pagamento(baixa);
- num = new decimal();
- x.set_ValorPago(new decimal?(num));
- return;
- }
- DateTime date = Funcoes.GetNetworkTime().Date;
- Lancamento lancamento = x;
- baixa = x.get_Baixa();
- lancamento.set_Baixa((!baixa.HasValue ? new DateTime?(date) : x.get_Baixa()));
- x.set_Baixa(new DateTime?(date));
- Lancamento lancamento1 = x;
- baixa = x.get_Pagamento();
- lancamento1.set_Pagamento((!baixa.HasValue ? new DateTime?(date) : x.get_Pagamento()));
- Lancamento lancamento2 = x;
- decimal? valorPago = x.get_ValorPago();
- num = new decimal();
- lancamento2.set_ValorPago(((valorPago.GetValueOrDefault() == num) & valorPago.HasValue ? new decimal?(x.get_Valor()) : x.get_ValorPago()));
- });
- this.LancamentosFiltrados = new ObservableCollection<Lancamento>(list);
- this.LancamentosFiltradosCopia = this.LancamentosFiltrados;
- }
-
- public void Sintetizar()
- {
- List<Sintetico> list;
- switch (this.SinteticoTipo)
- {
- case 1:
- {
- list = (
- from x in this.LancamentosFiltrados
- where x.get_Controle().get_Plano() != null
- group x by new { Id = x.get_Controle().get_Centro().get_Id(), Descricao = x.get_Controle().get_Centro().get_Descricao() }).Select((x) => {
- Sintetico sintetico = new Sintetico();
- sintetico.set_Agrupamento(x.Key.Descricao);
- sintetico.set_Valor(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- })));
- sintetico.set_ValorPago(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- })));
- return sintetico;
- }).ToList<Sintetico>();
- break;
- }
- case 2:
- {
- list = (
- from x in this.LancamentosFiltrados
- where x.get_Controle().get_Plano() != null
- group x by new { Id = x.get_Controle().get_Fornecedor().get_Id(), Nome = x.get_Controle().get_Fornecedor().get_Nome() }).Select((x) => {
- Sintetico sintetico = new Sintetico();
- sintetico.set_Agrupamento(x.Key.Nome);
- sintetico.set_Valor(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- })));
- sintetico.set_ValorPago(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- })));
- return sintetico;
- }).ToList<Sintetico>();
- break;
- }
- case 3:
- {
- list = (
- from x in this.LancamentosFiltrados
- where x.get_Controle().get_Plano() != null
- group x by new { Id = x.get_Conta().get_Id(), Descricao = x.get_Conta().get_Descricao() }).Select((x) => {
- Sintetico sintetico = new Sintetico();
- sintetico.set_Agrupamento(x.Key.Descricao);
- sintetico.set_Valor(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- })));
- sintetico.set_ValorPago(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- })));
- return sintetico;
- }).ToList<Sintetico>();
- break;
- }
- case 4:
- {
- list = this.LancamentosFiltrados.Where<Lancamento>((Lancamento x) => {
- if (x.get_Controle().get_Plano() == null)
- {
- return false;
- }
- return x.get_Controle().get_Plano().get_Plano() != null;
- }).GroupBy((Lancamento x) => new { Id = x.get_Controle().get_Plano().get_Plano().get_Id(), Descricao = x.get_Controle().get_Plano().get_Plano().get_Descricao() }).Select((x) => {
- Sintetico sintetico = new Sintetico();
- sintetico.set_Agrupamento(x.Key.Descricao);
- sintetico.set_Valor(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- })));
- sintetico.set_ValorPago(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- })));
- return sintetico;
- }).ToList<Sintetico>();
- break;
- }
- default:
- {
- list = (
- from x in this.LancamentosFiltrados
- where x.get_Controle().get_Plano() != null
- group x by new { Id = x.get_Controle().get_Plano().get_Id(), Descricao = x.get_Controle().get_Plano().get_Descricao() }).Select((x) => {
- Sintetico sintetico = new Sintetico();
- sintetico.set_Agrupamento(x.Key.Descricao);
- sintetico.set_Valor(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- })));
- sintetico.set_ValorPago(new decimal?(x.Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- })));
- return sintetico;
- }).ToList<Sintetico>();
- break;
- }
- }
- if (list.Count == 0)
- {
- return;
- }
- (new SinteticoView(list, "RELATORIO FINANCEIRO", this.Inicio, this.Fim)).Show();
- }
-
- public void Totalizar()
- {
- if (this.LancamentosFiltrados == null)
- {
- this.Totalizacao = null;
- return;
- }
- List<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro> list = (
- from x in this.LancamentosFiltrados
- where x.get_Conta() != null
- group x by new { Id = x.get_Conta().get_Id(), Descricao = x.get_Conta().get_Descricao() }).Select((x) => {
- Gestor.Model.Domain.Financeiro.SinteticoFinanceiro sinteticoFinanceiro = new Gestor.Model.Domain.Financeiro.SinteticoFinanceiro();
- BancosContas bancosConta = new BancosContas();
- bancosConta.set_Id(x.Key.Id);
- bancosConta.set_Descricao(x.Key.Descricao);
- sinteticoFinanceiro.set_Conta(bancosConta);
- sinteticoFinanceiro.set_Filtrados(x.Count<Lancamento>());
- sinteticoFinanceiro.set_Credito(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() != null)
- {
- return decimal.Zero;
- }
- return s.get_Valor();
- }));
- sinteticoFinanceiro.set_Debito(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return decimal.Zero;
- }
- return -s.get_Valor();
- }));
- sinteticoFinanceiro.set_Liquido(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_Valor();
- }
- return -s.get_Valor();
- }));
- sinteticoFinanceiro.set_LiquidoPago(x.Sum<Lancamento>((Lancamento s) => {
- if (s.get_Sinal() == null)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- if (!valorPago.HasValue)
- {
- return null;
- }
- return new decimal?(-valorPago.GetValueOrDefault());
- }).GetValueOrDefault());
- sinteticoFinanceiro.set_Selecionados(x.Count<Lancamento>((Lancamento s) => s.get_Selecionado()));
- sinteticoFinanceiro.set_LiquidoSelecionados((
- from s in x
- where s.get_Selecionado()
- select s).Sum<Lancamento>((Lancamento s) => {
- decimal? valorPago;
- decimal? nullable;
- if (s.get_Sinal() == null)
- {
- valorPago = s.get_ValorPago();
- return valorPago.GetValueOrDefault();
- }
- decimal? valorPago1 = s.get_ValorPago();
- if (valorPago1.HasValue)
- {
- nullable = new decimal?(-valorPago1.GetValueOrDefault());
- }
- else
- {
- valorPago = null;
- nullable = valorPago;
- }
- valorPago = nullable;
- return valorPago.GetValueOrDefault();
- }));
- return sinteticoFinanceiro;
- }).ToList<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>();
- if (list.Count > 1)
- {
- List<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro> sinteticoFinanceiros = list;
- Gestor.Model.Domain.Financeiro.SinteticoFinanceiro sinteticoFinanceiro1 = new Gestor.Model.Domain.Financeiro.SinteticoFinanceiro();
- BancosContas bancosConta1 = new BancosContas();
- bancosConta1.set_Id((long)0);
- bancosConta1.set_Descricao("TOTAL");
- sinteticoFinanceiro1.set_Conta(bancosConta1);
- sinteticoFinanceiro1.set_Filtrados(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_Filtrados()));
- sinteticoFinanceiro1.set_Credito(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_Credito()));
- sinteticoFinanceiro1.set_Debito(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_Debito()));
- sinteticoFinanceiro1.set_Liquido(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_Liquido()));
- sinteticoFinanceiro1.set_LiquidoPago(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_LiquidoPago()));
- sinteticoFinanceiro1.set_Selecionados(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_Selecionados()));
- sinteticoFinanceiro1.set_LiquidoSelecionados(list.Sum<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>((Gestor.Model.Domain.Financeiro.SinteticoFinanceiro x) => x.get_LiquidoSelecionados()));
- sinteticoFinanceiros.Add(sinteticoFinanceiro1);
- }
- this.Totalizacao = new ObservableCollection<Gestor.Model.Domain.Financeiro.SinteticoFinanceiro>(list);
- }
-
- private async Task<List<KeyValuePair<string, string>>> Validar(Transferencia transferencia)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- DateTime? dataFinal;
- DateTime data;
- bool origem;
- bool destino;
- bool flag;
- bool flag1;
- bool flag2;
- bool hasValue;
- List<Saldo> saldos1;
- Saldo saldo;
- List<KeyValuePair<string, string>> keyValuePairs1 = Gestor.Model.Helper.ValidationHelper.AddValue();
- BancosContasServico bancosContasServico = new BancosContasServico();
- Transferencia transferencium = transferencia;
- if (transferencium != null)
- {
- origem = transferencium.get_Origem();
- }
- else
- {
- origem = false;
- }
- if (origem)
- {
- Transferencia transferencium1 = transferencia;
- if (transferencium1 != null)
- {
- destino = transferencium1.get_Destino();
- }
- else
- {
- destino = false;
- }
- if (destino)
- {
- List<long> nums = new List<long>()
- {
- transferencia.get_Origem().get_Id(),
- transferencia.get_Destino().get_Id()
- };
- saldos1 = await bancosContasServico.BuscarSaldoAberto(nums);
- saldo = saldos1.FirstOrDefault<Saldo>((Saldo s) => s.get_Conta().get_Id() == transferencia.get_Origem().get_Id());
- if (saldo == null)
- {
- List<Saldo> saldos2 = await bancosContasServico.BuscarSaldos(transferencia.get_Origem().get_Id());
- List<Saldo> saldos3 = saldos2;
- Saldo saldo1 = saldos3.Find((Saldo x) => {
- DateTime? dataInicio = x.get_DataInicio();
- List<Saldo> saldos = saldos3;
- Func<Saldo, DateTime?> u003cu003e9_3863 = FinanceiroViewModel.u003cu003ec.u003cu003e9__386_3;
- if (u003cu003e9_3863 == null)
- {
- u003cu003e9_3863 = (Saldo r) => r.get_DataInicio();
- FinanceiroViewModel.u003cu003ec.u003cu003e9__386_3 = u003cu003e9_3863;
- }
- DateTime? nullable = saldos.Max<Saldo, DateTime?>(u003cu003e9_3863);
- if (dataInicio.HasValue != nullable.HasValue)
- {
- return false;
- }
- if (!dataInicio.HasValue)
- {
- return true;
- }
- return dataInicio.GetValueOrDefault() == nullable.GetValueOrDefault();
- });
- dataFinal = saldo1.get_DataInicio();
- data = transferencia.get_Data();
- flag2 = (dataFinal.HasValue ? dataFinal.GetValueOrDefault() <= data : false);
- if (!flag2)
- {
- hasValue = false;
- }
- else
- {
- dataFinal = saldo1.get_DataFinal();
- hasValue = dataFinal.HasValue;
- }
- bool flag3 = hasValue;
- if (flag3)
- {
- flag3 = await base.ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA E CONTINUAR?", "SIM", "NÃO", false);
- }
- if (flag3)
- {
- dataFinal = null;
- saldo1.set_DataFinal(dataFinal);
- saldo1.set_ValorFinal(null);
- saldo = await bancosContasServico.Save(saldo1);
- }
- saldo1 = null;
- }
- if (saldo != null)
- {
- dataFinal = saldo.get_DataInicio();
- data = transferencia.get_Data();
- flag1 = (dataFinal.HasValue ? dataFinal.GetValueOrDefault() > data : false);
- if (!flag1)
- {
- goto Label0;
- }
- }
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "SALDO", string.Concat("NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO PARA A CONTA ", transferencia.get_Origem().get_Descricao(), "."), true);
- Label0:
- saldo = saldos1.FirstOrDefault<Saldo>((Saldo s) => s.get_Conta().get_Id() == transferencia.get_Destino().get_Id());
- if (saldo != null)
- {
- dataFinal = saldo.get_DataInicio();
- data = transferencia.get_Data();
- flag = (dataFinal.HasValue ? dataFinal.GetValueOrDefault() > data : false);
- if (!flag)
- {
- goto Label1;
- }
- }
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "SALDO", string.Concat("NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO PARA A CONTA ", transferencia.get_Destino().get_Descricao(), "."), true);
- Label1:
- keyValuePairs = keyValuePairs1;
- }
- else
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "DESTINO", "NÃO É POSSÍVEL FAZER UMA TRANSFERÊNCIA SEM BANDO DESTINO", true);
- keyValuePairs = keyValuePairs1;
- }
- }
- else
- {
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "ORIGEM", "NÃO É POSSÍVEL FAZER UMA TRANSFERÊNCIA SEM BANDO ORIGEM", true);
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- bancosContasServico = null;
- saldos1 = null;
- saldo = null;
- return keyValuePairs;
- }
-
- private async Task<List<KeyValuePair<string, string>>> Validar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- DateTime? baixa;
- DateTime? dataFinal;
- bool flag;
- bool flag1;
- bool flag2;
- bool hasValue;
- List<KeyValuePair<string, string>> keyValuePairs1 = Gestor.Model.Helper.ValidationHelper.AddValue();
- BancosContasServico bancosContasServico = new BancosContasServico();
- BancosContasServico bancosContasServico1 = bancosContasServico;
- List<BancosContas> contas = this.Contas;
- List<Saldo> saldos1 = await bancosContasServico1.BuscarSaldoAberto((
- from x in contas
- select x.get_Id()).ToList<long>());
- Saldo saldo = saldos1.FirstOrDefault<Saldo>((Saldo s) => {
- long? nullable;
- long? nullable1;
- long id = s.get_Conta().get_Id();
- Lancamento selectedLancamento = this.SelectedLancamento;
- if (selectedLancamento != null)
- {
- BancosContas conta = selectedLancamento.get_Conta();
- if (conta != null)
- {
- nullable1 = new long?(conta.get_Id());
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- }
- else
- {
- nullable = null;
- nullable1 = nullable;
- }
- long? nullable2 = nullable1;
- return id == nullable2.GetValueOrDefault() & nullable2.HasValue;
- });
- if (saldo == null)
- {
- Lancamento lancamento = this.SelectedLancamento;
- if (lancamento != null)
- {
- flag1 = lancamento.get_Conta();
- }
- else
- {
- flag1 = false;
- }
- if (flag1)
- {
- List<Saldo> saldos2 = await bancosContasServico.BuscarSaldos(this.SelectedLancamento.get_Conta().get_Id());
- List<Saldo> saldos3 = saldos2;
- Saldo saldo1 = saldos3.Find((Saldo x) => {
- DateTime? dataInicio = x.get_DataInicio();
- List<Saldo> saldos = saldos3;
- Func<Saldo, DateTime?> u003cu003e9_3893 = FinanceiroViewModel.u003cu003ec.u003cu003e9__389_3;
- if (u003cu003e9_3893 == null)
- {
- u003cu003e9_3893 = (Saldo r) => r.get_DataInicio();
- FinanceiroViewModel.u003cu003ec.u003cu003e9__389_3 = u003cu003e9_3893;
- }
- DateTime? nullable = saldos.Max<Saldo, DateTime?>(u003cu003e9_3893);
- if (dataInicio.HasValue != nullable.HasValue)
- {
- return false;
- }
- if (!dataInicio.HasValue)
- {
- return true;
- }
- return dataInicio.GetValueOrDefault() == nullable.GetValueOrDefault();
- });
- baixa = saldo1.get_DataInicio();
- dataFinal = this.SelectedLancamento.get_Baixa();
- flag2 = (baixa.HasValue & dataFinal.HasValue ? baixa.GetValueOrDefault() <= dataFinal.GetValueOrDefault() : false);
- if (!flag2)
- {
- hasValue = false;
- }
- else
- {
- dataFinal = saldo1.get_DataFinal();
- hasValue = dataFinal.HasValue;
- }
- bool flag3 = hasValue;
- if (flag3)
- {
- flag3 = await base.ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA E CONTINUAR?", "SIM", "NÃO", false);
- }
- if (flag3)
- {
- dataFinal = null;
- saldo1.set_DataFinal(dataFinal);
- saldo1.set_ValorFinal(null);
- saldo = await bancosContasServico.Save(saldo1);
- }
- saldo1 = null;
- }
- }
- if (saldo != null)
- {
- dataFinal = saldo.get_DataInicio();
- baixa = this.SelectedLancamento.get_Baixa();
- flag = (dataFinal.HasValue & baixa.HasValue ? dataFinal.GetValueOrDefault() > baixa.GetValueOrDefault() : false);
- if (!flag)
- {
- keyValuePairs = new List<KeyValuePair<string, string>>();
- keyValuePairs1 = null;
- bancosContasServico = null;
- saldo = null;
- return keyValuePairs;
- }
- }
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "SALDO", "NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO.", true);
- keyValuePairs = keyValuePairs1;
- keyValuePairs1 = null;
- bancosContasServico = null;
- saldo = null;
- return keyValuePairs;
- }
-
- public List<KeyValuePair<string, string>> ValidateIncluir()
- {
- //
- // Current member / type: System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.String,System.String>> Gestor.Application.ViewModels.Financeiro.FinanceiroViewModel::ValidateIncluir()
- // File path: C:\AggerSeguros\Gestor.Application.exe
- //
- // Product version: 0.0.0.0
- // Exception in: System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>> ValidateIncluir()
- //
- // Object reference not set to an instance of an object.
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331
- // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
- // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
- // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 133
- //
- // mailto: JustDecompilePublicFeedback@telerik.com
-
- }
-
- private bool VerificaDataInvertida(OfxDocument lancamentos)
- {
- List<string> strs = new List<string>()
- {
- "0104"
- };
- if (lancamentos.get_StatementStart() <= lancamentos.get_StatementEnd())
- {
- return false;
- }
- return strs.Any<string>((string banco) => banco == lancamentos.get_Account().get_BankId());
- }
-
- private bool VerificaFiltroErrado(OfxDocument lancamentos)
- {
- List<string> strs = new List<string>()
- {
- "0237",
- "756"
- };
- if (lancamentos.get_StatementStart() != lancamentos.get_StatementEnd())
- {
- return false;
- }
- return strs.Any<string>((string idbanco) => idbanco == lancamentos.get_Account().get_BankId());
- }
-
- private async Task<Saldo> VerificaSaldo(long contaId, bool reabrirSaldo)
- {
- BancosContasServico bancosContasServico = new BancosContasServico();
- List<BancosContas> contas = this.Contas;
- List<Saldo> saldos = await bancosContasServico.BuscarSaldoAberto((
- from x in contas
- select x.get_Id()).ToList<long>());
- Saldo saldo = saldos.FirstOrDefault<Saldo>((Saldo s) => s.get_Conta().get_Id() == contaId);
- if (saldo == null & reabrirSaldo)
- {
- await base.ShowMessage("NÃO FOI ENCONTRADO UM SALDO ABERTO PARA FAZER A EXCLUSÃO.", "OK", "", false);
- }
- Saldo saldo1 = saldo;
- saldo = null;
- return saldo1;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/FornecedorViewModel.cs b/Gestor.Application/ViewModels/Financeiro/FornecedorViewModel.cs
deleted file mode 100644
index 6d1dc77..0000000
--- a/Gestor.Application/ViewModels/Financeiro/FornecedorViewModel.cs
+++ /dev/null
@@ -1,780 +0,0 @@
-using Assinador.Infrastructure.Helpers;
-using ClosedXML.Excel;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using Gestor.Model.Helper;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class FornecedorViewModel : BaseFinanceiroViewModel
- {
- private readonly FornecedorServico _servico;
-
- private List<Gestor.Model.Domain.Financeiro.Planos> _planos;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> _planosFiltrados;
-
- private List<BancosContas> _contas;
-
- private ObservableCollection<BancosContas> _contasFiltradas;
-
- private List<Centro> _centros;
-
- private ObservableCollection<Centro> _centrosFiltrados;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor> _fornecedorFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor>();
-
- private bool _isExpanded;
-
- private Gestor.Model.Domain.Financeiro.Fornecedor _selectedFornecedor;
-
- private string _anotacoes;
-
- private long _ultimoId;
-
- public Gestor.Model.Domain.Financeiro.Fornecedor CancelProduto;
-
- public string Anotacoes
- {
- get
- {
- return this._anotacoes;
- }
- set
- {
- this._anotacoes = value;
- base.OnPropertyChanged("Anotacoes");
- }
- }
-
- public List<Centro> Centros
- {
- get
- {
- return this._centros;
- }
- set
- {
- this._centros = value;
- base.OnPropertyChanged("Centros");
- }
- }
-
- public ObservableCollection<Centro> CentrosFiltrados
- {
- get
- {
- return this._centrosFiltrados;
- }
- set
- {
- this._centrosFiltrados = value;
- base.OnPropertyChanged("CentrosFiltrados");
- }
- }
-
- public List<BancosContas> Contas
- {
- get
- {
- return this._contas;
- }
- set
- {
- this._contas = value;
- base.OnPropertyChanged("Contas");
- }
- }
-
- public ObservableCollection<BancosContas> ContasFiltradas
- {
- get
- {
- return this._contasFiltradas;
- }
- set
- {
- this._contasFiltradas = value;
- base.OnPropertyChanged("ContasFiltradas");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Fornecedor> Fornecedor
- {
- get;
- set;
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor> FornecedorFiltrados
- {
- get
- {
- return this._fornecedorFiltrados;
- }
- set
- {
- this._fornecedorFiltrados = value;
- this.IsExpanded = (value != null ? value.Count > 0 : false);
- base.OnPropertyChanged("FornecedorFiltrados");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Planos> Planos
- {
- get
- {
- return this._planos;
- }
- set
- {
- this._planos = value;
- base.OnPropertyChanged("Planos");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> PlanosFiltrados
- {
- get
- {
- return this._planosFiltrados;
- }
- set
- {
- this._planosFiltrados = value;
- base.OnPropertyChanged("PlanosFiltrados");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.Fornecedor SelectedFornecedor
- {
- get
- {
- return this._selectedFornecedor;
- }
- set
- {
- long? nullable;
- this._selectedFornecedor = value;
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- this.Anotacoes = string.Empty;
- this._ultimoId = (value == null || value.get_Id() <= (long)0 ? this._ultimoId : value.get_Id());
- base.OnPropertyChanged("SelectedFornecedor");
- }
- }
-
- public FornecedorViewModel()
- {
- this._servico = new FornecedorServico();
- base.EnableMenu = true;
- this.BuscaIncial();
- }
-
- private async void BuscaIncial()
- {
- base.Loading(true);
- await base.PermissaoTela(24);
- this.Planos = await (new PlanoServico()).BuscarPlanos();
- FornecedorViewModel observableCollection = this;
- List<Gestor.Model.Domain.Financeiro.Planos> planos = this.Planos;
- IEnumerable<Gestor.Model.Domain.Financeiro.Planos> ativo =
- from x in planos
- where x.get_Ativo()
- select x;
- observableCollection.PlanosFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>(
- from x in ativo
- orderby x.get_Descricao()
- select x);
- this.Contas = await (new BancosContasServico()).BuscarBancos();
- FornecedorViewModel fornecedorViewModel = this;
- List<BancosContas> contas = this.Contas;
- IEnumerable<BancosContas> bancosContas =
- from x in contas
- where x.get_Ativo()
- select x;
- fornecedorViewModel.ContasFiltradas = new ObservableCollection<BancosContas>(
- from x in bancosContas
- orderby x.get_Descricao()
- select x);
- this.Centros = await (new CentroServico()).BuscarCentros();
- FornecedorViewModel observableCollection1 = this;
- List<Centro> centros = this.Centros;
- IEnumerable<Centro> ativo1 =
- from x in centros
- where x.get_Ativo()
- select x;
- observableCollection1.CentrosFiltrados = new ObservableCollection<Centro>(
- from x in ativo1
- orderby x.get_Descricao()
- select x);
- await this.SelecionaFornecedor();
- this.SelectedFornecedor = this.FornecedorFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Fornecedor>();
- base.Loading(false);
- }
-
- public async void CancelarAlteracao()
- {
- base.Loading(true);
- base.Alterar(false);
- if (this.SelectedFornecedor.get_Id() > (long)0)
- {
- await this.SelecionaFornecedor();
- }
- this.SelectedFornecedor = this.FornecedorFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Fornecedor>((Gestor.Model.Domain.Financeiro.Fornecedor x) => x.get_Id() == this._ultimoId);
- base.Loading(false);
- }
-
- public void Copiar(Cliente cliente)
- {
- TipoTelefone? nullable;
- string str;
- string str1;
- string str2;
- string str3;
- string str4;
- string str5;
- string str6;
- TipoTelefone? tipo;
- string str7;
- string str8;
- TipoTelefone? tipo1;
- string str9;
- string str10;
- string str11;
- if (this.SelectedFornecedor == null)
- {
- this.Incluir();
- }
- this.SelectedFornecedor.set_Nome(cliente.get_Nome());
- this.SelectedFornecedor.set_Documento(cliente.get_Documento());
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str = null;
- }
- else
- {
- ClienteEndereco clienteEndereco = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco != null)
- {
- string cep = clienteEndereco.get_Cep();
- if (cep != null)
- {
- str = cep.Trim();
- }
- else
- {
- str = null;
- }
- }
- else
- {
- str = null;
- }
- }
- selectedFornecedor.set_Cep(str);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str1 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco1 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco1 != null)
- {
- string endereco = clienteEndereco1.get_Endereco();
- if (endereco != null)
- {
- str1 = endereco.Trim();
- }
- else
- {
- str1 = null;
- }
- }
- else
- {
- str1 = null;
- }
- }
- fornecedor.set_Endereco(str1);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor1 = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str2 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco2 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco2 != null)
- {
- string numero = clienteEndereco2.get_Numero();
- if (numero != null)
- {
- str2 = numero.Trim();
- }
- else
- {
- str2 = null;
- }
- }
- else
- {
- str2 = null;
- }
- }
- selectedFornecedor1.set_Numero(str2);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor1 = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str3 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco3 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco3 != null)
- {
- string complemento = clienteEndereco3.get_Complemento();
- if (complemento != null)
- {
- str3 = complemento.Trim();
- }
- else
- {
- str3 = null;
- }
- }
- else
- {
- str3 = null;
- }
- }
- fornecedor1.set_Complemento(str3);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor2 = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str4 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco4 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco4 != null)
- {
- string bairro = clienteEndereco4.get_Bairro();
- if (bairro != null)
- {
- str4 = bairro.Trim();
- }
- else
- {
- str4 = null;
- }
- }
- else
- {
- str4 = null;
- }
- }
- selectedFornecedor2.set_Bairro(str4);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor2 = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str5 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco5 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco5 != null)
- {
- string cidade = clienteEndereco5.get_Cidade();
- if (cidade != null)
- {
- str5 = cidade.Trim();
- }
- else
- {
- str5 = null;
- }
- }
- else
- {
- str5 = null;
- }
- }
- fornecedor2.set_Cidade(str5);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor3 = this.SelectedFornecedor;
- if (cliente.get_Enderecos() == null || !cliente.get_Enderecos().Any<ClienteEndereco>())
- {
- str6 = null;
- }
- else
- {
- ClienteEndereco clienteEndereco6 = cliente.get_Enderecos().First<ClienteEndereco>();
- if (clienteEndereco6 != null)
- {
- string estado = clienteEndereco6.get_Estado();
- if (estado != null)
- {
- str6 = estado.Trim();
- }
- else
- {
- str6 = null;
- }
- }
- else
- {
- str6 = null;
- }
- }
- selectedFornecedor3.set_Estado(str6);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor3 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || !cliente.get_Telefones().Any<ClienteTelefone>())
- {
- nullable = null;
- tipo = nullable;
- }
- else
- {
- tipo = cliente.get_Telefones().First<ClienteTelefone>().get_Tipo();
- }
- fornecedor3.set_TipoTelefone1(tipo);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor4 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || !cliente.get_Telefones().Any<ClienteTelefone>())
- {
- str7 = null;
- }
- else
- {
- string prefixo = cliente.get_Telefones().First<ClienteTelefone>().get_Prefixo();
- if (prefixo != null)
- {
- str7 = prefixo.Trim();
- }
- else
- {
- str7 = null;
- }
- }
- selectedFornecedor4.set_Prefixo1(str7);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor4 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || !cliente.get_Telefones().Any<ClienteTelefone>())
- {
- str8 = null;
- }
- else
- {
- string numero1 = cliente.get_Telefones().First<ClienteTelefone>().get_Numero();
- if (numero1 != null)
- {
- str8 = numero1.Trim();
- }
- else
- {
- str8 = null;
- }
- }
- fornecedor4.set_Telefone1(str8);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor5 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || !cliente.get_Telefones().Any<ClienteTelefone>() || cliente.get_Telefones().Count <= 2)
- {
- nullable = null;
- tipo1 = nullable;
- }
- else
- {
- tipo1 = cliente.get_Telefones()[1].get_Tipo();
- }
- selectedFornecedor5.set_TipoTelefone2(tipo1);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor5 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || cliente.get_Telefones().Count <= 2)
- {
- str9 = null;
- }
- else
- {
- string prefixo1 = cliente.get_Telefones()[1].get_Prefixo();
- if (prefixo1 != null)
- {
- str9 = prefixo1.Trim();
- }
- else
- {
- str9 = null;
- }
- }
- fornecedor5.set_Prefixo2(str9);
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor6 = this.SelectedFornecedor;
- if (cliente.get_Telefones() == null || cliente.get_Telefones().Count <= 2)
- {
- str10 = null;
- }
- else
- {
- string numero2 = cliente.get_Telefones()[1].get_Numero();
- if (numero2 != null)
- {
- str10 = numero2.Trim();
- }
- else
- {
- str10 = null;
- }
- }
- selectedFornecedor6.set_Telefone2(str10);
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor6 = this.SelectedFornecedor;
- if (cliente.get_Emails() == null || !cliente.get_Emails().Any<ClienteEmail>() || cliente.get_Emails().Count <= 0)
- {
- str11 = null;
- }
- else
- {
- string email = cliente.get_Emails().First<ClienteEmail>().get_Email();
- if (email != null)
- {
- str11 = email.Trim();
- }
- else
- {
- str11 = null;
- }
- }
- fornecedor6.set_Email(str11);
- base.OnPropertyChanged("SelectedFornecedor");
- }
-
- public async Task Delete()
- {
- if (this.SelectedFornecedor != null && this.SelectedFornecedor.get_Id() != 0)
- {
- if (await base.ShowMessage(string.Concat("DESEJA REALMENTE EXCLUIR O FORNECEDOR ", this.SelectedFornecedor.get_Nome(), "?"), "SIM", "NÃO", false))
- {
- base.Loading(true);
- if (await (new FinanceiroServico()).TemLancamentosPorFornecedor(this.SelectedFornecedor.get_Id()))
- {
- await base.ShowMessage("IMPOSSÍVEL REAIZAR A EXCLUSÃO POIS EXISTEM LANCAMENTOS PARA ESSE FORNECEDOR. PROCESSO INTERROMPIDO", "OK", "", false);
- base.Loading(false);
- }
- else if (await this._servico.Delete(this.SelectedFornecedor))
- {
- await this.SelecionaFornecedor();
- this.SelectedFornecedor = this.FornecedorFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Fornecedor>();
- base.ToggleSnackBar("FORNECEDOR EXCLUÍDO COM SUCESSO", true);
- base.Loading(false);
- }
- else
- {
- base.Loading(false);
- }
- }
- }
- }
-
- public async void Excel()
- {
- XLWorkbook xLWorkbook = new XLWorkbook();
- string str = "RELAÓRIO DE FORNECEDOR";
- xLWorkbook = await Funcoes.GerarXls<Gestor.Model.Domain.Financeiro.Fornecedor>(xLWorkbook, str, this.FornecedorFiltrados.ToList<Gestor.Model.Domain.Financeiro.Fornecedor>(), null);
- string tempPath = "";
- string str1 = "";
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (!configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 41))
- {
- tempPath = Path.GetTempPath();
- str1 = string.Format("{0}{1}.xlsx", tempPath, Guid.NewGuid());
- }
- else
- {
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (DialogResult.OK == folderBrowserDialog.ShowDialog())
- {
- tempPath = string.Concat(folderBrowserDialog.SelectedPath, "\\");
- Directory.CreateDirectory(tempPath);
- }
- else
- {
- str = null;
- return;
- }
- }
- string[] strArrays = new string[] { tempPath, str, " ", null, null };
- DateTime date = Functions.GetNetworkTime().Date;
- strArrays[3] = date.ToShortDateString().Replace("/", "");
- strArrays[4] = ".xlsx";
- str1 = string.Concat(strArrays);
- }
- xLWorkbook.SaveAs(str1);
- Process.Start(str1);
- str = null;
- }
-
- internal async Task<List<Gestor.Model.Domain.Financeiro.Fornecedor>> Filtrar(string value)
- {
- List<Gestor.Model.Domain.Financeiro.Fornecedor> fornecedors = await Task.Run<List<Gestor.Model.Domain.Financeiro.Fornecedor>>(() => this.FiltrarFornecedor(value));
- return fornecedors;
- }
-
- public List<Gestor.Model.Domain.Financeiro.Fornecedor> FiltrarFornecedor(string filter)
- {
- this.FornecedorFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor>(this.Fornecedor) : new ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor>(this.Fornecedor.Where<Gestor.Model.Domain.Financeiro.Fornecedor>((Gestor.Model.Domain.Financeiro.Fornecedor x) => {
- if (Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Nome().Trim()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(filter)) || x.get_Documento() != null && Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Documento().Trim()).Contains(filter) || x.get_Telefone1() != null && Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Telefone1().Trim()).Contains(filter) || x.get_Telefone2() != null && Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Telefone2().Trim()).Contains(filter))
- {
- return true;
- }
- if (x.get_Email() == null)
- {
- return false;
- }
- return Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Email().Trim()).Contains(filter);
- }).OrderByDescending<Gestor.Model.Domain.Financeiro.Fornecedor, string>((Gestor.Model.Domain.Financeiro.Fornecedor x) => x.get_Nome())));
- if (this.FornecedorFiltrados.Count == 1)
- {
- this.SelectedFornecedor = this.FornecedorFiltrados.First<Gestor.Model.Domain.Financeiro.Fornecedor>();
- }
- return this.FornecedorFiltrados.ToList<Gestor.Model.Domain.Financeiro.Fornecedor>();
- }
-
- public async void Imprimir()
- {
- await base.ImprimirFornecedor(this.FornecedorFiltrados.ToList<Gestor.Model.Domain.Financeiro.Fornecedor>());
- }
-
- public void Incluir()
- {
- long id;
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor = this.SelectedFornecedor;
- if (selectedFornecedor != null)
- {
- id = selectedFornecedor.get_Id();
- }
- else
- {
- id = (long)0;
- }
- this._ultimoId = id;
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor = new Gestor.Model.Domain.Financeiro.Fornecedor();
- fornecedor.set_IdEmpresa((long)1);
- fornecedor.set_Ativo(true);
- this.SelectedFornecedor = fornecedor;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedFornecedor.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validate());
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- if (!this.SelectedFornecedor.get_TipoPagamento().HasValue)
- {
- this.SelectedFornecedor.set_TipoPagamento(new TipoPagamento?(12));
- }
- if (!string.IsNullOrWhiteSpace(this.Anotacoes))
- {
- Gestor.Model.Domain.Financeiro.Fornecedor selectedFornecedor = this.SelectedFornecedor;
- object[] nome = new object[] { Recursos.Usuario.get_Nome(), Recursos.Usuario.get_Id(), Funcoes.GetNetworkTime(), Environment.NewLine, this.Anotacoes, Environment.NewLine, Environment.NewLine, this.SelectedFornecedor.get_Observacao() };
- selectedFornecedor.set_Observacao(string.Format("{0}, ID: {1}, {2:g}{3}{4}{5}{6}{7}", nome));
- }
- Gestor.Model.Domain.Financeiro.Fornecedor fornecedor = await this._servico.Save(this.SelectedFornecedor);
- if (this._servico.Sucesso)
- {
- await this.SelecionaFornecedor();
- this.SelectedFornecedor = this.FornecedorFiltrados.First<Gestor.Model.Domain.Financeiro.Fornecedor>((Gestor.Model.Domain.Financeiro.Fornecedor x) => x.get_Id() == fornecedor.get_Id());
- base.ToggleSnackBar("FORNECEDOR SALVO COM SUCESSO", true);
- base.Alterar(false);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- private async Task SelecionaFornecedor()
- {
- this.Fornecedor = await this._servico.BuscarFornecedores();
- FornecedorViewModel observableCollection = this;
- List<Gestor.Model.Domain.Financeiro.Fornecedor> fornecedor = this.Fornecedor;
- observableCollection.FornecedorFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Fornecedor>(
- from x in fornecedor
- orderby x.get_Nome()
- select x);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = Gestor.Model.Helper.ValidationHelper.AddValue();
- if (!string.IsNullOrWhiteSpace(this.SelectedFornecedor.get_Documento()))
- {
- List<Gestor.Model.Domain.Financeiro.Fornecedor> list = await this._servico.BuscarFornecedores();
- list = list.Where<Gestor.Model.Domain.Financeiro.Fornecedor>((Gestor.Model.Domain.Financeiro.Fornecedor x) => {
- if (x.get_Id() == this.SelectedFornecedor.get_Id())
- {
- return false;
- }
- return Gestor.Model.Helper.ValidationHelper.DocumentoFornecedor(x.get_Documento()) == Gestor.Model.Helper.ValidationHelper.DocumentoFornecedor(this.SelectedFornecedor.get_Documento());
- }).ToList<Gestor.Model.Domain.Financeiro.Fornecedor>();
- if (list.Count > 0)
- {
- List<KeyValuePair<string, string>> keyValuePairs1 = keyValuePairs;
- List<Gestor.Model.Domain.Financeiro.Fornecedor> fornecedors = list;
- Gestor.Model.Helper.ValidationHelper.AddValue<string, string>(keyValuePairs1, "DOCUMENTO", string.Concat("DOCUMENTO JÁ CADASTRADO PARA OUTROS FORNECEDORES ", string.Join(" | ",
- from x in fornecedors
- select x.get_Nome())), true);
- }
- }
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs;
- keyValuePairs = null;
- return keyValuePairs2;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs b/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs
deleted file mode 100644
index d1a0c38..0000000
--- a/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class InfoExtratoViewModel : BaseFinanceiroViewModel
- {
- private readonly BancosContasServico _saldoServico;
-
- private Saldo _selectedSaldo;
-
- public bool _telaBancos
- {
- get;
- set;
- }
-
- public Saldo SelectedSaldo
- {
- get
- {
- return this._selectedSaldo;
- }
- set
- {
- if (value != null && !this._telaBancos)
- {
- value.set_DataFinal(null);
- value.set_ValorFinal(null);
- }
- this._selectedSaldo = value;
- base.OnPropertyChanged("SelectedSaldo");
- this.SelectedSaldo.Initialize();
- }
- }
-
- public InfoExtratoViewModel(bool telaBancos)
- {
- this._telaBancos = telaBancos;
- this._saldoServico = new BancosContasServico();
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedSaldo.Validate();
- if (keyValuePairs1.Count <= 0)
- {
- if (!this._telaBancos)
- {
- this.SelectedSaldo.set_DataFinal(null);
- this.SelectedSaldo.set_ValorFinal(null);
- }
- this.SelectedSaldo = await this._saldoServico.Save(this.SelectedSaldo);
- if (this._saldoServico.Sucesso)
- {
- base.Alterar(false);
- base.ToggleSnackBar("SALDO SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- return keyValuePairs;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/MenuFinanceiroViewModel.cs b/Gestor.Application/ViewModels/Financeiro/MenuFinanceiroViewModel.cs
deleted file mode 100644
index 9c1bdee..0000000
--- a/Gestor.Application/ViewModels/Financeiro/MenuFinanceiroViewModel.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Financeiro;
-using System;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class MenuFinanceiroViewModel : BaseViewModel
- {
- private object _content;
-
- public Gestor.Application.Views.Financeiro.FinanceiroView FinanceiroView;
-
- public object Content
- {
- get
- {
- return this._content;
- }
- set
- {
- this._content = value;
- base.OnPropertyChanged("Content");
- }
- }
-
- public MenuFinanceiroViewModel()
- {
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs b/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs
deleted file mode 100644
index e62f957..0000000
--- a/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class PlanoViewModel : BaseFinanceiroViewModel
- {
- private readonly PlanoServico _planoServico;
-
- private Plano _selectedPlano;
-
- public Plano Cancel;
-
- public Plano SelectedPlano
- {
- get
- {
- return this._selectedPlano;
- }
- set
- {
- long? nullable;
- this._selectedPlano = value;
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- base.OnPropertyChanged("SelectedPlano");
- }
- }
-
- public PlanoViewModel(Plano plano)
- {
- this._planoServico = new PlanoServico();
- this.Seleciona(plano);
- }
-
- public void Cancelar()
- {
- base.Loading(true);
- if (this.SelectedPlano.get_Id() != 0)
- {
- base.Alterar(false);
- base.Loading(false);
- return;
- }
- this.SelectedPlano = new Plano();
- base.Alterar(false);
- base.Loading(false);
- }
-
- public void Incluir()
- {
- Plano plano = new Plano();
- plano.set_Ativo(true);
- this.SelectedPlano = plano;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedPlano.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validate());
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedPlano = await this._planoServico.Save(this.SelectedPlano);
- if (this._planoServico.Sucesso)
- {
- base.Alterar(false);
- base.ToggleSnackBar("PLANO SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- private async void Seleciona(Plano plano)
- {
- base.Loading(true);
- await base.PermissaoTela(27);
- if (plano != null)
- {
- this.SelectedPlano = plano;
- }
- else
- {
- Plano plano1 = new Plano();
- plano1.set_Descricao("");
- plano1.set_Ativo(true);
- this.SelectedPlano = plano1;
- }
- base.Loading(false);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- bool flag = true;
- List<Plano> planos = await (new BaseServico()).BuscarPlanoAsync();
- if (planos.Count > 0)
- {
- planos.ForEach((Plano x) => {
- if (x.get_Id() == this.SelectedPlano.get_Id())
- {
- return;
- }
- if (x.get_Descricao() == this.SelectedPlano.get_Descricao())
- {
- flag = false;
- }
- });
- }
- if (!flag)
- {
- keyValuePairs.Add(new KeyValuePair<string, string>("Descricao", "UM PLANO COM ESSE NOME JÁ EXISTE."));
- }
- List<KeyValuePair<string, string>> keyValuePairs1 = keyValuePairs;
- keyValuePairs = null;
- return keyValuePairs1;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/PlanosViewModel.cs b/Gestor.Application/ViewModels/Financeiro/PlanosViewModel.cs
deleted file mode 100644
index e2251f3..0000000
--- a/Gestor.Application/ViewModels/Financeiro/PlanosViewModel.cs
+++ /dev/null
@@ -1,330 +0,0 @@
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class PlanosViewModel : BaseFinanceiroViewModel
- {
- private readonly PlanosServico _planosServico;
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Plano> _plano = new ObservableCollection<Gestor.Model.Domain.Financeiro.Plano>();
-
- private ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> _planosFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>();
-
- private bool _isExpanded;
-
- private Gestor.Model.Domain.Financeiro.Planos _selectedPlanos;
-
- private Gestor.Model.Domain.Financeiro.Plano _selectedPlano;
-
- private bool _ativo;
-
- private long _ultimoId;
-
- public bool Ativo
- {
- get
- {
- return this._ativo;
- }
- set
- {
- this._ativo = value;
- base.OnPropertyChanged("Ativo");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Plano> Plano
- {
- get
- {
- return this._plano;
- }
- set
- {
- this._plano = value;
- base.OnPropertyChanged("Plano");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Planos> Planos
- {
- get;
- set;
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> PlanosFiltrados
- {
- get
- {
- return this._planosFiltrados;
- }
- set
- {
- this._planosFiltrados = value;
- this.IsExpanded = (value != null ? value.Count > 0 : false);
- base.OnPropertyChanged("PlanosFiltrados");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.Plano SelectedPlano
- {
- get
- {
- return this._selectedPlano;
- }
- set
- {
- this._selectedPlano = value;
- base.OnPropertyChanged("SelectedPlano");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.Planos SelectedPlanos
- {
- get
- {
- return this._selectedPlanos;
- }
- set
- {
- bool plano;
- Gestor.Model.Domain.Financeiro.Plano plano1;
- bool id;
- long? nullable;
- this._selectedPlanos = value;
- Gestor.Model.Domain.Financeiro.Planos plano2 = value;
- if (plano2 != null)
- {
- plano = plano2.get_Plano();
- }
- else
- {
- plano = false;
- }
- if (plano)
- {
- plano1 = this.Plano.FirstOrDefault<Gestor.Model.Domain.Financeiro.Plano>((Gestor.Model.Domain.Financeiro.Plano x) => x.get_Id() == value.get_Plano().get_Id());
- }
- else
- {
- plano1 = null;
- }
- this.SelectedPlano = plano1;
- Gestor.Model.Domain.Financeiro.Planos plano3 = value;
- if (plano3 != null)
- {
- id = plano3.get_Id() > (long)0;
- }
- else
- {
- id = false;
- }
- if (id)
- {
- this._ultimoId = value.get_Id();
- }
- Gestor.Model.Domain.Financeiro.Planos plano4 = value;
- if (plano4 != null)
- {
- nullable = new long?(plano4.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- base.OnPropertyChanged("SelectedPlanos");
- }
- }
-
- public PlanosViewModel()
- {
- this._planosServico = new PlanosServico();
- base.EnableMenu = true;
- this.Seleciona();
- }
-
- public async void CancelarAlteracao()
- {
- base.Loading(true);
- base.Alterar(false);
- if (this.SelectedPlanos.get_Id() > (long)0)
- {
- await this.SelecionaPlanos();
- }
- await this.SelecionaPlanos(this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == this._ultimoId));
- base.Loading(false);
- }
-
- public async Task<ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>> Filtrar(string value)
- {
- ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> observableCollection = await Task.Run<ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>>(() => this.FiltrarPlanos(value));
- return observableCollection;
- }
-
- public ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> FiltrarPlanos(string filter)
- {
- this.PlanosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>(this.Planos) : new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>(
- from x in this.Planos
- where ValidationHelper.RemoveDiacritics(x.get_Descricao().Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))
- orderby this.Ativo descending, x.get_Descricao()
- select x));
- return this.PlanosFiltrados;
- }
-
- public void Incluir()
- {
- Gestor.Model.Domain.Financeiro.Planos plano = new Gestor.Model.Domain.Financeiro.Planos();
- plano.set_Plano(this.SelectedPlano);
- this.SelectedPlanos = plano;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- this.SelectedPlanos.set_Plano(this.SelectedPlano);
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedPlanos.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validate());
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedPlanos.set_Plano(this.SelectedPlano);
- this.SelectedPlanos = await this._planosServico.Save(this.SelectedPlanos);
- if (this._planosServico.Sucesso)
- {
- await this.SelecionaPlanos();
- await this.SelecionaPlanos(this.PlanosFiltrados.First<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == this.SelectedPlanos.get_Id()));
- base.Alterar(false);
- base.ToggleSnackBar("SUBNÍVEL SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- private async void Seleciona()
- {
- base.Loading(true);
- await base.PermissaoTela(28);
- await this.SelecionaPlanos();
- await this.SelecionaPlanos(this.PlanosFiltrados.FirstOrDefault<Gestor.Model.Domain.Financeiro.Planos>());
- base.Loading(false);
- }
-
- private async Task SelecionaPlanos()
- {
- List<Gestor.Model.Domain.Financeiro.Planos> planos = await (new BaseServico()).BuscarPlanosAsync();
- PlanosViewModel list = this;
- List<Gestor.Model.Domain.Financeiro.Planos> planos1 = planos;
- IOrderedEnumerable<Gestor.Model.Domain.Financeiro.Planos> ativo =
- from x in planos1
- orderby x.get_Ativo() descending
- select x;
- IOrderedEnumerable<Gestor.Model.Domain.Financeiro.Planos> planos2 = ativo.ThenBy<Gestor.Model.Domain.Financeiro.Planos, string>((Gestor.Model.Domain.Financeiro.Planos x) => {
- Gestor.Model.Domain.Financeiro.Plano plano = x.get_Plano();
- if (plano != null)
- {
- return plano.get_Descricao();
- }
- return null;
- });
- list.Planos = planos2.ThenBy<Gestor.Model.Domain.Financeiro.Planos, string>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Descricao()).ToList<Gestor.Model.Domain.Financeiro.Planos>();
- this.PlanosFiltrados = new ObservableCollection<Gestor.Model.Domain.Financeiro.Planos>(this.Planos);
- }
-
- public async Task SelecionaPlanos(Gestor.Model.Domain.Financeiro.Planos planos)
- {
- if (planos != null)
- {
- base.Loading(true);
- ObservableCollection<Gestor.Model.Domain.Financeiro.Planos> observableCollection = await this._planosServico.BuscarPlanos();
- DomainBase.Copy<Gestor.Model.Domain.Financeiro.Planos, Gestor.Model.Domain.Financeiro.Planos>(this.PlanosFiltrados.First<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == planos.get_Id()), observableCollection.First<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == planos.get_Id()));
- if (this.Plano == null)
- {
- List<Gestor.Model.Domain.Financeiro.Plano> planos1 = await (new BaseServico()).BuscarPlanoAsync();
- PlanosViewModel planosViewModel = this;
- List<Gestor.Model.Domain.Financeiro.Plano> planos2 = planos1;
- IOrderedEnumerable<Gestor.Model.Domain.Financeiro.Plano> ativo =
- from x in planos2
- orderby x.get_Ativo() descending
- select x;
- planosViewModel.Plano = new ObservableCollection<Gestor.Model.Domain.Financeiro.Plano>(ativo.ThenBy<Gestor.Model.Domain.Financeiro.Plano, string>((Gestor.Model.Domain.Financeiro.Plano x) => x.get_Descricao()).ToList<Gestor.Model.Domain.Financeiro.Plano>());
- }
- this.SelectedPlanos = this.PlanosFiltrados.First<Gestor.Model.Domain.Financeiro.Planos>((Gestor.Model.Domain.Financeiro.Planos x) => x.get_Id() == planos.get_Id());
- base.Loading(false);
- }
- else
- {
- base.Alterar(false);
- base.EnableMenu = false;
- base.EnableAlterar = false;
- }
- }
-
- public async Task<List<KeyValuePair<string, string>>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- bool flag = true;
- List<Gestor.Model.Domain.Financeiro.Planos> planos = await (new BaseServico()).BuscarPlanosAsync();
- if (planos != null)
- {
- planos.ForEach((Gestor.Model.Domain.Financeiro.Planos x) => {
- if (x.get_Id() == this.SelectedPlanos.get_Id())
- {
- return;
- }
- if (x.get_Descricao() == this.SelectedPlanos.get_Descricao())
- {
- flag = false;
- }
- });
- }
- else
- {
- }
- if (!flag)
- {
- keyValuePairs.Add(new KeyValuePair<string, string>("Descricao", "UM SUBNÍVEL COM ESSE NOME JÁ EXISTE."));
- }
- List<KeyValuePair<string, string>> keyValuePairs1 = keyValuePairs;
- keyValuePairs = null;
- return keyValuePairs1;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs b/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs
deleted file mode 100644
index 084c527..0000000
--- a/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs
+++ /dev/null
@@ -1,2746 +0,0 @@
-using ClosedXML.Excel;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Helpers;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Financeiro.Relatorios;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Gestor.Application.ViewModels.Financeiro.Relatorios
-{
- public class FechamentoFinanceiroViewModel : BaseViewModel
- {
- private readonly FinanceiroServico _servico;
-
- private bool _isExpanded;
-
- private bool _analitico;
-
- private List<Gestor.Model.Domain.Financeiro.Plano> _plano;
-
- private List<Gestor.Model.Domain.Financeiro.Planos> _planos;
-
- private List<Gestor.Model.Domain.Financeiro.Centro> _centro;
-
- private List<BancosContas> _conta;
-
- private DateTime? _inicio;
-
- private DateTime? _fim;
-
- private List<FechamentoFinanceiro> _fechamento;
-
- private List<FechamentoFinanceiroAnalitico> _fechamentoAnalitico;
-
- private string _htmlContent;
-
- private bool _print;
-
- public bool Analitico
- {
- get
- {
- return this._analitico;
- }
- set
- {
- this._analitico = value;
- base.OnPropertyChanged("Analitico");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Centro> Centro
- {
- get
- {
- return this._centro;
- }
- set
- {
- this._centro = value;
- base.OnPropertyChanged("Centro");
- }
- }
-
- public List<BancosContas> Conta
- {
- get
- {
- return this._conta;
- }
- set
- {
- this._conta = value;
- base.OnPropertyChanged("Conta");
- }
- }
-
- public List<FechamentoFinanceiro> Fechamento
- {
- get
- {
- return this._fechamento;
- }
- set
- {
- this._fechamento = value;
- base.OnPropertyChanged("Fechamento");
- }
- }
-
- public List<FechamentoFinanceiroAnalitico> FechamentoAnalitico
- {
- get
- {
- return this._fechamentoAnalitico;
- }
- set
- {
- this._fechamentoAnalitico = value;
- base.OnPropertyChanged("FechamentoAnalitico");
- }
- }
-
- public DateTime? Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- base.OnPropertyChanged("Fim");
- }
- }
-
- public string HtmlContent
- {
- get
- {
- return this._htmlContent;
- }
- set
- {
- this._htmlContent = value;
- this.IsPrintable = !string.IsNullOrWhiteSpace(this._htmlContent);
- base.OnPropertyChanged("HtmlContent");
- }
- }
-
- public DateTime? Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- base.OnPropertyChanged("IsExpanded");
- }
- }
-
- public bool IsPrintable
- {
- get
- {
- return this._print;
- }
- set
- {
- this._print = value;
- base.OnPropertyChanged("IsPrintable");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Plano> Plano
- {
- get
- {
- return this._plano;
- }
- set
- {
- this._plano = value;
- base.OnPropertyChanged("Plano");
- }
- }
-
- public List<Gestor.Model.Domain.Financeiro.Planos> Planos
- {
- get
- {
- return this._planos;
- }
- set
- {
- this._planos = value;
- base.OnPropertyChanged("Planos");
- }
- }
-
- public FechamentoFinanceiroViewModel()
- {
- DateTime date = Funcoes.GetNetworkTime().Date;
- int year = date.Year;
- date = Funcoes.GetNetworkTime().Date;
- this._inicio = new DateTime?(new DateTime(year, date.Month, 1));
- this._fim = new DateTime?(Funcoes.GetNetworkTime());
- base();
- this._servico = new FinanceiroServico();
- this.LoadInicial();
- }
-
- public async Task GerarExcel()
- {
- string tempPath = "";
- string str = "";
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (!configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 41))
- {
- tempPath = Path.GetTempPath();
- str = string.Format("{0}{1}.xlsx", tempPath, Guid.NewGuid());
- }
- else
- {
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (DialogResult.OK == folderBrowserDialog.ShowDialog())
- {
- tempPath = string.Concat(folderBrowserDialog.SelectedPath, "\\");
- Directory.CreateDirectory(tempPath);
- }
- else
- {
- str = null;
- return;
- }
- }
- DateTime date = Functions.GetNetworkTime().Date;
- str = string.Concat(tempPath, "FECHAMENTO ", date.ToShortDateString().Replace("/", ""), ".xlsx");
- }
- XLWorkbook xLWorkbook = new XLWorkbook();
- int num = 1;
- if (this.Analitico)
- {
- if (this.FechamentoAnalitico == null || this.FechamentoAnalitico.Count == 0)
- {
- str = null;
- return;
- }
- else
- {
- foreach (FechamentoFinanceiroAnalitico fechamentoAnalitico in this.FechamentoAnalitico)
- {
- string str1 = string.Format("{0}_{1}", num, fechamentoAnalitico.get_NomeConta());
- while (str1.Replace("/", "_").Trim().Length > 30)
- {
- str1 = Regex.Replace(str1.Trim(), "[^\\s]*$", "");
- }
- xLWorkbook = await Funcoes.GerarXls<DadosFechamentoAnalitico>(xLWorkbook, str1.Replace("/", "_"), fechamentoAnalitico.get_Dados().ToList<DadosFechamentoAnalitico>(), null);
- }
- }
- }
- else if (this.Fechamento == null || this.Fechamento.Count == 0)
- {
- str = null;
- return;
- }
- else
- {
- List<FechamentoFinanceiro> fechamentoFinanceiros = new List<FechamentoFinanceiro>();
- fechamentoFinanceiros.AddRange(this.Fechamento);
- List<FechamentoFinanceiro> fechamentoFinanceiros1 = fechamentoFinanceiros;
- FechamentoFinanceiro fechamentoFinanceiro = new FechamentoFinanceiro();
- fechamentoFinanceiro.set_Plano("TOTAL NO PERÍODO");
- List<DadosFechamento> dadosFechamentos = new List<DadosFechamento>();
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos("TOTAL");
- List<FechamentoFinanceiro> fechamento = this.Fechamento;
- IEnumerable<FechamentoFinanceiro> plano =
- from x in fechamento
- where x.get_Plano() == "TIPO PAGAMENTO"
- select x;
- dadosFechamento.set_Soma(plano.Sum<FechamentoFinanceiro>((FechamentoFinanceiro x) => x.get_Dados().Sum<DadosFechamento>((DadosFechamento y) => y.get_Soma())));
- dadosFechamentos.Add(dadosFechamento);
- fechamentoFinanceiro.set_Dados(dadosFechamentos);
- fechamentoFinanceiros1.Add(fechamentoFinanceiro);
- num = 1;
- foreach (FechamentoFinanceiro fechamentoFinanceiro1 in fechamentoFinanceiros)
- {
- string str2 = string.Format("{0}_{1}", num, fechamentoFinanceiro1.get_Plano());
- num++;
- while (str2.Replace("/", "_").Trim().Length > 30)
- {
- str2 = Regex.Replace(str2.Trim(), "[^\\s]*$", "");
- }
- xLWorkbook = await Funcoes.GerarXls<DadosFechamento>(xLWorkbook, str2.Replace("/", "_"), fechamentoFinanceiro1.get_Dados().ToList<DadosFechamento>(), null);
- }
- }
- base.RegistrarAcao(string.Format("EMITIU EXCEL DO RELATÓRIO PERÍODO ENTRE {0:d} E {1:d}", this.Inicio, this.Fim), new Relatorio?(11), null);
- xLWorkbook.SaveAs(str);
- Process.Start(str);
- str = null;
- }
-
- private async Task<string> GerarHtml(bool screen)
- {
- string str;
- string str1 = "";
- if (!this.Analitico)
- {
- foreach (FechamentoFinanceiro fechamento in this.Fechamento)
- {
- List<DadosFechamento> dados = fechamento.get_Dados();
- List<string> strs = new List<string>()
- {
- "TOTAL CRÉDITO - TOTAL DÉBITO",
- "% TOTAL DE CRÉDITO - % TOTAL DE DÉBITO"
- };
- string str2 = await Funcoes.GenerateTable<DadosFechamento>(dados, strs, false, screen, "", null);
- str1 = string.Concat(str1, Funcoes.CreateCard(fechamento.get_Plano(), str2, false));
- }
- FechamentoFinanceiro fechamentoFinanceiro = new FechamentoFinanceiro();
- fechamentoFinanceiro.set_Plano("TOTAL NO PERÍODO");
- List<DadosFechamento> dadosFechamentos = new List<DadosFechamento>();
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos("TOTAL");
- List<FechamentoFinanceiro> fechamentoFinanceiros = this.Fechamento;
- IEnumerable<FechamentoFinanceiro> plano =
- from x in fechamentoFinanceiros
- where x.get_Plano() == "TIPO PAGAMENTO"
- select x;
- dadosFechamento.set_Soma(plano.Sum<FechamentoFinanceiro>((FechamentoFinanceiro x) => x.get_Dados().Sum<DadosFechamento>((DadosFechamento y) => y.get_Soma())));
- List<FechamentoFinanceiro> fechamento1 = this.Fechamento;
- IEnumerable<FechamentoFinanceiro> plano1 =
- from x in fechamento1
- where x.get_Plano() == "TIPO PAGAMENTO"
- select x;
- dadosFechamento.set_SomaPercentual(plano1.Sum<FechamentoFinanceiro>((FechamentoFinanceiro x) => x.get_Dados().Sum<DadosFechamento>((DadosFechamento y) => y.get_SomaPercentual())));
- dadosFechamentos.Add(dadosFechamento);
- fechamentoFinanceiro.set_Dados(dadosFechamentos);
- FechamentoFinanceiro fechamentoFinanceiro1 = fechamentoFinanceiro;
- List<DadosFechamento> dados1 = fechamentoFinanceiro1.get_Dados();
- List<string> strs1 = new List<string>()
- {
- "TOTAL CRÉDITO",
- "TOTAL DÉBITO",
- "% CRÉDITO",
- "% DÉBITO"
- };
- string str3 = await Funcoes.GenerateTable<DadosFechamento>(dados1, strs1, false, screen, "", null);
- str1 = string.Concat(str1, Funcoes.CreateCard(fechamentoFinanceiro1.get_Plano(), str3, false));
- fechamentoFinanceiro1 = null;
- }
- else
- {
- foreach (FechamentoFinanceiroAnalitico fechamentoAnalitico in this.FechamentoAnalitico)
- {
- string str4 = await Funcoes.GenerateTable<DadosFechamentoAnalitico>(fechamentoAnalitico.get_Dados(), new List<string>(), false, screen, "", null);
- str1 = string.Concat(str1, Funcoes.CreateCard(fechamentoAnalitico.get_NomeConta(), str4, false));
- }
- }
- if (!this.Inicio.HasValue || !this.Fim.HasValue)
- {
- str = null;
- }
- else
- {
- TipoRelatorio tipoRelatorio = new TipoRelatorio();
- tipoRelatorio.set_Nome((this.Analitico ? "RELATÓRIO FECHAMENTO FINANCEIRO ANALÍTICO" : "RELATÓRIO FECHAMENTO FINANCEIRO"));
- tipoRelatorio.set_Inicio(this.Inicio.Value);
- tipoRelatorio.set_Fim(this.Fim.Value);
- str = Funcoes.ExportarHtml(tipoRelatorio, str1, "50", "portrait", false, "");
- }
- str1 = null;
- return str;
- }
-
- public async Task GerarRelatorio()
- {
- decimal num7;
- decimal num8;
- decimal num9;
- decimal num10;
- decimal num11;
- decimal num12;
- decimal num13;
- decimal num14;
- decimal num15;
- decimal num16;
- decimal num17;
- Func<Lancamento, bool> func8 = null;
- Func<Lancamento, bool> func9 = null;
- Func<Lancamento, bool> func10 = null;
- Func<Lancamento, bool> func11 = null;
- Func<Lancamento, bool> func12 = null;
- Func<Lancamento, bool> func13 = null;
- Func<Lancamento, bool> func14 = null;
- Func<Lancamento, bool> func15 = null;
- Func<Lancamento, bool> func16 = null;
- Func<Lancamento, bool> func17 = null;
- Func<Lancamento, bool> func18 = null;
- Func<Lancamento, bool> func19 = null;
- if (this.Inicio.HasValue && this.Fim.HasValue)
- {
- List<Gestor.Model.Domain.Financeiro.Plano> planos = this.Plano;
- IEnumerable<Gestor.Model.Domain.Financeiro.Plano> selecionado =
- from x in planos
- where x.get_Selecionado()
- select x;
- List<long> nums20 = (
- from x in selecionado
- select x.get_Id()).ToList<long>();
- List<Gestor.Model.Domain.Financeiro.Planos> planos1 = this.Planos;
- IEnumerable<Gestor.Model.Domain.Financeiro.Planos> selecionado1 =
- from x in planos1
- where x.get_Selecionado()
- select x;
- List<long> nums21 = (
- from x in selecionado1
- select x.get_Id()).ToList<long>();
- List<Gestor.Model.Domain.Financeiro.Centro> centro = this.Centro;
- IEnumerable<Gestor.Model.Domain.Financeiro.Centro> centros =
- from x in centro
- where x.get_Selecionado()
- select x;
- List<long> nums22 = (
- from x in centros
- select x.get_Id()).ToList<long>();
- List<BancosContas> conta = this.Conta;
- IEnumerable<BancosContas> bancosContas =
- from x in conta
- where x.get_Selecionado()
- select x;
- List<long> nums23 = (
- from x in bancosContas
- select x.get_Id()).ToList<long>();
- FiltroFinanceiro filtroFinanceiro = new FiltroFinanceiro();
- filtroFinanceiro.set_Inicio(this.Inicio.Value);
- filtroFinanceiro.set_Fim(this.Fim.Value);
- filtroFinanceiro.set_Plano(nums20);
- filtroFinanceiro.set_Planos(nums21);
- filtroFinanceiro.set_Centro(nums22);
- filtroFinanceiro.set_Conta(nums23);
- filtroFinanceiro.set_Referencia("l.dtbaixa");
- FiltroFinanceiro filtroFinanceiro1 = filtroFinanceiro;
- List<Lancamento> lancamentos13 = await this._servico.BuscarFechamento(filtroFinanceiro1);
- if (!this.Analitico)
- {
- this.Fechamento = new List<FechamentoFinanceiro>();
- List<Lancamento> lancamentos14 = lancamentos13;
- IEnumerable<Lancamento> lancamentos15 = lancamentos14.Where<Lancamento>((Lancamento x) => {
- object plano;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = null;
- }
- return plano != null;
- });
- IOrderedEnumerable<Lancamento> nome =
- from x in lancamentos15
- orderby x.get_Controle().get_Plano().get_Nome()
- select x;
- (
- from x in nome
- group x by x.get_Controle().get_Plano().get_Plano().get_Id()).ToList<IGrouping<long, Lancamento>>().ForEach((IGrouping<long, Lancamento> x) => {
- decimal num3;
- decimal num4;
- FechamentoFinanceiro fechamentoFinanceiro = new FechamentoFinanceiro();
- fechamentoFinanceiro.set_Plano(x.First<Lancamento>().get_Controle().get_Plano().get_Nome().ToUpper());
- IGrouping<long, Lancamento> nums8 = x;
- Func<Lancamento, string> u003cu003e9_5197 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_97;
- if (u003cu003e9_5197 == null)
- {
- u003cu003e9_5197 = (Lancamento f) => f.get_Controle().get_Plano().get_Nome();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_97 = u003cu003e9_5197;
- }
- IOrderedEnumerable<Lancamento> lancamentos8 = nums8.OrderBy<Lancamento, string>(u003cu003e9_5197);
- Func<Lancamento, long> u003cu003e9_5198 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_98;
- if (u003cu003e9_5198 == null)
- {
- u003cu003e9_5198 = (Lancamento f) => f.get_Controle().get_Plano().get_Id();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_98 = u003cu003e9_5198;
- }
- fechamentoFinanceiro.set_Dados(lancamentos8.GroupBy<Lancamento, long>(u003cu003e9_5198).Select<IGrouping<long, Lancamento>, DadosFechamento>((IGrouping<long, Lancamento> f) => {
- decimal zero;
- decimal num;
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(f.First<Lancamento>().get_Controle().get_Plano().get_Descricao());
- IGrouping<long, Lancamento> nums = f;
- Func<Lancamento, bool> u003cu003e9_51100 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_100;
- if (u003cu003e9_51100 == null)
- {
- u003cu003e9_51100 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_100 = u003cu003e9_51100;
- }
- IEnumerable<Lancamento> lancamentos = nums.Where<Lancamento>(u003cu003e9_51100);
- Func<Lancamento, decimal> u003cu003e9_51101 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_101;
- if (u003cu003e9_51101 == null)
- {
- u003cu003e9_51101 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_101 = u003cu003e9_51101;
- }
- dadosFechamento.set_Credito(lancamentos.Sum<Lancamento>(u003cu003e9_51101));
- IGrouping<long, Lancamento> nums1 = f;
- Func<Lancamento, bool> u003cu003e9_51102 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_102;
- if (u003cu003e9_51102 == null)
- {
- u003cu003e9_51102 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_102 = u003cu003e9_51102;
- }
- IEnumerable<Lancamento> lancamentos1 = nums1.Where<Lancamento>(u003cu003e9_51102);
- Func<Lancamento, decimal> u003cu003e9_51103 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_103;
- if (u003cu003e9_51103 == null)
- {
- u003cu003e9_51103 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_103 = u003cu003e9_51103;
- }
- if (lancamentos1.Sum<Lancamento>(u003cu003e9_51103) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums2 = f;
- Func<Lancamento, bool> u003cu003e9_51104 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_104;
- if (u003cu003e9_51104 == null)
- {
- u003cu003e9_51104 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_104 = u003cu003e9_51104;
- }
- IEnumerable<Lancamento> lancamentos2 = nums2.Where<Lancamento>(u003cu003e9_51104);
- Func<Lancamento, decimal> u003cu003e9_51105 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_105;
- if (u003cu003e9_51105 == null)
- {
- u003cu003e9_51105 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_105 = u003cu003e9_51105;
- }
- decimal num1 = lancamentos2.Sum<Lancamento>(u003cu003e9_51105);
- IGrouping<long, Lancamento> nums3 = x;
- Func<Lancamento, bool> u003cu003e9_51106 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_106;
- if (u003cu003e9_51106 == null)
- {
- u003cu003e9_51106 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_106 = u003cu003e9_51106;
- }
- IEnumerable<Lancamento> lancamentos3 = nums3.Where<Lancamento>(u003cu003e9_51106);
- Func<Lancamento, decimal> u003cu003e9_51107 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_107;
- if (u003cu003e9_51107 == null)
- {
- u003cu003e9_51107 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_107 = u003cu003e9_51107;
- }
- zero = (num1 / lancamentos3.Sum<Lancamento>(u003cu003e9_51107)) * new decimal(100);
- }
- dadosFechamento.set_PercentualCredito(zero);
- IGrouping<long, Lancamento> nums4 = f;
- Func<Lancamento, bool> u003cu003e9_51108 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_108;
- if (u003cu003e9_51108 == null)
- {
- u003cu003e9_51108 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_108 = u003cu003e9_51108;
- }
- IEnumerable<Lancamento> lancamentos4 = nums4.Where<Lancamento>(u003cu003e9_51108);
- Func<Lancamento, decimal> u003cu003e9_51109 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_109;
- if (u003cu003e9_51109 == null)
- {
- u003cu003e9_51109 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_109 = u003cu003e9_51109;
- }
- dadosFechamento.set_Debito(lancamentos4.Sum<Lancamento>(u003cu003e9_51109));
- IGrouping<long, Lancamento> nums5 = f;
- Func<Lancamento, bool> u003cu003e9_51110 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_110;
- if (u003cu003e9_51110 == null)
- {
- u003cu003e9_51110 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_110 = u003cu003e9_51110;
- }
- IEnumerable<Lancamento> lancamentos5 = nums5.Where<Lancamento>(u003cu003e9_51110);
- Func<Lancamento, decimal> u003cu003e9_51111 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_111;
- if (u003cu003e9_51111 == null)
- {
- u003cu003e9_51111 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_111 = u003cu003e9_51111;
- }
- if (lancamentos5.Sum<Lancamento>(u003cu003e9_51111) == decimal.Zero)
- {
- num = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums6 = f;
- Func<Lancamento, bool> u003cu003e9_51112 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_112;
- if (u003cu003e9_51112 == null)
- {
- u003cu003e9_51112 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_112 = u003cu003e9_51112;
- }
- IEnumerable<Lancamento> lancamentos6 = nums6.Where<Lancamento>(u003cu003e9_51112);
- Func<Lancamento, decimal> u003cu003e9_51113 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_113;
- if (u003cu003e9_51113 == null)
- {
- u003cu003e9_51113 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_113 = u003cu003e9_51113;
- }
- decimal num2 = lancamentos6.Sum<Lancamento>(u003cu003e9_51113);
- IGrouping<long, Lancamento> nums7 = x;
- Func<Lancamento, bool> u003cu003e9_51114 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_114;
- if (u003cu003e9_51114 == null)
- {
- u003cu003e9_51114 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_114 = u003cu003e9_51114;
- }
- IEnumerable<Lancamento> lancamentos7 = nums7.Where<Lancamento>(u003cu003e9_51114);
- Func<Lancamento, decimal> u003cu003e9_51115 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_115;
- if (u003cu003e9_51115 == null)
- {
- u003cu003e9_51115 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_115 = u003cu003e9_51115;
- }
- num = (num2 / lancamentos7.Sum<Lancamento>(u003cu003e9_51115)) * new decimal(100);
- }
- dadosFechamento.set_PercentualDebito(num);
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro1 = fechamentoFinanceiro;
- List<DadosFechamento> dados = fechamentoFinanceiro1.get_Dados();
- DadosFechamento dadosFechamento1 = new DadosFechamento();
- dadosFechamento1.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51116 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_116;
- if (u003cu003e9_51116 == null)
- {
- u003cu003e9_51116 = (DadosFechamento t) => t.get_Credito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_116 = u003cu003e9_51116;
- }
- dadosFechamento1.set_Credito(dadosFechamentos.Sum<DadosFechamento>(u003cu003e9_51116));
- List<DadosFechamento> dados1 = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51117 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_117;
- if (u003cu003e9_51117 == null)
- {
- u003cu003e9_51117 = (DadosFechamento t) => t.get_Debito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_117 = u003cu003e9_51117;
- }
- dadosFechamento1.set_Debito(dados1.Sum<DadosFechamento>(u003cu003e9_51117));
- List<DadosFechamento> dadosFechamentos1 = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51118 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_118;
- if (u003cu003e9_51118 == null)
- {
- u003cu003e9_51118 = (DadosFechamento t) => t.get_Credito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_118 = u003cu003e9_51118;
- }
- if (dadosFechamentos1.Sum<DadosFechamento>(u003cu003e9_51118) == decimal.Zero)
- {
- num3 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dados2 = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51119 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_119;
- if (u003cu003e9_51119 == null)
- {
- u003cu003e9_51119 = (DadosFechamento t) => t.get_Credito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_119 = u003cu003e9_51119;
- }
- decimal num5 = dados2.Sum<DadosFechamento>(u003cu003e9_51119);
- List<Lancamento> lancamentos9 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51120 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_120;
- if (u003cu003e9_51120 == null)
- {
- u003cu003e9_51120 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_120 = u003cu003e9_51120;
- }
- IEnumerable<Lancamento> lancamentos10 = lancamentos9.Where<Lancamento>(u003cu003e9_51120);
- Func<Lancamento, decimal> u003cu003e9_51121 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_121;
- if (u003cu003e9_51121 == null)
- {
- u003cu003e9_51121 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_121 = u003cu003e9_51121;
- }
- num3 = (num5 / lancamentos10.Sum<Lancamento>(u003cu003e9_51121)) * new decimal(100);
- }
- dadosFechamento1.set_PercentualCredito(num3);
- List<DadosFechamento> dadosFechamentos2 = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51122 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_122;
- if (u003cu003e9_51122 == null)
- {
- u003cu003e9_51122 = (DadosFechamento t) => t.get_Debito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_122 = u003cu003e9_51122;
- }
- if (dadosFechamentos2.Sum<DadosFechamento>(u003cu003e9_51122) == decimal.Zero)
- {
- num4 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dados3 = fechamentoFinanceiro1.get_Dados();
- Func<DadosFechamento, decimal> u003cu003e9_51123 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_123;
- if (u003cu003e9_51123 == null)
- {
- u003cu003e9_51123 = (DadosFechamento t) => t.get_Debito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_123 = u003cu003e9_51123;
- }
- decimal num6 = dados3.Sum<DadosFechamento>(u003cu003e9_51123);
- List<Lancamento> lancamentos11 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51124 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_124;
- if (u003cu003e9_51124 == null)
- {
- u003cu003e9_51124 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_124 = u003cu003e9_51124;
- }
- IEnumerable<Lancamento> lancamentos12 = lancamentos11.Where<Lancamento>(u003cu003e9_51124);
- Func<Lancamento, decimal> u003cu003e9_51125 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_125;
- if (u003cu003e9_51125 == null)
- {
- u003cu003e9_51125 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_125 = u003cu003e9_51125;
- }
- num4 = (num6 / lancamentos12.Sum<Lancamento>(u003cu003e9_51125)) * new decimal(100);
- }
- dadosFechamento1.set_PercentualDebito(num4);
- dados.Add(dadosFechamento1);
- this.Fechamento.Add(fechamentoFinanceiro1);
- });
- FechamentoFinanceiro fechamentoFinanceiro2 = new FechamentoFinanceiro();
- fechamentoFinanceiro2.set_Plano("CONTA CORRENTE");
- List<Lancamento> lancamentos16 = lancamentos13;
- IEnumerable<Lancamento> lancamentos17 = lancamentos16.Where<Lancamento>((Lancamento x) => {
- object plano;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = null;
- }
- return plano != null;
- });
- IOrderedEnumerable<Lancamento> descricao =
- from x in lancamentos17
- orderby x.get_Conta().get_Descricao()
- select x;
- fechamentoFinanceiro2.set_Dados((
- from x in descricao
- group x by x.get_Conta().get_Id()).Select<IGrouping<long, Lancamento>, DadosFechamento>((IGrouping<long, Lancamento> f) => {
- decimal zero;
- decimal num;
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(f.First<Lancamento>().get_Conta().get_Descricao());
- IGrouping<long, Lancamento> nums = f;
- Func<Lancamento, bool> u003cu003e9_51130 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_130;
- if (u003cu003e9_51130 == null)
- {
- u003cu003e9_51130 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_130 = u003cu003e9_51130;
- }
- IEnumerable<Lancamento> lancamentos = nums.Where<Lancamento>(u003cu003e9_51130);
- Func<Lancamento, decimal> u003cu003e9_51131 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_131;
- if (u003cu003e9_51131 == null)
- {
- u003cu003e9_51131 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_131 = u003cu003e9_51131;
- }
- dadosFechamento.set_Credito(lancamentos.Sum<Lancamento>(u003cu003e9_51131));
- IGrouping<long, Lancamento> nums1 = f;
- Func<Lancamento, bool> u003cu003e9_51132 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_132;
- if (u003cu003e9_51132 == null)
- {
- u003cu003e9_51132 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_132 = u003cu003e9_51132;
- }
- IEnumerable<Lancamento> lancamentos1 = nums1.Where<Lancamento>(u003cu003e9_51132);
- Func<Lancamento, decimal> u003cu003e9_51133 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_133;
- if (u003cu003e9_51133 == null)
- {
- u003cu003e9_51133 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_133 = u003cu003e9_51133;
- }
- if (lancamentos1.Sum<Lancamento>(u003cu003e9_51133) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums2 = f;
- Func<Lancamento, bool> u003cu003e9_51134 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_134;
- if (u003cu003e9_51134 == null)
- {
- u003cu003e9_51134 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_134 = u003cu003e9_51134;
- }
- IEnumerable<Lancamento> lancamentos2 = nums2.Where<Lancamento>(u003cu003e9_51134);
- Func<Lancamento, decimal> u003cu003e9_51135 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_135;
- if (u003cu003e9_51135 == null)
- {
- u003cu003e9_51135 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_135 = u003cu003e9_51135;
- }
- decimal num1 = lancamentos2.Sum<Lancamento>(u003cu003e9_51135);
- List<Lancamento> lancamentos3 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51136 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_136;
- if (u003cu003e9_51136 == null)
- {
- u003cu003e9_51136 = (Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 0;
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_136 = u003cu003e9_51136;
- }
- IEnumerable<Lancamento> lancamentos4 = lancamentos3.Where<Lancamento>(u003cu003e9_51136);
- Func<Lancamento, decimal> u003cu003e9_51137 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_137;
- if (u003cu003e9_51137 == null)
- {
- u003cu003e9_51137 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_137 = u003cu003e9_51137;
- }
- zero = (num1 / lancamentos4.Sum<Lancamento>(u003cu003e9_51137)) * new decimal(100);
- }
- dadosFechamento.set_PercentualCredito(zero);
- IGrouping<long, Lancamento> nums3 = f;
- Func<Lancamento, bool> u003cu003e9_51138 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_138;
- if (u003cu003e9_51138 == null)
- {
- u003cu003e9_51138 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_138 = u003cu003e9_51138;
- }
- IEnumerable<Lancamento> lancamentos5 = nums3.Where<Lancamento>(u003cu003e9_51138);
- Func<Lancamento, decimal> u003cu003e9_51139 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_139;
- if (u003cu003e9_51139 == null)
- {
- u003cu003e9_51139 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_139 = u003cu003e9_51139;
- }
- dadosFechamento.set_Debito(lancamentos5.Sum<Lancamento>(u003cu003e9_51139));
- IGrouping<long, Lancamento> nums4 = f;
- Func<Lancamento, bool> u003cu003e9_51140 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_140;
- if (u003cu003e9_51140 == null)
- {
- u003cu003e9_51140 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_140 = u003cu003e9_51140;
- }
- IEnumerable<Lancamento> lancamentos6 = nums4.Where<Lancamento>(u003cu003e9_51140);
- Func<Lancamento, decimal> u003cu003e9_51141 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_141;
- if (u003cu003e9_51141 == null)
- {
- u003cu003e9_51141 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_141 = u003cu003e9_51141;
- }
- if (lancamentos6.Sum<Lancamento>(u003cu003e9_51141) == decimal.Zero)
- {
- num = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums5 = f;
- Func<Lancamento, bool> u003cu003e9_51142 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_142;
- if (u003cu003e9_51142 == null)
- {
- u003cu003e9_51142 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_142 = u003cu003e9_51142;
- }
- IEnumerable<Lancamento> lancamentos7 = nums5.Where<Lancamento>(u003cu003e9_51142);
- Func<Lancamento, decimal> u003cu003e9_51143 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_143;
- if (u003cu003e9_51143 == null)
- {
- u003cu003e9_51143 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_143 = u003cu003e9_51143;
- }
- decimal num2 = lancamentos7.Sum<Lancamento>(u003cu003e9_51143);
- List<Lancamento> lancamentos8 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51144 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_144;
- if (u003cu003e9_51144 == null)
- {
- u003cu003e9_51144 = (Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 1;
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_144 = u003cu003e9_51144;
- }
- IEnumerable<Lancamento> lancamentos9 = lancamentos8.Where<Lancamento>(u003cu003e9_51144);
- Func<Lancamento, decimal> u003cu003e9_51145 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_145;
- if (u003cu003e9_51145 == null)
- {
- u003cu003e9_51145 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_145 = u003cu003e9_51145;
- }
- num = (num2 / lancamentos9.Sum<Lancamento>(u003cu003e9_51145)) * new decimal(100);
- }
- dadosFechamento.set_PercentualDebito(num);
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro3 = fechamentoFinanceiro2;
- List<DadosFechamento> dadosFechamentos3 = fechamentoFinanceiro3.get_Dados();
- DadosFechamento dadosFechamento2 = new DadosFechamento();
- dadosFechamento2.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos4 = fechamentoFinanceiro3.get_Dados();
- dadosFechamento2.set_Credito(dadosFechamentos4.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()));
- List<DadosFechamento> dadosFechamentos5 = fechamentoFinanceiro3.get_Dados();
- dadosFechamento2.set_Debito(dadosFechamentos5.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos6 = fechamentoFinanceiro3.get_Dados();
- if (dadosFechamentos6.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()) == decimal.Zero)
- {
- num7 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos7 = fechamentoFinanceiro3.get_Dados();
- decimal num18 = dadosFechamentos7.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<Lancamento> lancamentos18 = lancamentos13;
- IEnumerable<Lancamento> lancamentos19 = lancamentos18.Where<Lancamento>((Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 0;
- });
- num7 = (num18 / lancamentos19.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento2.set_PercentualCredito(num7);
- List<DadosFechamento> dadosFechamentos8 = fechamentoFinanceiro3.get_Dados();
- if (dadosFechamentos8.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()) == decimal.Zero)
- {
- num8 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos9 = fechamentoFinanceiro3.get_Dados();
- decimal num19 = dadosFechamentos9.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito());
- List<Lancamento> lancamentos20 = lancamentos13;
- IEnumerable<Lancamento> lancamentos21 = lancamentos20.Where<Lancamento>((Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 1;
- });
- num8 = (num19 / lancamentos21.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento2.set_PercentualDebito(num8);
- dadosFechamentos3.Add(dadosFechamento2);
- this.Fechamento.Add(fechamentoFinanceiro3);
- FechamentoFinanceiro fechamentoFinanceiro4 = new FechamentoFinanceiro();
- fechamentoFinanceiro4.set_Plano("TRANSFERÊNCIA");
- List<Lancamento> lancamentos22 = lancamentos13;
- IEnumerable<Lancamento> lancamentos23 = lancamentos22.Where<Lancamento>((Lancamento x) => {
- object plano;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = null;
- }
- return plano == null;
- });
- IOrderedEnumerable<Lancamento> descricao1 =
- from x in lancamentos23
- orderby x.get_Conta().get_Descricao()
- select x;
- IEnumerable<IGrouping<long, Lancamento>> id =
- from x in descricao1
- group x by x.get_Conta().get_Id();
- fechamentoFinanceiro4.set_Dados(id.Select<IGrouping<long, Lancamento>, DadosFechamento>((IGrouping<long, Lancamento> f) => {
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(f.First<Lancamento>().get_Conta().get_Descricao());
- dadosFechamento.set_Credito((
- from s in f
- where s.get_Sinal() == 0
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()));
- dadosFechamento.set_PercentualCredito(((
- from s in f
- where s.get_Sinal() == 0
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) == decimal.Zero ? decimal.Zero : ((
- from s in f
- where s.get_Sinal() == 0
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) / (
- from s in f
- where s.get_Sinal() == 0
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100)));
- dadosFechamento.set_Debito((
- from s in f
- where s.get_Sinal() == 1
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()));
- dadosFechamento.set_PercentualDebito(((
- from s in f
- where s.get_Sinal() == 1
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) == decimal.Zero ? decimal.Zero : ((
- from s in f
- where s.get_Sinal() == 1
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) / (
- from s in f
- where s.get_Sinal() == 1
- select s).Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100)));
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro5 = fechamentoFinanceiro4;
- List<DadosFechamento> dadosFechamentos10 = fechamentoFinanceiro5.get_Dados();
- DadosFechamento dadosFechamento3 = new DadosFechamento();
- dadosFechamento3.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos11 = fechamentoFinanceiro5.get_Dados();
- dadosFechamento3.set_Credito(dadosFechamentos11.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()));
- List<DadosFechamento> dadosFechamentos12 = fechamentoFinanceiro5.get_Dados();
- dadosFechamento3.set_Debito(dadosFechamentos12.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos13 = fechamentoFinanceiro5.get_Dados();
- if (dadosFechamentos13.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()) == decimal.Zero)
- {
- num9 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos14 = fechamentoFinanceiro5.get_Dados();
- decimal num20 = dadosFechamentos14.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<Lancamento> lancamentos24 = lancamentos13;
- IEnumerable<Lancamento> lancamentos25 = lancamentos24.Where<Lancamento>((Lancamento s) => {
- bool plano;
- ControleFinanceiro controle = s.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = false;
- }
- if (plano)
- {
- return false;
- }
- return s.get_Sinal() == 0;
- });
- num9 = (num20 / lancamentos25.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento3.set_PercentualCredito(num9);
- List<DadosFechamento> dadosFechamentos15 = fechamentoFinanceiro5.get_Dados();
- if (dadosFechamentos15.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()) == decimal.Zero)
- {
- num10 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos16 = fechamentoFinanceiro5.get_Dados();
- decimal num21 = dadosFechamentos16.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito());
- List<Lancamento> lancamentos26 = lancamentos13;
- IEnumerable<Lancamento> lancamentos27 = lancamentos26.Where<Lancamento>((Lancamento s) => {
- bool plano;
- ControleFinanceiro controle = s.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = false;
- }
- if (plano)
- {
- return false;
- }
- return s.get_Sinal() == 1;
- });
- num10 = (num21 / lancamentos27.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento3.set_PercentualDebito(num10);
- dadosFechamentos10.Add(dadosFechamento3);
- this.Fechamento.Add(fechamentoFinanceiro5);
- FechamentoFinanceiro fechamentoFinanceiro6 = new FechamentoFinanceiro();
- fechamentoFinanceiro6.set_Plano("CONTA CORRENTE + TRANSFERÊNCIA");
- List<Lancamento> lancamentos28 = lancamentos13;
- IOrderedEnumerable<Lancamento> descricao2 =
- from x in lancamentos28
- orderby x.get_Conta().get_Descricao()
- select x;
- fechamentoFinanceiro6.set_Dados((
- from x in descricao2
- group x by x.get_Conta().get_Id()).Select<IGrouping<long, Lancamento>, DadosFechamento>((IGrouping<long, Lancamento> f) => {
- decimal zero;
- decimal num;
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(f.First<Lancamento>().get_Conta().get_Descricao());
- IGrouping<long, Lancamento> nums = f;
- Func<Lancamento, bool> u003cu003e9_51189 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_189;
- if (u003cu003e9_51189 == null)
- {
- u003cu003e9_51189 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_189 = u003cu003e9_51189;
- }
- IEnumerable<Lancamento> lancamentos = nums.Where<Lancamento>(u003cu003e9_51189);
- Func<Lancamento, decimal> u003cu003e9_51190 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_190;
- if (u003cu003e9_51190 == null)
- {
- u003cu003e9_51190 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_190 = u003cu003e9_51190;
- }
- dadosFechamento.set_Credito(lancamentos.Sum<Lancamento>(u003cu003e9_51190));
- IGrouping<long, Lancamento> nums1 = f;
- Func<Lancamento, bool> u003cu003e9_51191 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_191;
- if (u003cu003e9_51191 == null)
- {
- u003cu003e9_51191 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_191 = u003cu003e9_51191;
- }
- IEnumerable<Lancamento> lancamentos1 = nums1.Where<Lancamento>(u003cu003e9_51191);
- Func<Lancamento, decimal> u003cu003e9_51192 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_192;
- if (u003cu003e9_51192 == null)
- {
- u003cu003e9_51192 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_192 = u003cu003e9_51192;
- }
- if (lancamentos1.Sum<Lancamento>(u003cu003e9_51192) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums2 = f;
- Func<Lancamento, bool> u003cu003e9_51193 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_193;
- if (u003cu003e9_51193 == null)
- {
- u003cu003e9_51193 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_193 = u003cu003e9_51193;
- }
- IEnumerable<Lancamento> lancamentos2 = nums2.Where<Lancamento>(u003cu003e9_51193);
- Func<Lancamento, decimal> u003cu003e9_51194 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_194;
- if (u003cu003e9_51194 == null)
- {
- u003cu003e9_51194 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_194 = u003cu003e9_51194;
- }
- decimal num1 = lancamentos2.Sum<Lancamento>(u003cu003e9_51194);
- List<Lancamento> lancamentos3 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51195 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_195;
- if (u003cu003e9_51195 == null)
- {
- u003cu003e9_51195 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_195 = u003cu003e9_51195;
- }
- IEnumerable<Lancamento> lancamentos4 = lancamentos3.Where<Lancamento>(u003cu003e9_51195);
- Func<Lancamento, decimal> u003cu003e9_51196 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_196;
- if (u003cu003e9_51196 == null)
- {
- u003cu003e9_51196 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_196 = u003cu003e9_51196;
- }
- zero = (num1 / lancamentos4.Sum<Lancamento>(u003cu003e9_51196)) * new decimal(100);
- }
- dadosFechamento.set_PercentualCredito(zero);
- IGrouping<long, Lancamento> nums3 = f;
- Func<Lancamento, bool> u003cu003e9_51197 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_197;
- if (u003cu003e9_51197 == null)
- {
- u003cu003e9_51197 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_197 = u003cu003e9_51197;
- }
- IEnumerable<Lancamento> lancamentos5 = nums3.Where<Lancamento>(u003cu003e9_51197);
- Func<Lancamento, decimal> u003cu003e9_51198 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_198;
- if (u003cu003e9_51198 == null)
- {
- u003cu003e9_51198 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_198 = u003cu003e9_51198;
- }
- dadosFechamento.set_Debito(lancamentos5.Sum<Lancamento>(u003cu003e9_51198));
- IGrouping<long, Lancamento> nums4 = f;
- Func<Lancamento, bool> u003cu003e9_51199 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_199;
- if (u003cu003e9_51199 == null)
- {
- u003cu003e9_51199 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_199 = u003cu003e9_51199;
- }
- IEnumerable<Lancamento> lancamentos6 = nums4.Where<Lancamento>(u003cu003e9_51199);
- Func<Lancamento, decimal> u003cu003e9_51200 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_200;
- if (u003cu003e9_51200 == null)
- {
- u003cu003e9_51200 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_200 = u003cu003e9_51200;
- }
- if (lancamentos6.Sum<Lancamento>(u003cu003e9_51200) == decimal.Zero)
- {
- num = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums5 = f;
- Func<Lancamento, bool> u003cu003e9_51201 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_201;
- if (u003cu003e9_51201 == null)
- {
- u003cu003e9_51201 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_201 = u003cu003e9_51201;
- }
- IEnumerable<Lancamento> lancamentos7 = nums5.Where<Lancamento>(u003cu003e9_51201);
- Func<Lancamento, decimal> u003cu003e9_51202 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_202;
- if (u003cu003e9_51202 == null)
- {
- u003cu003e9_51202 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_202 = u003cu003e9_51202;
- }
- decimal num2 = lancamentos7.Sum<Lancamento>(u003cu003e9_51202);
- List<Lancamento> lancamentos8 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51203 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_203;
- if (u003cu003e9_51203 == null)
- {
- u003cu003e9_51203 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_203 = u003cu003e9_51203;
- }
- IEnumerable<Lancamento> lancamentos9 = lancamentos8.Where<Lancamento>(u003cu003e9_51203);
- Func<Lancamento, decimal> u003cu003e9_51204 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_204;
- if (u003cu003e9_51204 == null)
- {
- u003cu003e9_51204 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_204 = u003cu003e9_51204;
- }
- num = (num2 / lancamentos9.Sum<Lancamento>(u003cu003e9_51204)) * new decimal(100);
- }
- dadosFechamento.set_PercentualDebito(num);
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro7 = fechamentoFinanceiro6;
- List<DadosFechamento> dadosFechamentos17 = fechamentoFinanceiro7.get_Dados();
- DadosFechamento dadosFechamento4 = new DadosFechamento();
- dadosFechamento4.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos18 = fechamentoFinanceiro7.get_Dados();
- dadosFechamento4.set_Credito(dadosFechamentos18.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()));
- List<DadosFechamento> dadosFechamentos19 = fechamentoFinanceiro7.get_Dados();
- dadosFechamento4.set_Debito(dadosFechamentos19.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos20 = fechamentoFinanceiro7.get_Dados();
- if (dadosFechamentos20.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()) == decimal.Zero)
- {
- num11 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos21 = fechamentoFinanceiro7.get_Dados();
- decimal num22 = dadosFechamentos21.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<Lancamento> lancamentos29 = lancamentos13;
- IEnumerable<Lancamento> sinal =
- from s in lancamentos29
- where s.get_Sinal() == 0
- select s;
- num11 = (num22 / sinal.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento4.set_PercentualCredito(num11);
- List<DadosFechamento> dadosFechamentos22 = fechamentoFinanceiro7.get_Dados();
- if (dadosFechamentos22.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()) == decimal.Zero)
- {
- num12 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos23 = fechamentoFinanceiro7.get_Dados();
- decimal num23 = dadosFechamentos23.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito());
- List<Lancamento> lancamentos30 = lancamentos13;
- IEnumerable<Lancamento> sinal1 =
- from s in lancamentos30
- where s.get_Sinal() == 1
- select s;
- num12 = (num23 / sinal1.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento4.set_PercentualDebito(num12);
- dadosFechamentos17.Add(dadosFechamento4);
- this.Fechamento.Add(fechamentoFinanceiro7);
- FechamentoFinanceiro fechamentoFinanceiro8 = new FechamentoFinanceiro();
- fechamentoFinanceiro8.set_Plano("CENTRO DE CUSTO");
- List<Lancamento> lancamentos31 = lancamentos13;
- IEnumerable<Lancamento> lancamentos32 = lancamentos31.Where<Lancamento>((Lancamento x) => {
- object plano;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = null;
- }
- return plano != null;
- });
- IOrderedEnumerable<Lancamento> descricao3 =
- from x in lancamentos32
- orderby x.get_Controle().get_Centro().get_Descricao()
- select x;
- fechamentoFinanceiro8.set_Dados((
- from x in descricao3
- group x by x.get_Controle().get_Centro().get_Id()).Select<IGrouping<long, Lancamento>, DadosFechamento>((IGrouping<long, Lancamento> f) => {
- decimal zero;
- decimal num;
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(f.First<Lancamento>().get_Controle().get_Centro().get_Descricao());
- IGrouping<long, Lancamento> nums = f;
- Func<Lancamento, bool> u003cu003e9_51219 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_219;
- if (u003cu003e9_51219 == null)
- {
- u003cu003e9_51219 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_219 = u003cu003e9_51219;
- }
- IEnumerable<Lancamento> lancamentos = nums.Where<Lancamento>(u003cu003e9_51219);
- Func<Lancamento, decimal> u003cu003e9_51220 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_220;
- if (u003cu003e9_51220 == null)
- {
- u003cu003e9_51220 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_220 = u003cu003e9_51220;
- }
- dadosFechamento.set_Credito(lancamentos.Sum<Lancamento>(u003cu003e9_51220));
- IGrouping<long, Lancamento> nums1 = f;
- Func<Lancamento, bool> u003cu003e9_51221 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_221;
- if (u003cu003e9_51221 == null)
- {
- u003cu003e9_51221 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_221 = u003cu003e9_51221;
- }
- IEnumerable<Lancamento> lancamentos1 = nums1.Where<Lancamento>(u003cu003e9_51221);
- Func<Lancamento, decimal> u003cu003e9_51222 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_222;
- if (u003cu003e9_51222 == null)
- {
- u003cu003e9_51222 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_222 = u003cu003e9_51222;
- }
- if (lancamentos1.Sum<Lancamento>(u003cu003e9_51222) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums2 = f;
- Func<Lancamento, bool> u003cu003e9_51223 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_223;
- if (u003cu003e9_51223 == null)
- {
- u003cu003e9_51223 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_223 = u003cu003e9_51223;
- }
- IEnumerable<Lancamento> lancamentos2 = nums2.Where<Lancamento>(u003cu003e9_51223);
- Func<Lancamento, decimal> u003cu003e9_51224 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_224;
- if (u003cu003e9_51224 == null)
- {
- u003cu003e9_51224 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_224 = u003cu003e9_51224;
- }
- decimal num1 = lancamentos2.Sum<Lancamento>(u003cu003e9_51224);
- List<Lancamento> lancamentos3 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51225 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_225;
- if (u003cu003e9_51225 == null)
- {
- u003cu003e9_51225 = (Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 0;
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_225 = u003cu003e9_51225;
- }
- IEnumerable<Lancamento> lancamentos4 = lancamentos3.Where<Lancamento>(u003cu003e9_51225);
- Func<Lancamento, decimal> u003cu003e9_51226 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_226;
- if (u003cu003e9_51226 == null)
- {
- u003cu003e9_51226 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_226 = u003cu003e9_51226;
- }
- zero = (num1 / lancamentos4.Sum<Lancamento>(u003cu003e9_51226)) * new decimal(100);
- }
- dadosFechamento.set_PercentualCredito(zero);
- IGrouping<long, Lancamento> nums3 = f;
- Func<Lancamento, bool> u003cu003e9_51227 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_227;
- if (u003cu003e9_51227 == null)
- {
- u003cu003e9_51227 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_227 = u003cu003e9_51227;
- }
- IEnumerable<Lancamento> lancamentos5 = nums3.Where<Lancamento>(u003cu003e9_51227);
- Func<Lancamento, decimal> u003cu003e9_51228 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_228;
- if (u003cu003e9_51228 == null)
- {
- u003cu003e9_51228 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_228 = u003cu003e9_51228;
- }
- dadosFechamento.set_Debito(lancamentos5.Sum<Lancamento>(u003cu003e9_51228));
- IGrouping<long, Lancamento> nums4 = f;
- Func<Lancamento, bool> u003cu003e9_51229 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_229;
- if (u003cu003e9_51229 == null)
- {
- u003cu003e9_51229 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_229 = u003cu003e9_51229;
- }
- IEnumerable<Lancamento> lancamentos6 = nums4.Where<Lancamento>(u003cu003e9_51229);
- Func<Lancamento, decimal> u003cu003e9_51230 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_230;
- if (u003cu003e9_51230 == null)
- {
- u003cu003e9_51230 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_230 = u003cu003e9_51230;
- }
- if (lancamentos6.Sum<Lancamento>(u003cu003e9_51230) == decimal.Zero)
- {
- num = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums5 = f;
- Func<Lancamento, bool> u003cu003e9_51231 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_231;
- if (u003cu003e9_51231 == null)
- {
- u003cu003e9_51231 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_231 = u003cu003e9_51231;
- }
- IEnumerable<Lancamento> lancamentos7 = nums5.Where<Lancamento>(u003cu003e9_51231);
- Func<Lancamento, decimal> u003cu003e9_51232 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_232;
- if (u003cu003e9_51232 == null)
- {
- u003cu003e9_51232 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_232 = u003cu003e9_51232;
- }
- decimal num2 = lancamentos7.Sum<Lancamento>(u003cu003e9_51232);
- List<Lancamento> lancamentos8 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51233 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_233;
- if (u003cu003e9_51233 == null)
- {
- u003cu003e9_51233 = (Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 1;
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_233 = u003cu003e9_51233;
- }
- IEnumerable<Lancamento> lancamentos9 = lancamentos8.Where<Lancamento>(u003cu003e9_51233);
- Func<Lancamento, decimal> u003cu003e9_51234 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_234;
- if (u003cu003e9_51234 == null)
- {
- u003cu003e9_51234 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_234 = u003cu003e9_51234;
- }
- num = (num2 / lancamentos9.Sum<Lancamento>(u003cu003e9_51234)) * new decimal(100);
- }
- dadosFechamento.set_PercentualDebito(num);
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro9 = fechamentoFinanceiro8;
- List<DadosFechamento> dadosFechamentos24 = fechamentoFinanceiro9.get_Dados();
- DadosFechamento dadosFechamento5 = new DadosFechamento();
- dadosFechamento5.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos25 = fechamentoFinanceiro9.get_Dados();
- dadosFechamento5.set_Credito(dadosFechamentos25.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()));
- List<DadosFechamento> dadosFechamentos26 = fechamentoFinanceiro9.get_Dados();
- dadosFechamento5.set_Debito(dadosFechamentos26.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos27 = fechamentoFinanceiro9.get_Dados();
- if (dadosFechamentos27.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()) == decimal.Zero)
- {
- num13 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos28 = fechamentoFinanceiro9.get_Dados();
- decimal num24 = dadosFechamentos28.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<Lancamento> lancamentos33 = lancamentos13;
- IEnumerable<Lancamento> lancamentos34 = lancamentos33.Where<Lancamento>((Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 0;
- });
- num13 = (num24 / lancamentos34.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento5.set_PercentualCredito(num13);
- List<DadosFechamento> dadosFechamentos29 = fechamentoFinanceiro9.get_Dados();
- if (dadosFechamentos29.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()) == decimal.Zero)
- {
- num14 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos30 = fechamentoFinanceiro9.get_Dados();
- decimal num25 = dadosFechamentos30.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito());
- List<Lancamento> lancamentos35 = lancamentos13;
- IEnumerable<Lancamento> lancamentos36 = lancamentos35.Where<Lancamento>((Lancamento s) => {
- if (s.get_Controle() == null)
- {
- return false;
- }
- return s.get_Sinal() == 1;
- });
- num14 = (num25 / lancamentos36.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento5.set_PercentualDebito(num14);
- dadosFechamentos24.Add(dadosFechamento5);
- this.Fechamento.Add(fechamentoFinanceiro9);
- FechamentoFinanceiro fechamentoFinanceiro10 = new FechamentoFinanceiro();
- fechamentoFinanceiro10.set_Plano("TIPO PAGAMENTO");
- List<Lancamento> lancamentos37 = lancamentos13;
- IOrderedEnumerable<Lancamento> description =
- from x in lancamentos37
- orderby EnumHelper.GetDescription<TipoPagamento>(x.get_TipoPagamento())
- select x;
- fechamentoFinanceiro10.set_Dados((
- from x in description
- group x by x.get_TipoPagamento()).Select<IGrouping<TipoPagamento, Lancamento>, DadosFechamento>((IGrouping<TipoPagamento, Lancamento> f) => {
- decimal zero;
- decimal num;
- DadosFechamento dadosFechamento = new DadosFechamento();
- dadosFechamento.set_Planos(EnumHelper.GetDescription<TipoPagamento>(f.First<Lancamento>().get_TipoPagamento()));
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos = f;
- Func<Lancamento, bool> u003cu003e9_51248 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_248;
- if (u003cu003e9_51248 == null)
- {
- u003cu003e9_51248 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_248 = u003cu003e9_51248;
- }
- IEnumerable<Lancamento> lancamentos = tipoPagamentos.Where<Lancamento>(u003cu003e9_51248);
- Func<Lancamento, decimal> u003cu003e9_51249 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_249;
- if (u003cu003e9_51249 == null)
- {
- u003cu003e9_51249 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_249 = u003cu003e9_51249;
- }
- dadosFechamento.set_Credito(lancamentos.Sum<Lancamento>(u003cu003e9_51249));
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos1 = f;
- Func<Lancamento, bool> u003cu003e9_51250 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_250;
- if (u003cu003e9_51250 == null)
- {
- u003cu003e9_51250 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_250 = u003cu003e9_51250;
- }
- IEnumerable<Lancamento> lancamentos1 = tipoPagamentos1.Where<Lancamento>(u003cu003e9_51250);
- Func<Lancamento, decimal> u003cu003e9_51251 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_251;
- if (u003cu003e9_51251 == null)
- {
- u003cu003e9_51251 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_251 = u003cu003e9_51251;
- }
- if (lancamentos1.Sum<Lancamento>(u003cu003e9_51251) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos2 = f;
- Func<Lancamento, bool> u003cu003e9_51252 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_252;
- if (u003cu003e9_51252 == null)
- {
- u003cu003e9_51252 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_252 = u003cu003e9_51252;
- }
- IEnumerable<Lancamento> lancamentos2 = tipoPagamentos2.Where<Lancamento>(u003cu003e9_51252);
- Func<Lancamento, decimal> u003cu003e9_51253 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_253;
- if (u003cu003e9_51253 == null)
- {
- u003cu003e9_51253 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_253 = u003cu003e9_51253;
- }
- decimal num1 = lancamentos2.Sum<Lancamento>(u003cu003e9_51253);
- List<Lancamento> lancamentos3 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51254 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_254;
- if (u003cu003e9_51254 == null)
- {
- u003cu003e9_51254 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_254 = u003cu003e9_51254;
- }
- IEnumerable<Lancamento> lancamentos4 = lancamentos3.Where<Lancamento>(u003cu003e9_51254);
- Func<Lancamento, decimal> u003cu003e9_51255 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_255;
- if (u003cu003e9_51255 == null)
- {
- u003cu003e9_51255 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_255 = u003cu003e9_51255;
- }
- zero = (num1 / lancamentos4.Sum<Lancamento>(u003cu003e9_51255)) * new decimal(100);
- }
- dadosFechamento.set_PercentualCredito(zero);
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos3 = f;
- Func<Lancamento, bool> u003cu003e9_51256 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_256;
- if (u003cu003e9_51256 == null)
- {
- u003cu003e9_51256 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_256 = u003cu003e9_51256;
- }
- IEnumerable<Lancamento> lancamentos5 = tipoPagamentos3.Where<Lancamento>(u003cu003e9_51256);
- Func<Lancamento, decimal> u003cu003e9_51257 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_257;
- if (u003cu003e9_51257 == null)
- {
- u003cu003e9_51257 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_257 = u003cu003e9_51257;
- }
- dadosFechamento.set_Debito(lancamentos5.Sum<Lancamento>(u003cu003e9_51257));
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos4 = f;
- Func<Lancamento, bool> u003cu003e9_51258 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_258;
- if (u003cu003e9_51258 == null)
- {
- u003cu003e9_51258 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_258 = u003cu003e9_51258;
- }
- IEnumerable<Lancamento> lancamentos6 = tipoPagamentos4.Where<Lancamento>(u003cu003e9_51258);
- Func<Lancamento, decimal> u003cu003e9_51259 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_259;
- if (u003cu003e9_51259 == null)
- {
- u003cu003e9_51259 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_259 = u003cu003e9_51259;
- }
- if (lancamentos6.Sum<Lancamento>(u003cu003e9_51259) == decimal.Zero)
- {
- num = decimal.Zero;
- }
- else
- {
- IGrouping<TipoPagamento, Lancamento> tipoPagamentos5 = f;
- Func<Lancamento, bool> u003cu003e9_51260 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_260;
- if (u003cu003e9_51260 == null)
- {
- u003cu003e9_51260 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_260 = u003cu003e9_51260;
- }
- IEnumerable<Lancamento> lancamentos7 = tipoPagamentos5.Where<Lancamento>(u003cu003e9_51260);
- Func<Lancamento, decimal> u003cu003e9_51261 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_261;
- if (u003cu003e9_51261 == null)
- {
- u003cu003e9_51261 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_261 = u003cu003e9_51261;
- }
- decimal num2 = lancamentos7.Sum<Lancamento>(u003cu003e9_51261);
- List<Lancamento> lancamentos8 = lancamentos13;
- Func<Lancamento, bool> u003cu003e9_51262 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_262;
- if (u003cu003e9_51262 == null)
- {
- u003cu003e9_51262 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_262 = u003cu003e9_51262;
- }
- IEnumerable<Lancamento> lancamentos9 = lancamentos8.Where<Lancamento>(u003cu003e9_51262);
- Func<Lancamento, decimal> u003cu003e9_51263 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_263;
- if (u003cu003e9_51263 == null)
- {
- u003cu003e9_51263 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_263 = u003cu003e9_51263;
- }
- num = (num2 / lancamentos9.Sum<Lancamento>(u003cu003e9_51263)) * new decimal(100);
- }
- dadosFechamento.set_PercentualDebito(num);
- return dadosFechamento;
- }).ToList<DadosFechamento>());
- FechamentoFinanceiro fechamentoFinanceiro11 = fechamentoFinanceiro10;
- List<DadosFechamento> dadosFechamentos31 = fechamentoFinanceiro11.get_Dados();
- DadosFechamento dadosFechamento6 = new DadosFechamento();
- dadosFechamento6.set_Planos("TOTAL");
- List<DadosFechamento> dadosFechamentos32 = fechamentoFinanceiro11.get_Dados();
- dadosFechamento6.set_Credito(dadosFechamentos32.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()));
- List<DadosFechamento> dadosFechamentos33 = fechamentoFinanceiro11.get_Dados();
- dadosFechamento6.set_Debito(dadosFechamentos33.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos34 = fechamentoFinanceiro11.get_Dados();
- if (dadosFechamentos34.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito()) == decimal.Zero)
- {
- num15 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos35 = fechamentoFinanceiro11.get_Dados();
- decimal num26 = dadosFechamentos35.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<Lancamento> lancamentos38 = lancamentos13;
- IEnumerable<Lancamento> sinal2 =
- from s in lancamentos38
- where s.get_Sinal() == 0
- select s;
- num15 = (num26 / sinal2.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento6.set_PercentualCredito(num15);
- List<DadosFechamento> dadosFechamentos36 = fechamentoFinanceiro11.get_Dados();
- if (dadosFechamentos36.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()) == decimal.Zero)
- {
- num16 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos37 = fechamentoFinanceiro11.get_Dados();
- decimal num27 = dadosFechamentos37.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito());
- List<Lancamento> lancamentos39 = lancamentos13;
- IEnumerable<Lancamento> sinal3 =
- from s in lancamentos39
- where s.get_Sinal() == 1
- select s;
- num16 = (num27 / sinal3.Sum<Lancamento>((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100);
- }
- dadosFechamento6.set_PercentualDebito(num16);
- List<DadosFechamento> dadosFechamentos38 = fechamentoFinanceiro11.get_Dados();
- decimal num28 = dadosFechamentos38.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<DadosFechamento> dadosFechamentos39 = fechamentoFinanceiro11.get_Dados();
- dadosFechamento6.set_Soma(num28 - dadosFechamentos39.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- List<DadosFechamento> dadosFechamentos40 = fechamentoFinanceiro11.get_Dados();
- decimal num29 = dadosFechamentos40.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<DadosFechamento> dadosFechamentos41 = fechamentoFinanceiro11.get_Dados();
- if ((num29 + dadosFechamentos41.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito())) == decimal.Zero)
- {
- num17 = decimal.Zero;
- }
- else
- {
- List<DadosFechamento> dadosFechamentos42 = fechamentoFinanceiro11.get_Dados();
- decimal num30 = dadosFechamentos42.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<DadosFechamento> dadosFechamentos43 = fechamentoFinanceiro11.get_Dados();
- decimal num31 = (num30 - dadosFechamentos43.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito())) * new decimal(100);
- List<DadosFechamento> dadosFechamentos44 = fechamentoFinanceiro11.get_Dados();
- decimal num32 = dadosFechamentos44.Sum<DadosFechamento>((DadosFechamento t) => t.get_Credito());
- List<DadosFechamento> dadosFechamentos45 = fechamentoFinanceiro11.get_Dados();
- num17 = num31 / (num32 + dadosFechamentos45.Sum<DadosFechamento>((DadosFechamento t) => t.get_Debito()));
- }
- dadosFechamento6.set_SomaPercentual(num17);
- dadosFechamentos31.Add(dadosFechamento6);
- this.Fechamento.Add(fechamentoFinanceiro11);
- }
- else
- {
- this.FechamentoAnalitico = new List<FechamentoFinanceiroAnalitico>();
- List<Lancamento> lancamentos40 = lancamentos13;
- IEnumerable<Lancamento> lancamentos41 = lancamentos40.Where<Lancamento>((Lancamento x) => {
- object plano;
- ControleFinanceiro controle = x.get_Controle();
- if (controle != null)
- {
- plano = controle.get_Plano();
- }
- else
- {
- plano = null;
- }
- return plano != null;
- });
- IOrderedEnumerable<Lancamento> nome1 =
- from x in lancamentos41
- orderby x.get_Controle().get_Plano().get_Nome()
- select x;
- (
- from x in nome1
- group x by x.get_Controle().get_Plano().get_Plano().get_Id()).ToList<IGrouping<long, Lancamento>>().ForEach((IGrouping<long, Lancamento> x) => {
- FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico = new FechamentoFinanceiroAnalitico();
- fechamentoFinanceiroAnalitico.set_NomeConta(x.First<Lancamento>().get_Controle().get_Plano().get_Plano().get_Descricao().ToUpper());
- IGrouping<long, Lancamento> nums19 = x;
- Func<Lancamento, long> u003cu003e9_5112 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_12;
- if (u003cu003e9_5112 == null)
- {
- u003cu003e9_5112 = (Lancamento f) => f.get_Controle().get_Plano().get_Id();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_12 = u003cu003e9_5112;
- }
- IOrderedEnumerable<Lancamento> lancamentos12 = nums19.OrderBy<Lancamento, long>(u003cu003e9_5112);
- Func<Lancamento, long> u003cu003e9_5113 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_13;
- if (u003cu003e9_5113 == null)
- {
- u003cu003e9_5113 = (Lancamento f) => f.get_Controle().get_Plano().get_Id();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_13 = u003cu003e9_5113;
- }
- fechamentoFinanceiroAnalitico.set_Dados(lancamentos12.GroupBy<Lancamento, long>(u003cu003e9_5113).Select<IGrouping<long, Lancamento>, DadosFechamentoAnalitico>((IGrouping<long, Lancamento> f) => {
- Func<Lancamento, bool> func;
- decimal zero;
- decimal zero1;
- DadosFechamentoAnalitico dadosFechamentoAnalitico = new DadosFechamentoAnalitico();
- dadosFechamentoAnalitico.set_Nome(f.First<Lancamento>().get_Controle().get_Plano().get_Descricao());
- IGrouping<long, Lancamento> nums = f;
- Func<Lancamento, bool> u003cu003e9_15 = func8;
- if (u003cu003e9_15 == null)
- {
- Func<Lancamento, bool> cSu0024u003cu003e8_locals11 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 1, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 1, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = cSu0024u003cu003e8_locals11;
- func8 = cSu0024u003cu003e8_locals11;
- u003cu003e9_15 = func;
- }
- List<Lancamento> list = nums.Where<Lancamento>(u003cu003e9_15).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5116 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_16;
- if (u003cu003e9_5116 == null)
- {
- u003cu003e9_5116 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_16 = u003cu003e9_5116;
- }
- dadosFechamentoAnalitico.set_Jan(list.Sum<Lancamento>(u003cu003e9_5116));
- IGrouping<long, Lancamento> nums1 = f;
- Func<Lancamento, bool> u003cu003e9_17 = func9;
- if (u003cu003e9_17 == null)
- {
- Func<Lancamento, bool> func1 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 2, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- int year = filtroFinanceiro1.get_Inicio().Year;
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(year, 2, DateTime.DaysInMonth(inicio.Year, 2));
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func1;
- func9 = func1;
- u003cu003e9_17 = func;
- }
- List<Lancamento> lancamentos = nums1.Where<Lancamento>(u003cu003e9_17).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5118 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_18;
- if (u003cu003e9_5118 == null)
- {
- u003cu003e9_5118 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_18 = u003cu003e9_5118;
- }
- dadosFechamentoAnalitico.set_Fev(lancamentos.Sum<Lancamento>(u003cu003e9_5118));
- IGrouping<long, Lancamento> nums2 = f;
- Func<Lancamento, bool> u003cu003e9_19 = func10;
- if (u003cu003e9_19 == null)
- {
- Func<Lancamento, bool> cSu0024u003cu003e8_locals12 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 3, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 3, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = cSu0024u003cu003e8_locals12;
- func10 = cSu0024u003cu003e8_locals12;
- u003cu003e9_19 = func;
- }
- List<Lancamento> list1 = nums2.Where<Lancamento>(u003cu003e9_19).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5120 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_20;
- if (u003cu003e9_5120 == null)
- {
- u003cu003e9_5120 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_20 = u003cu003e9_5120;
- }
- dadosFechamentoAnalitico.set_Mar(list1.Sum<Lancamento>(u003cu003e9_5120));
- IGrouping<long, Lancamento> nums3 = f;
- Func<Lancamento, bool> u003cu003e9_21 = func11;
- if (u003cu003e9_21 == null)
- {
- Func<Lancamento, bool> func2 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 4, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 4, 30);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func2;
- func11 = func2;
- u003cu003e9_21 = func;
- }
- List<Lancamento> lancamentos1 = nums3.Where<Lancamento>(u003cu003e9_21).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5122 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_22;
- if (u003cu003e9_5122 == null)
- {
- u003cu003e9_5122 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_22 = u003cu003e9_5122;
- }
- dadosFechamentoAnalitico.set_Abr(lancamentos1.Sum<Lancamento>(u003cu003e9_5122));
- IGrouping<long, Lancamento> nums4 = f;
- Func<Lancamento, bool> u003cu003e9_23 = func12;
- if (u003cu003e9_23 == null)
- {
- Func<Lancamento, bool> func3 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 5, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 5, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func3;
- func12 = func3;
- u003cu003e9_23 = func;
- }
- List<Lancamento> list2 = nums4.Where<Lancamento>(u003cu003e9_23).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5124 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_24;
- if (u003cu003e9_5124 == null)
- {
- u003cu003e9_5124 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_24 = u003cu003e9_5124;
- }
- dadosFechamentoAnalitico.set_Mai(list2.Sum<Lancamento>(u003cu003e9_5124));
- IGrouping<long, Lancamento> nums5 = f;
- Func<Lancamento, bool> u003cu003e9_25 = func13;
- if (u003cu003e9_25 == null)
- {
- Func<Lancamento, bool> cSu0024u003cu003e8_locals14 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 6, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 6, 30);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = cSu0024u003cu003e8_locals14;
- func13 = cSu0024u003cu003e8_locals14;
- u003cu003e9_25 = func;
- }
- List<Lancamento> lancamentos2 = nums5.Where<Lancamento>(u003cu003e9_25).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5126 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_26;
- if (u003cu003e9_5126 == null)
- {
- u003cu003e9_5126 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_26 = u003cu003e9_5126;
- }
- dadosFechamentoAnalitico.set_Jun(lancamentos2.Sum<Lancamento>(u003cu003e9_5126));
- IGrouping<long, Lancamento> nums6 = f;
- Func<Lancamento, bool> u003cu003e9_27 = func14;
- if (u003cu003e9_27 == null)
- {
- Func<Lancamento, bool> func4 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 7, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 7, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func4;
- func14 = func4;
- u003cu003e9_27 = func;
- }
- List<Lancamento> list3 = nums6.Where<Lancamento>(u003cu003e9_27).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5128 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_28;
- if (u003cu003e9_5128 == null)
- {
- u003cu003e9_5128 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_28 = u003cu003e9_5128;
- }
- dadosFechamentoAnalitico.set_Jul(list3.Sum<Lancamento>(u003cu003e9_5128));
- IGrouping<long, Lancamento> nums7 = f;
- Func<Lancamento, bool> u003cu003e9_29 = func15;
- if (u003cu003e9_29 == null)
- {
- Func<Lancamento, bool> func5 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 8, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 8, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func5;
- func15 = func5;
- u003cu003e9_29 = func;
- }
- List<Lancamento> lancamentos3 = nums7.Where<Lancamento>(u003cu003e9_29).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5130 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_30;
- if (u003cu003e9_5130 == null)
- {
- u003cu003e9_5130 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_30 = u003cu003e9_5130;
- }
- dadosFechamentoAnalitico.set_Ago(lancamentos3.Sum<Lancamento>(u003cu003e9_5130));
- IGrouping<long, Lancamento> nums8 = f;
- Func<Lancamento, bool> u003cu003e9_31 = func16;
- if (u003cu003e9_31 == null)
- {
- Func<Lancamento, bool> cSu0024u003cu003e8_locals16 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 9, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 9, 30);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = cSu0024u003cu003e8_locals16;
- func16 = cSu0024u003cu003e8_locals16;
- u003cu003e9_31 = func;
- }
- List<Lancamento> list4 = nums8.Where<Lancamento>(u003cu003e9_31).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5132 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_32;
- if (u003cu003e9_5132 == null)
- {
- u003cu003e9_5132 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_32 = u003cu003e9_5132;
- }
- dadosFechamentoAnalitico.set_Set(list4.Sum<Lancamento>(u003cu003e9_5132));
- IGrouping<long, Lancamento> nums9 = f;
- Func<Lancamento, bool> u003cu003e9_33 = func17;
- if (u003cu003e9_33 == null)
- {
- Func<Lancamento, bool> func6 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 10, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 10, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func6;
- func17 = func6;
- u003cu003e9_33 = func;
- }
- List<Lancamento> lancamentos4 = nums9.Where<Lancamento>(u003cu003e9_33).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5134 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_34;
- if (u003cu003e9_5134 == null)
- {
- u003cu003e9_5134 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_34 = u003cu003e9_5134;
- }
- dadosFechamentoAnalitico.set_Out(lancamentos4.Sum<Lancamento>(u003cu003e9_5134));
- IGrouping<long, Lancamento> nums10 = f;
- Func<Lancamento, bool> u003cu003e9_35 = func18;
- if (u003cu003e9_35 == null)
- {
- Func<Lancamento, bool> func7 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 11, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 11, 30);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = func7;
- func18 = func7;
- u003cu003e9_35 = func;
- }
- List<Lancamento> list5 = nums10.Where<Lancamento>(u003cu003e9_35).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5136 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_36;
- if (u003cu003e9_5136 == null)
- {
- u003cu003e9_5136 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_36 = u003cu003e9_5136;
- }
- dadosFechamentoAnalitico.set_Nov(list5.Sum<Lancamento>(u003cu003e9_5136));
- IGrouping<long, Lancamento> nums11 = f;
- Func<Lancamento, bool> u003cu003e9_37 = func19;
- if (u003cu003e9_37 == null)
- {
- Func<Lancamento, bool> cSu0024u003cu003e8_locals18 = (Lancamento s) => {
- DateTime? baixa = s.get_Baixa();
- DateTime inicio = filtroFinanceiro1.get_Inicio();
- DateTime dateTime = new DateTime(inicio.Year, 12, 1);
- if ((baixa.HasValue ? baixa.GetValueOrDefault() < dateTime : true))
- {
- return false;
- }
- baixa = s.get_Baixa();
- inicio = filtroFinanceiro1.get_Inicio();
- dateTime = new DateTime(inicio.Year, 12, 31);
- if (!baixa.HasValue)
- {
- return false;
- }
- return baixa.GetValueOrDefault() <= dateTime;
- };
- func = cSu0024u003cu003e8_locals18;
- func19 = cSu0024u003cu003e8_locals18;
- u003cu003e9_37 = func;
- }
- List<Lancamento> lancamentos5 = nums11.Where<Lancamento>(u003cu003e9_37).ToList<Lancamento>();
- Func<Lancamento, decimal?> u003cu003e9_5138 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_38;
- if (u003cu003e9_5138 == null)
- {
- u003cu003e9_5138 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_38 = u003cu003e9_5138;
- }
- dadosFechamentoAnalitico.set_Dez(lancamentos5.Sum<Lancamento>(u003cu003e9_5138));
- IGrouping<long, Lancamento> nums12 = f;
- Func<Lancamento, decimal?> u003cu003e9_5139 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_39;
- if (u003cu003e9_5139 == null)
- {
- u003cu003e9_5139 = (Lancamento s) => {
- if (s.get_Sinal() != 1)
- {
- return s.get_ValorPago();
- }
- decimal? valorPago = s.get_ValorPago();
- decimal num = 2;
- decimal? nullable = s.get_ValorPago();
- decimal? nullable1 = (nullable.HasValue ? new decimal?(num * nullable.GetValueOrDefault()) : null);
- if (!valorPago.HasValue | !nullable1.HasValue)
- {
- nullable = null;
- return nullable;
- }
- return new decimal?(valorPago.GetValueOrDefault() - nullable1.GetValueOrDefault());
- };
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_39 = u003cu003e9_5139;
- }
- dadosFechamentoAnalitico.set_Total(nums12.Sum<Lancamento>(u003cu003e9_5139));
- IGrouping<long, Lancamento> nums13 = f;
- Func<Lancamento, bool> u003cu003e9_5140 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_40;
- if (u003cu003e9_5140 == null)
- {
- u003cu003e9_5140 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_40 = u003cu003e9_5140;
- }
- IEnumerable<Lancamento> lancamentos6 = nums13.Where<Lancamento>(u003cu003e9_5140);
- Func<Lancamento, decimal> u003cu003e9_5141 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_41;
- if (u003cu003e9_5141 == null)
- {
- u003cu003e9_5141 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_41 = u003cu003e9_5141;
- }
- if (lancamentos6.Sum<Lancamento>(u003cu003e9_5141) == decimal.Zero)
- {
- zero = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums14 = f;
- Func<Lancamento, bool> u003cu003e9_5142 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_42;
- if (u003cu003e9_5142 == null)
- {
- u003cu003e9_5142 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_42 = u003cu003e9_5142;
- }
- IEnumerable<Lancamento> lancamentos7 = nums14.Where<Lancamento>(u003cu003e9_5142);
- Func<Lancamento, decimal> u003cu003e9_5143 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_43;
- if (u003cu003e9_5143 == null)
- {
- u003cu003e9_5143 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_43 = u003cu003e9_5143;
- }
- decimal num1 = lancamentos7.Sum<Lancamento>(u003cu003e9_5143);
- IGrouping<long, Lancamento> nums15 = x;
- Func<Lancamento, bool> u003cu003e9_5144 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_44;
- if (u003cu003e9_5144 == null)
- {
- u003cu003e9_5144 = (Lancamento s) => s.get_Sinal() == 0;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_44 = u003cu003e9_5144;
- }
- IEnumerable<Lancamento> lancamentos8 = nums15.Where<Lancamento>(u003cu003e9_5144);
- Func<Lancamento, decimal> u003cu003e9_5145 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_45;
- if (u003cu003e9_5145 == null)
- {
- u003cu003e9_5145 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_45 = u003cu003e9_5145;
- }
- zero = (num1 / lancamentos8.Sum<Lancamento>(u003cu003e9_5145)) * new decimal(100);
- }
- dadosFechamentoAnalitico.set_PercentualCredito(zero);
- IGrouping<long, Lancamento> nums16 = f;
- Func<Lancamento, bool> u003cu003e9_5146 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_46;
- if (u003cu003e9_5146 == null)
- {
- u003cu003e9_5146 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_46 = u003cu003e9_5146;
- }
- IEnumerable<Lancamento> lancamentos9 = nums16.Where<Lancamento>(u003cu003e9_5146);
- Func<Lancamento, decimal> u003cu003e9_5147 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_47;
- if (u003cu003e9_5147 == null)
- {
- u003cu003e9_5147 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_47 = u003cu003e9_5147;
- }
- if (lancamentos9.Sum<Lancamento>(u003cu003e9_5147) == decimal.Zero)
- {
- zero1 = decimal.Zero;
- }
- else
- {
- IGrouping<long, Lancamento> nums17 = f;
- Func<Lancamento, bool> u003cu003e9_5148 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_48;
- if (u003cu003e9_5148 == null)
- {
- u003cu003e9_5148 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_48 = u003cu003e9_5148;
- }
- IEnumerable<Lancamento> lancamentos10 = nums17.Where<Lancamento>(u003cu003e9_5148);
- Func<Lancamento, decimal> u003cu003e9_5149 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_49;
- if (u003cu003e9_5149 == null)
- {
- u003cu003e9_5149 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_49 = u003cu003e9_5149;
- }
- decimal num2 = lancamentos10.Sum<Lancamento>(u003cu003e9_5149);
- IGrouping<long, Lancamento> nums18 = x;
- Func<Lancamento, bool> u003cu003e9_5150 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_50;
- if (u003cu003e9_5150 == null)
- {
- u003cu003e9_5150 = (Lancamento s) => s.get_Sinal() == 1;
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_50 = u003cu003e9_5150;
- }
- IEnumerable<Lancamento> lancamentos11 = nums18.Where<Lancamento>(u003cu003e9_5150);
- Func<Lancamento, decimal> u003cu003e9_5151 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_51;
- if (u003cu003e9_5151 == null)
- {
- u003cu003e9_5151 = (Lancamento s) => s.get_ValorPago().GetValueOrDefault();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_51 = u003cu003e9_5151;
- }
- zero1 = (num2 / lancamentos11.Sum<Lancamento>(u003cu003e9_5151)) * new decimal(100);
- }
- dadosFechamentoAnalitico.set_PercentualDebito(zero1);
- return dadosFechamentoAnalitico;
- }).ToList<DadosFechamentoAnalitico>());
- FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico1 = fechamentoFinanceiroAnalitico;
- List<DadosFechamentoAnalitico> dados = fechamentoFinanceiroAnalitico1.get_Dados();
- DadosFechamentoAnalitico dadosFechamentoAnalitico1 = new DadosFechamentoAnalitico();
- dadosFechamentoAnalitico1.set_Nome("TOTAL");
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5152 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_52;
- if (u003cu003e9_5152 == null)
- {
- u003cu003e9_5152 = (DadosFechamentoAnalitico t) => t.get_Jan();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_52 = u003cu003e9_5152;
- }
- dadosFechamentoAnalitico1.set_Jan(dadosFechamentoAnaliticos.Sum<DadosFechamentoAnalitico>(u003cu003e9_5152));
- List<DadosFechamentoAnalitico> dados1 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5153 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_53;
- if (u003cu003e9_5153 == null)
- {
- u003cu003e9_5153 = (DadosFechamentoAnalitico t) => t.get_Fev();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_53 = u003cu003e9_5153;
- }
- dadosFechamentoAnalitico1.set_Fev(dados1.Sum<DadosFechamentoAnalitico>(u003cu003e9_5153));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos1 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5154 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_54;
- if (u003cu003e9_5154 == null)
- {
- u003cu003e9_5154 = (DadosFechamentoAnalitico t) => t.get_Mar();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_54 = u003cu003e9_5154;
- }
- dadosFechamentoAnalitico1.set_Mar(dadosFechamentoAnaliticos1.Sum<DadosFechamentoAnalitico>(u003cu003e9_5154));
- List<DadosFechamentoAnalitico> dados2 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5155 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_55;
- if (u003cu003e9_5155 == null)
- {
- u003cu003e9_5155 = (DadosFechamentoAnalitico t) => t.get_Abr();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_55 = u003cu003e9_5155;
- }
- dadosFechamentoAnalitico1.set_Abr(dados2.Sum<DadosFechamentoAnalitico>(u003cu003e9_5155));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos2 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5156 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_56;
- if (u003cu003e9_5156 == null)
- {
- u003cu003e9_5156 = (DadosFechamentoAnalitico t) => t.get_Mai();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_56 = u003cu003e9_5156;
- }
- dadosFechamentoAnalitico1.set_Mai(dadosFechamentoAnaliticos2.Sum<DadosFechamentoAnalitico>(u003cu003e9_5156));
- List<DadosFechamentoAnalitico> dados3 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5157 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_57;
- if (u003cu003e9_5157 == null)
- {
- u003cu003e9_5157 = (DadosFechamentoAnalitico t) => t.get_Jun();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_57 = u003cu003e9_5157;
- }
- dadosFechamentoAnalitico1.set_Jun(dados3.Sum<DadosFechamentoAnalitico>(u003cu003e9_5157));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos3 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5158 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_58;
- if (u003cu003e9_5158 == null)
- {
- u003cu003e9_5158 = (DadosFechamentoAnalitico t) => t.get_Jul();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_58 = u003cu003e9_5158;
- }
- dadosFechamentoAnalitico1.set_Jul(dadosFechamentoAnaliticos3.Sum<DadosFechamentoAnalitico>(u003cu003e9_5158));
- List<DadosFechamentoAnalitico> dados4 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5159 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_59;
- if (u003cu003e9_5159 == null)
- {
- u003cu003e9_5159 = (DadosFechamentoAnalitico t) => t.get_Ago();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_59 = u003cu003e9_5159;
- }
- dadosFechamentoAnalitico1.set_Ago(dados4.Sum<DadosFechamentoAnalitico>(u003cu003e9_5159));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos4 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5160 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_60;
- if (u003cu003e9_5160 == null)
- {
- u003cu003e9_5160 = (DadosFechamentoAnalitico t) => t.get_Set();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_60 = u003cu003e9_5160;
- }
- dadosFechamentoAnalitico1.set_Set(dadosFechamentoAnaliticos4.Sum<DadosFechamentoAnalitico>(u003cu003e9_5160));
- List<DadosFechamentoAnalitico> dados5 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5161 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_61;
- if (u003cu003e9_5161 == null)
- {
- u003cu003e9_5161 = (DadosFechamentoAnalitico t) => t.get_Out();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_61 = u003cu003e9_5161;
- }
- dadosFechamentoAnalitico1.set_Out(dados5.Sum<DadosFechamentoAnalitico>(u003cu003e9_5161));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos5 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5162 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_62;
- if (u003cu003e9_5162 == null)
- {
- u003cu003e9_5162 = (DadosFechamentoAnalitico t) => t.get_Nov();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_62 = u003cu003e9_5162;
- }
- dadosFechamentoAnalitico1.set_Nov(dadosFechamentoAnaliticos5.Sum<DadosFechamentoAnalitico>(u003cu003e9_5162));
- List<DadosFechamentoAnalitico> dados6 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5163 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_63;
- if (u003cu003e9_5163 == null)
- {
- u003cu003e9_5163 = (DadosFechamentoAnalitico t) => t.get_Dez();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_63 = u003cu003e9_5163;
- }
- dadosFechamentoAnalitico1.set_Dez(dados6.Sum<DadosFechamentoAnalitico>(u003cu003e9_5163));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos6 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal?> u003cu003e9_5164 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_64;
- if (u003cu003e9_5164 == null)
- {
- u003cu003e9_5164 = (DadosFechamentoAnalitico t) => t.get_Total();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_64 = u003cu003e9_5164;
- }
- dadosFechamentoAnalitico1.set_Total(dadosFechamentoAnaliticos6.Sum<DadosFechamentoAnalitico>(u003cu003e9_5164));
- List<DadosFechamentoAnalitico> dados7 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal> u003cu003e9_5165 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_65;
- if (u003cu003e9_5165 == null)
- {
- u003cu003e9_5165 = (DadosFechamentoAnalitico t) => t.get_PercentualCredito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_65 = u003cu003e9_5165;
- }
- dadosFechamentoAnalitico1.set_PercentualCredito(dados7.Sum<DadosFechamentoAnalitico>(u003cu003e9_5165));
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos7 = fechamentoFinanceiroAnalitico1.get_Dados();
- Func<DadosFechamentoAnalitico, decimal> u003cu003e9_5166 = FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_66;
- if (u003cu003e9_5166 == null)
- {
- u003cu003e9_5166 = (DadosFechamentoAnalitico t) => t.get_PercentualDebito();
- FechamentoFinanceiroViewModel.u003cu003ec.u003cu003e9__51_66 = u003cu003e9_5166;
- }
- dadosFechamentoAnalitico1.set_PercentualDebito(dadosFechamentoAnaliticos7.Sum<DadosFechamentoAnalitico>(u003cu003e9_5166));
- dados.Add(dadosFechamentoAnalitico1);
- this.FechamentoAnalitico.Add(fechamentoFinanceiroAnalitico1);
- });
- FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico2 = new FechamentoFinanceiroAnalitico();
- fechamentoFinanceiroAnalitico2.set_NomeConta("TOTAL NO PERÍODO");
- fechamentoFinanceiroAnalitico2.set_Dados(new List<DadosFechamentoAnalitico>());
- FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico3 = fechamentoFinanceiroAnalitico2;
- List<DadosFechamentoAnalitico> dadosFechamentoAnaliticos8 = fechamentoFinanceiroAnalitico3.get_Dados();
- DadosFechamentoAnalitico dadosFechamentoAnalitico2 = new DadosFechamentoAnalitico();
- dadosFechamentoAnalitico2.set_Nome("TOTAL");
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Jan(fechamentoAnalitico.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Jan();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Fev(fechamentoFinanceiroAnaliticos.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Fev();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico1 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Mar(fechamentoAnalitico1.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Mar();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos1 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Abr(fechamentoFinanceiroAnaliticos1.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Abr();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico2 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Mai(fechamentoAnalitico2.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Mai();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos2 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Jun(fechamentoFinanceiroAnaliticos2.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Jun();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico3 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Jul(fechamentoAnalitico3.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Jul();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos3 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Ago(fechamentoFinanceiroAnaliticos3.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Ago();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico4 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Set(fechamentoAnalitico4.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Set();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos4 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Out(fechamentoFinanceiroAnaliticos4.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Out();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico5 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Nov(fechamentoAnalitico5.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Nov();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoFinanceiroAnaliticos5 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Dez(fechamentoFinanceiroAnaliticos5.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Dez();
- }
- return new decimal?(new decimal());
- })));
- List<FechamentoFinanceiroAnalitico> fechamentoAnalitico6 = this.FechamentoAnalitico;
- dadosFechamentoAnalitico2.set_Total(fechamentoAnalitico6.Sum<FechamentoFinanceiroAnalitico>((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum<DadosFechamentoAnalitico>((DadosFechamentoAnalitico y) => {
- if (y.get_Nome() != "TOTAL")
- {
- return y.get_Total();
- }
- return new decimal?(new decimal());
- })));
- dadosFechamentoAnalitico2.set_PercentualCredito(new decimal(100));
- dadosFechamentoAnalitico2.set_PercentualDebito(new decimal(100));
- dadosFechamentoAnaliticos8.Add(dadosFechamentoAnalitico2);
- this.FechamentoAnalitico.Add(fechamentoFinanceiroAnalitico3);
- }
- this.HtmlContent = await this.GerarHtml(true);
- }
- }
-
- private async void LoadInicial()
- {
- this.Plano = await this._servico.BuscarPlanoAsync();
- this.Planos = await this._servico.BuscarPlanosAsync();
- this.Centro = await this._servico.BuscarCentroAsync();
- this.Conta = await (new BancosContasServico()).BuscarBancos();
- }
-
- public async Task Print()
- {
- string tempPath = Path.GetTempPath();
- string str = await this.GerarHtml(false);
- string str1 = string.Format("{0}FECHAMENTO_FINANCEIRO_{1:ddMMyyyyhhmmss}.html", tempPath, Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8);
- streamWriter.Write(str);
- streamWriter.Close();
- Process.Start(str1);
- tempPath = null;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/Financeiro/TranferenciaViewModel.cs b/Gestor.Application/ViewModels/Financeiro/TranferenciaViewModel.cs
deleted file mode 100644
index d4e189a..0000000
--- a/Gestor.Application/ViewModels/Financeiro/TranferenciaViewModel.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using Gestor.Application.Servicos.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Financeiro
-{
- public class TranferenciaViewModel : BaseViewModel
- {
- private Gestor.Model.Domain.Financeiro.Transferencia _transferencia;
-
- private ObservableCollection<BancosContas> _contas;
-
- private BancosContasServico _servico
- {
- get;
- set;
- }
-
- public ObservableCollection<BancosContas> Contas
- {
- get
- {
- return this._contas;
- }
- set
- {
- this._contas = value;
- base.OnPropertyChanged("Contas");
- }
- }
-
- public Gestor.Model.Domain.Financeiro.Transferencia Transferencia
- {
- get
- {
- return this._transferencia;
- }
- set
- {
- this._transferencia = value;
- base.OnPropertyChanged("Transferencia");
- }
- }
-
- public TranferenciaViewModel(Gestor.Model.Domain.Financeiro.Transferencia transferencia)
- {
- this._servico = new BancosContasServico();
- this.Carregar(transferencia);
- }
-
- private async void Carregar(Gestor.Model.Domain.Financeiro.Transferencia transferencia)
- {
- BancosContas bancosConta;
- BancosContas bancosConta1;
- List<BancosContas> bancosContas = await this._servico.BuscarBancos();
- TranferenciaViewModel observableCollection = this;
- List<BancosContas> bancosContas1 = bancosContas;
- IEnumerable<BancosContas> ativo =
- from x in bancosContas1
- where x.get_Ativo()
- select x;
- observableCollection.Contas = new ObservableCollection<BancosContas>(
- from x in ativo
- orderby x.get_Descricao()
- select x);
- TranferenciaViewModel tranferenciaViewModel = this;
- Gestor.Model.Domain.Financeiro.Transferencia transferencium = new Gestor.Model.Domain.Financeiro.Transferencia();
- if (transferencia.get_Origem() != null)
- {
- bancosConta = bancosContas.First<BancosContas>((BancosContas x) => x.get_Id() == transferencia.get_Origem().get_Id());
- }
- else
- {
- bancosConta = null;
- }
- transferencium.set_Origem(bancosConta);
- transferencium.set_Data(transferencia.get_Data());
- transferencium.set_Valor(transferencia.get_Valor());
- if (transferencia.get_Destino() != null)
- {
- bancosConta1 = bancosContas.First<BancosContas>((BancosContas x) => x.get_Id() == transferencia.get_Destino().get_Id());
- }
- else
- {
- bancosConta1 = null;
- }
- transferencium.set_Destino(bancosConta1);
- tranferenciaViewModel.Transferencia = transferencium;
- }
- }
-} \ No newline at end of file