diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs | 974 |
1 files changed, 974 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs new file mode 100644 index 0000000..7bccb8f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs @@ -0,0 +1,974 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; +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.Financeiro.Relatorios; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels.Financeiro.Relatorios; + +public class FechamentoFinanceiroViewModel : BaseViewModel +{ + private readonly FinanceiroServico _servico; + + private bool _isExpanded; + + private bool _analitico; + + private List<Plano> _plano; + + private List<Planos> _planos; + + private List<Centro> _centro; + + private List<BancosContas> _conta; + + private DateTime? _inicio = new DateTime(Funcoes.GetNetworkTime().Date.Year, Funcoes.GetNetworkTime().Date.Month, 1); + + private DateTime? _fim = Funcoes.GetNetworkTime(); + + private List<FechamentoFinanceiro> _fechamento; + + private List<FechamentoFinanceiroAnalitico> _fechamentoAnalitico; + + private string _htmlContent; + + private bool _print; + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public bool Analitico + { + get + { + return _analitico; + } + set + { + _analitico = value; + OnPropertyChanged("Analitico"); + } + } + + public List<Plano> Plano + { + get + { + return _plano; + } + set + { + _plano = value; + OnPropertyChanged("Plano"); + } + } + + public List<Planos> Planos + { + get + { + return _planos; + } + set + { + _planos = value; + OnPropertyChanged("Planos"); + } + } + + public List<Centro> Centro + { + get + { + return _centro; + } + set + { + _centro = value; + OnPropertyChanged("Centro"); + } + } + + public List<BancosContas> Conta + { + get + { + return _conta; + } + set + { + _conta = value; + OnPropertyChanged("Conta"); + } + } + + public DateTime? Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime? Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public List<FechamentoFinanceiro> Fechamento + { + get + { + return _fechamento; + } + set + { + _fechamento = value; + OnPropertyChanged("Fechamento"); + } + } + + public List<FechamentoFinanceiroAnalitico> FechamentoAnalitico + { + get + { + return _fechamentoAnalitico; + } + set + { + _fechamentoAnalitico = value; + OnPropertyChanged("FechamentoAnalitico"); + } + } + + public string HtmlContent + { + get + { + return _htmlContent; + } + set + { + _htmlContent = value; + IsPrintable = !string.IsNullOrWhiteSpace(_htmlContent); + OnPropertyChanged("HtmlContent"); + } + } + + public bool IsPrintable + { + get + { + return _print; + } + set + { + _print = value; + OnPropertyChanged("IsPrintable"); + } + } + + public FechamentoFinanceiroViewModel() + { + _servico = new FinanceiroServico(); + LoadInicial(); + } + + private async void LoadInicial() + { + Plano = await _servico.BuscarPlanoAsync(); + Planos = await _servico.BuscarPlanosAsync(); + Centro = await _servico.BuscarCentroAsync(); + Conta = await new BancosContasServico().BuscarBancos(); + } + + public async Task GerarRelatorio() + { + if (!Inicio.HasValue || !Fim.HasValue) + { + return; + } + List<long> plano = (from x in Plano + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List<long> planos = (from x in Planos + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List<long> centro = (from x in Centro + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List<long> conta = (from x in Conta + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + FiltroFinanceiro filtro = new FiltroFinanceiro + { + Inicio = Inicio.Value, + Fim = Fim.Value, + Plano = plano, + Planos = planos, + Centro = centro, + Conta = conta, + Referencia = "l.dtbaixa" + }; + List<Lancamento> lancamentos = await _servico.BuscarFechamento(filtro); + if (Analitico) + { + FechamentoAnalitico = new List<FechamentoFinanceiroAnalitico>(); + (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle7 = x.Controle; + return ((controle7 != null) ? controle7.Plano : null) != null; + }) + orderby x.Controle.Plano.Nome + group x by ((DomainBase)x.Controle.Plano.Plano).Id).ToList().ForEach(delegate(IGrouping<long, Lancamento> x) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Unknown result type (might be due to invalid IL or missing references) + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_0274: Unknown result type (might be due to invalid IL or missing references) + //IL_02a4: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_0304: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_0364: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + FechamentoFinanceiroAnalitico val8 = new FechamentoFinanceiroAnalitico + { + NomeConta = x.First().Controle.Plano.Plano.Descricao.ToUpper(), + Dados = (from f in x + orderby ((DomainBase)f.Controle.Plano).Id + group f by ((DomainBase)f.Controle.Plano).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamentoAnalitico>)((IGrouping<long, Lancamento> f) => new DadosFechamentoAnalitico + { + Nome = f.First().Controle.Plano.Descricao, + Jan = f.Where(delegate(Lancamento s) + { + DateTime? baixa12 = s.Baixa; + DateTime value25 = new DateTime(filtro.Inicio.Year, 1, 1); + if (baixa12 >= value25) + { + baixa12 = s.Baixa; + value25 = new DateTime(filtro.Inicio.Year, 1, 31); + return baixa12 <= value25; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago25 = s.ValorPago; + decimal value24 = 2; + decimal? valorPago26 = s.ValorPago; + return valorPago25 - (decimal?)value24 * valorPago26; + }), + Fev = f.Where(delegate(Lancamento s) + { + DateTime? baixa11 = s.Baixa; + DateTime value23 = new DateTime(filtro.Inicio.Year, 2, 1); + if (baixa11 >= value23) + { + baixa11 = s.Baixa; + value23 = new DateTime(filtro.Inicio.Year, 2, DateTime.DaysInMonth(filtro.Inicio.Year, 2)); + return baixa11 <= value23; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago23 = s.ValorPago; + decimal value22 = 2; + decimal? valorPago24 = s.ValorPago; + return valorPago23 - (decimal?)value22 * valorPago24; + }), + Mar = f.Where(delegate(Lancamento s) + { + DateTime? baixa10 = s.Baixa; + DateTime value21 = new DateTime(filtro.Inicio.Year, 3, 1); + if (baixa10 >= value21) + { + baixa10 = s.Baixa; + value21 = new DateTime(filtro.Inicio.Year, 3, 31); + return baixa10 <= value21; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago21 = s.ValorPago; + decimal value20 = 2; + decimal? valorPago22 = s.ValorPago; + return valorPago21 - (decimal?)value20 * valorPago22; + }), + Abr = f.Where(delegate(Lancamento s) + { + DateTime? baixa9 = s.Baixa; + DateTime value19 = new DateTime(filtro.Inicio.Year, 4, 1); + if (baixa9 >= value19) + { + baixa9 = s.Baixa; + value19 = new DateTime(filtro.Inicio.Year, 4, 30); + return baixa9 <= value19; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago19 = s.ValorPago; + decimal value18 = 2; + decimal? valorPago20 = s.ValorPago; + return valorPago19 - (decimal?)value18 * valorPago20; + }), + Mai = f.Where(delegate(Lancamento s) + { + DateTime? baixa8 = s.Baixa; + DateTime value17 = new DateTime(filtro.Inicio.Year, 5, 1); + if (baixa8 >= value17) + { + baixa8 = s.Baixa; + value17 = new DateTime(filtro.Inicio.Year, 5, 31); + return baixa8 <= value17; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago17 = s.ValorPago; + decimal value16 = 2; + decimal? valorPago18 = s.ValorPago; + return valorPago17 - (decimal?)value16 * valorPago18; + }), + Jun = f.Where(delegate(Lancamento s) + { + DateTime? baixa7 = s.Baixa; + DateTime value15 = new DateTime(filtro.Inicio.Year, 6, 1); + if (baixa7 >= value15) + { + baixa7 = s.Baixa; + value15 = new DateTime(filtro.Inicio.Year, 6, 30); + return baixa7 <= value15; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago15 = s.ValorPago; + decimal value14 = 2; + decimal? valorPago16 = s.ValorPago; + return valorPago15 - (decimal?)value14 * valorPago16; + }), + Jul = f.Where(delegate(Lancamento s) + { + DateTime? baixa6 = s.Baixa; + DateTime value13 = new DateTime(filtro.Inicio.Year, 7, 1); + if (baixa6 >= value13) + { + baixa6 = s.Baixa; + value13 = new DateTime(filtro.Inicio.Year, 7, 31); + return baixa6 <= value13; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago13 = s.ValorPago; + decimal value12 = 2; + decimal? valorPago14 = s.ValorPago; + return valorPago13 - (decimal?)value12 * valorPago14; + }), + Ago = f.Where(delegate(Lancamento s) + { + DateTime? baixa5 = s.Baixa; + DateTime value11 = new DateTime(filtro.Inicio.Year, 8, 1); + if (baixa5 >= value11) + { + baixa5 = s.Baixa; + value11 = new DateTime(filtro.Inicio.Year, 8, 31); + return baixa5 <= value11; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago11 = s.ValorPago; + decimal value10 = 2; + decimal? valorPago12 = s.ValorPago; + return valorPago11 - (decimal?)value10 * valorPago12; + }), + Set = f.Where(delegate(Lancamento s) + { + DateTime? baixa4 = s.Baixa; + DateTime value9 = new DateTime(filtro.Inicio.Year, 9, 1); + if (baixa4 >= value9) + { + baixa4 = s.Baixa; + value9 = new DateTime(filtro.Inicio.Year, 9, 30); + return baixa4 <= value9; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago9 = s.ValorPago; + decimal value8 = 2; + decimal? valorPago10 = s.ValorPago; + return valorPago9 - (decimal?)value8 * valorPago10; + }), + Out = f.Where(delegate(Lancamento s) + { + DateTime? baixa3 = s.Baixa; + DateTime value7 = new DateTime(filtro.Inicio.Year, 10, 1); + if (baixa3 >= value7) + { + baixa3 = s.Baixa; + value7 = new DateTime(filtro.Inicio.Year, 10, 31); + return baixa3 <= value7; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago7 = s.ValorPago; + decimal value6 = 2; + decimal? valorPago8 = s.ValorPago; + return valorPago7 - (decimal?)value6 * valorPago8; + }), + Nov = f.Where(delegate(Lancamento s) + { + DateTime? baixa2 = s.Baixa; + DateTime value5 = new DateTime(filtro.Inicio.Year, 11, 1); + if (baixa2 >= value5) + { + baixa2 = s.Baixa; + value5 = new DateTime(filtro.Inicio.Year, 11, 30); + return baixa2 <= value5; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago5 = s.ValorPago; + decimal value4 = 2; + decimal? valorPago6 = s.ValorPago; + return valorPago5 - (decimal?)value4 * valorPago6; + }), + Dez = f.Where(delegate(Lancamento s) + { + DateTime? baixa = s.Baixa; + DateTime value3 = new DateTime(filtro.Inicio.Year, 12, 1); + if (baixa >= value3) + { + baixa = s.Baixa; + value3 = new DateTime(filtro.Inicio.Year, 12, 31); + return baixa <= value3; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago3 = s.ValorPago; + decimal value2 = 2; + decimal? valorPago4 = s.ValorPago; + return valorPago3 - (decimal?)value2 * valorPago4; + }), + Total = f.Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago = s.ValorPago; + decimal value = 2; + decimal? valorPago2 = s.ValorPago; + return valorPago - (decimal?)value * valorPago2; + }), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val8.Dados.Add(new DadosFechamentoAnalitico + { + Nome = "TOTAL", + Jan = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jan), + Fev = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Fev), + Mar = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Mar), + Abr = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Abr), + Mai = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Mai), + Jun = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jun), + Jul = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jul), + Ago = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Ago), + Set = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Set), + Out = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Out), + Nov = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Nov), + Dez = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Dez), + Total = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Total), + PercentualCredito = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.PercentualCredito), + PercentualDebito = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.PercentualDebito) + }); + FechamentoAnalitico.Add(val8); + }); + FechamentoFinanceiroAnalitico val = new FechamentoFinanceiroAnalitico + { + NomeConta = "TOTAL NO PERÍODO", + Dados = new List<DadosFechamentoAnalitico>() + }; + val.Dados.Add(new DadosFechamentoAnalitico + { + Nome = "TOTAL", + Jan = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jan)), + Fev = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Fev)), + Mar = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Mar)), + Abr = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Abr)), + Mai = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Mai)), + Jun = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jun)), + Jul = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jul)), + Ago = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Ago)), + Set = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Set)), + Out = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Out)), + Nov = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Nov)), + Dez = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Dez)), + Total = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Total)), + PercentualCredito = 100m, + PercentualDebito = 100m + }); + FechamentoAnalitico.Add(val); + } + else + { + Fechamento = new List<FechamentoFinanceiro>(); + (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle6 = x.Controle; + return ((controle6 != null) ? controle6.Plano : null) != null; + }) + orderby x.Controle.Plano.Nome + group x by ((DomainBase)x.Controle.Plano.Plano).Id).ToList().ForEach(delegate(IGrouping<long, Lancamento> x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + FechamentoFinanceiro val7 = new FechamentoFinanceiro + { + Plano = x.First().Controle.Plano.Nome.ToUpper(), + Dados = (from f in x + orderby f.Controle.Plano.Nome + group f by ((DomainBase)f.Controle.Plano).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamento>)((IGrouping<long, Lancamento> f) => new DadosFechamento + { + Planos = f.First().Controle.Plano.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val7.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val7.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val7.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val7.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val7.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val7.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val7.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val7); + }); + FechamentoFinanceiro val2 = new FechamentoFinanceiro + { + Plano = "CONTA CORRENTE", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle5 = x.Controle; + return ((controle5 != null) ? controle5.Plano : null) != null; + }) + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamento>)((IGrouping<long, Lancamento> f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val2.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val2.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val2.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val2.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val2.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val2.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val2.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val2); + FechamentoFinanceiro val3 = new FechamentoFinanceiro + { + Plano = "TRANSFERÊNCIA", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle4 = x.Controle; + return ((controle4 != null) ? controle4.Plano : null) == null; + }) + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamento>)((IGrouping<long, Lancamento> f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val3.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val3.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val3.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val3.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val3.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where(delegate(Lancamento s) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + ControleFinanceiro controle3 = s.Controle; + return ((controle3 != null) ? controle3.Plano : null) == null && (int)s.Sinal == 0; + }).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val3.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val3.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where(delegate(Lancamento s) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + ControleFinanceiro controle2 = s.Controle; + return ((controle2 != null) ? controle2.Plano : null) == null && (int)s.Sinal == 1; + }).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val3); + FechamentoFinanceiro val4 = new FechamentoFinanceiro + { + Plano = "CONTA CORRENTE + TRANSFERÊNCIA", + Dados = (from x in lancamentos + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamento>)((IGrouping<long, Lancamento> f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val4.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val4.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val4.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val4.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val4.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val4.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val4.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val4); + FechamentoFinanceiro val5 = new FechamentoFinanceiro + { + Plano = "CENTRO DE CUSTO", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle = x.Controle; + return ((controle != null) ? controle.Plano : null) != null; + }) + orderby x.Controle.Centro.Descricao + group x by ((DomainBase)x.Controle.Centro).Id).Select((Func<IGrouping<long, Lancamento>, DadosFechamento>)((IGrouping<long, Lancamento> f) => new DadosFechamento + { + Planos = f.First().Controle.Centro.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val5.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val5.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val5.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val5.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val5.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val5.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val5.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val5); + FechamentoFinanceiro val6 = new FechamentoFinanceiro + { + Plano = "TIPO PAGAMENTO", + Dados = (from x in lancamentos + orderby EnumHelper.GetDescription<TipoPagamento>(x.TipoPagamento) + group x by x.TipoPagamento).Select((Func<IGrouping<TipoPagamento, Lancamento>, DadosFechamento>)((IGrouping<TipoPagamento, Lancamento> f) => new DadosFechamento + { + Planos = EnumHelper.GetDescription<TipoPagamento>(f.First().TipoPagamento), + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val6.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val6.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val6.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val6.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val6.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val6.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val6.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Soma = val6.Dados.Sum((DadosFechamento t) => t.Credito) - val6.Dados.Sum((DadosFechamento t) => t.Debito), + SomaPercentual = ((val6.Dados.Sum((DadosFechamento t) => t.Credito) + val6.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : ((val6.Dados.Sum((DadosFechamento t) => t.Credito) - val6.Dados.Sum((DadosFechamento t) => t.Debito)) * 100m / (val6.Dados.Sum((DadosFechamento t) => t.Credito) + val6.Dados.Sum((DadosFechamento t) => t.Debito)))) + }); + Fechamento.Add(val6); + } + HtmlContent = await GerarHtml(screen: true); + } + + private async Task<string> GerarHtml(bool screen) + { + string relatorio = ""; + if (Analitico) + { + foreach (FechamentoFinanceiroAnalitico x3 in FechamentoAnalitico) + { + string body = await Funcoes.GenerateTable(x3.Dados, new List<string>(), grafico: false, screen); + relatorio += Funcoes.CreateCard(x3.NomeConta, body); + } + } + else + { + foreach (FechamentoFinanceiro x2 in Fechamento) + { + string body2 = await Funcoes.GenerateTable(x2.Dados, new List<string> { "TOTAL CRÉDITO - TOTAL DÉBITO", "% TOTAL DE CRÉDITO - % TOTAL DE DÉBITO" }, grafico: false, screen); + relatorio += Funcoes.CreateCard(x2.Plano, body2); + } + FechamentoFinanceiro total = new FechamentoFinanceiro + { + Plano = "TOTAL NO PERÍODO", + Dados = new List<DadosFechamento> + { + new DadosFechamento + { + Planos = "TOTAL", + Soma = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.Soma)), + SomaPercentual = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.SomaPercentual)) + } + } + }; + string body3 = await Funcoes.GenerateTable(total.Dados, new List<string> { "TOTAL CRÉDITO", "TOTAL DÉBITO", "% CRÉDITO", "% DÉBITO" }, grafico: false, screen); + relatorio += Funcoes.CreateCard(total.Plano, body3); + } + if (Inicio.HasValue && Fim.HasValue) + { + return Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = (Analitico ? "RELATÓRIO FECHAMENTO FINANCEIRO ANALÍTICO" : "RELATÓRIO FECHAMENTO FINANCEIRO"), + Inicio = Inicio.Value, + Fim = Fim.Value + }, relatorio, "50", "portrait"); + } + return null; + } + + public async Task Print() + { + string path = Path.GetTempPath(); + string value = await GerarHtml(screen: false); + string text = $"{path}FECHAMENTO_FINANCEIRO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public async Task GerarExcel() + { + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + "FECHAMENTO " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + XLWorkbook val2 = new XLWorkbook(); + int index2 = 1; + if (Analitico) + { + if (FechamentoAnalitico == null || FechamentoAnalitico.Count == 0) + { + return; + } + foreach (FechamentoFinanceiroAnalitico item in FechamentoAnalitico) + { + string text2 = $"{index2}_{item.NomeConta}"; + while (text2.Replace("/", "_").Trim().Length > 30) + { + text2 = Regex.Replace(text2.Trim(), "[^\\s]*$", ""); + } + val2 = await Funcoes.GerarXls(val2, text2.Replace("/", "_"), item.Dados.ToList()); + } + } + else + { + if (Fechamento == null || Fechamento.Count == 0) + { + return; + } + List<FechamentoFinanceiro> list = new List<FechamentoFinanceiro>(); + list.AddRange(Fechamento); + list.Add(new FechamentoFinanceiro + { + Plano = "TOTAL NO PERÍODO", + Dados = new List<DadosFechamento> + { + new DadosFechamento + { + Planos = "TOTAL", + Soma = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.Soma)) + } + } + }); + index2 = 1; + foreach (FechamentoFinanceiro item2 in list) + { + string text3 = $"{index2}_{item2.Plano}"; + index2++; + while (text3.Replace("/", "_").Trim().Length > 30) + { + text3 = Regex.Replace(text3.Trim(), "[^\\s]*$", ""); + } + val2 = await Funcoes.GerarXls(val2, text3.Replace("/", "_"), item2.Dados.ToList()); + } + } + RegistrarAcao($"EMITIU EXCEL DO RELATÓRIO PERÍODO ENTRE {Inicio:d} E {Fim:d}", (Relatorio)11); + val2.SaveAs(fileName); + Process.Start(fileName); + } +} |