From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Relatorios/FechamentoFinanceiroViewModel.cs | 2746 ++++++++++++++++++++ 1 file changed, 2746 insertions(+) create mode 100644 Codemerx/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs (limited to 'Codemerx/Gestor.Application/ViewModels/Financeiro/Relatorios') diff --git a/Codemerx/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs b/Codemerx/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs new file mode 100644 index 0000000..084c527 --- /dev/null +++ b/Codemerx/Gestor.Application/ViewModels/Financeiro/Relatorios/FechamentoFinanceiroViewModel.cs @@ -0,0 +1,2746 @@ +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 _plano; + + private List _planos; + + private List _centro; + + private List _conta; + + private DateTime? _inicio; + + private DateTime? _fim; + + private List _fechamento; + + private List _fechamentoAnalitico; + + private string _htmlContent; + + private bool _print; + + public bool Analitico + { + get + { + return this._analitico; + } + set + { + this._analitico = value; + base.OnPropertyChanged("Analitico"); + } + } + + public List Centro + { + get + { + return this._centro; + } + set + { + this._centro = value; + base.OnPropertyChanged("Centro"); + } + } + + public List Conta + { + get + { + return this._conta; + } + set + { + this._conta = value; + base.OnPropertyChanged("Conta"); + } + } + + public List Fechamento + { + get + { + return this._fechamento; + } + set + { + this._fechamento = value; + base.OnPropertyChanged("Fechamento"); + } + } + + public List 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 Plano + { + get + { + return this._plano; + } + set + { + this._plano = value; + base.OnPropertyChanged("Plano"); + } + } + + public List 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 configuracoes = Recursos.Configuracoes; + if (!configuracoes.Any((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(xLWorkbook, str1.Replace("/", "_"), fechamentoAnalitico.get_Dados().ToList(), null); + } + } + } + else if (this.Fechamento == null || this.Fechamento.Count == 0) + { + str = null; + return; + } + else + { + List fechamentoFinanceiros = new List(); + fechamentoFinanceiros.AddRange(this.Fechamento); + List fechamentoFinanceiros1 = fechamentoFinanceiros; + FechamentoFinanceiro fechamentoFinanceiro = new FechamentoFinanceiro(); + fechamentoFinanceiro.set_Plano("TOTAL NO PERÍODO"); + List dadosFechamentos = new List(); + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos("TOTAL"); + List fechamento = this.Fechamento; + IEnumerable plano = + from x in fechamento + where x.get_Plano() == "TIPO PAGAMENTO" + select x; + dadosFechamento.set_Soma(plano.Sum((FechamentoFinanceiro x) => x.get_Dados().Sum((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(xLWorkbook, str2.Replace("/", "_"), fechamentoFinanceiro1.get_Dados().ToList(), 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 GerarHtml(bool screen) + { + string str; + string str1 = ""; + if (!this.Analitico) + { + foreach (FechamentoFinanceiro fechamento in this.Fechamento) + { + List dados = fechamento.get_Dados(); + List strs = new List() + { + "TOTAL CRÉDITO - TOTAL DÉBITO", + "% TOTAL DE CRÉDITO - % TOTAL DE DÉBITO" + }; + string str2 = await Funcoes.GenerateTable(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 dadosFechamentos = new List(); + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos("TOTAL"); + List fechamentoFinanceiros = this.Fechamento; + IEnumerable plano = + from x in fechamentoFinanceiros + where x.get_Plano() == "TIPO PAGAMENTO" + select x; + dadosFechamento.set_Soma(plano.Sum((FechamentoFinanceiro x) => x.get_Dados().Sum((DadosFechamento y) => y.get_Soma()))); + List fechamento1 = this.Fechamento; + IEnumerable plano1 = + from x in fechamento1 + where x.get_Plano() == "TIPO PAGAMENTO" + select x; + dadosFechamento.set_SomaPercentual(plano1.Sum((FechamentoFinanceiro x) => x.get_Dados().Sum((DadosFechamento y) => y.get_SomaPercentual()))); + dadosFechamentos.Add(dadosFechamento); + fechamentoFinanceiro.set_Dados(dadosFechamentos); + FechamentoFinanceiro fechamentoFinanceiro1 = fechamentoFinanceiro; + List dados1 = fechamentoFinanceiro1.get_Dados(); + List strs1 = new List() + { + "TOTAL CRÉDITO", + "TOTAL DÉBITO", + "% CRÉDITO", + "% DÉBITO" + }; + string str3 = await Funcoes.GenerateTable(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(fechamentoAnalitico.get_Dados(), new List(), 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 func8 = null; + Func func9 = null; + Func func10 = null; + Func func11 = null; + Func func12 = null; + Func func13 = null; + Func func14 = null; + Func func15 = null; + Func func16 = null; + Func func17 = null; + Func func18 = null; + Func func19 = null; + if (this.Inicio.HasValue && this.Fim.HasValue) + { + List planos = this.Plano; + IEnumerable selecionado = + from x in planos + where x.get_Selecionado() + select x; + List nums20 = ( + from x in selecionado + select x.get_Id()).ToList(); + List planos1 = this.Planos; + IEnumerable selecionado1 = + from x in planos1 + where x.get_Selecionado() + select x; + List nums21 = ( + from x in selecionado1 + select x.get_Id()).ToList(); + List centro = this.Centro; + IEnumerable centros = + from x in centro + where x.get_Selecionado() + select x; + List nums22 = ( + from x in centros + select x.get_Id()).ToList(); + List conta = this.Conta; + IEnumerable bancosContas = + from x in conta + where x.get_Selecionado() + select x; + List nums23 = ( + from x in bancosContas + select x.get_Id()).ToList(); + 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 lancamentos13 = await this._servico.BuscarFechamento(filtroFinanceiro1); + if (!this.Analitico) + { + this.Fechamento = new List(); + List lancamentos14 = lancamentos13; + IEnumerable lancamentos15 = lancamentos14.Where((Lancamento x) => { + object plano; + ControleFinanceiro controle = x.get_Controle(); + if (controle != null) + { + plano = controle.get_Plano(); + } + else + { + plano = null; + } + return plano != null; + }); + IOrderedEnumerable 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>().ForEach((IGrouping x) => { + decimal num3; + decimal num4; + FechamentoFinanceiro fechamentoFinanceiro = new FechamentoFinanceiro(); + fechamentoFinanceiro.set_Plano(x.First().get_Controle().get_Plano().get_Nome().ToUpper()); + IGrouping nums8 = x; + Func 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 lancamentos8 = nums8.OrderBy(u003cu003e9_5197); + Func 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(u003cu003e9_5198).Select, DadosFechamento>((IGrouping f) => { + decimal zero; + decimal num; + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(f.First().get_Controle().get_Plano().get_Descricao()); + IGrouping nums = f; + Func 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 lancamentos = nums.Where(u003cu003e9_51100); + Func 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(u003cu003e9_51101)); + IGrouping nums1 = f; + Func 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 lancamentos1 = nums1.Where(u003cu003e9_51102); + Func 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(u003cu003e9_51103) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping nums2 = f; + Func 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 lancamentos2 = nums2.Where(u003cu003e9_51104); + Func 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(u003cu003e9_51105); + IGrouping nums3 = x; + Func 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 lancamentos3 = nums3.Where(u003cu003e9_51106); + Func 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(u003cu003e9_51107)) * new decimal(100); + } + dadosFechamento.set_PercentualCredito(zero); + IGrouping nums4 = f; + Func 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 lancamentos4 = nums4.Where(u003cu003e9_51108); + Func 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(u003cu003e9_51109)); + IGrouping nums5 = f; + Func 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 lancamentos5 = nums5.Where(u003cu003e9_51110); + Func 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(u003cu003e9_51111) == decimal.Zero) + { + num = decimal.Zero; + } + else + { + IGrouping nums6 = f; + Func 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 lancamentos6 = nums6.Where(u003cu003e9_51112); + Func 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(u003cu003e9_51113); + IGrouping nums7 = x; + Func 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 lancamentos7 = nums7.Where(u003cu003e9_51114); + Func 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(u003cu003e9_51115)) * new decimal(100); + } + dadosFechamento.set_PercentualDebito(num); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro1 = fechamentoFinanceiro; + List dados = fechamentoFinanceiro1.get_Dados(); + DadosFechamento dadosFechamento1 = new DadosFechamento(); + dadosFechamento1.set_Planos("TOTAL"); + List dadosFechamentos = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51116)); + List dados1 = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51117)); + List dadosFechamentos1 = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51118) == decimal.Zero) + { + num3 = decimal.Zero; + } + else + { + List dados2 = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51119); + List lancamentos9 = lancamentos13; + Func 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 lancamentos10 = lancamentos9.Where(u003cu003e9_51120); + Func 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(u003cu003e9_51121)) * new decimal(100); + } + dadosFechamento1.set_PercentualCredito(num3); + List dadosFechamentos2 = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51122) == decimal.Zero) + { + num4 = decimal.Zero; + } + else + { + List dados3 = fechamentoFinanceiro1.get_Dados(); + Func 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(u003cu003e9_51123); + List lancamentos11 = lancamentos13; + Func 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 lancamentos12 = lancamentos11.Where(u003cu003e9_51124); + Func 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(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 lancamentos16 = lancamentos13; + IEnumerable lancamentos17 = lancamentos16.Where((Lancamento x) => { + object plano; + ControleFinanceiro controle = x.get_Controle(); + if (controle != null) + { + plano = controle.get_Plano(); + } + else + { + plano = null; + } + return plano != null; + }); + IOrderedEnumerable 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, DadosFechamento>((IGrouping f) => { + decimal zero; + decimal num; + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(f.First().get_Conta().get_Descricao()); + IGrouping nums = f; + Func 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 lancamentos = nums.Where(u003cu003e9_51130); + Func 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(u003cu003e9_51131)); + IGrouping nums1 = f; + Func 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 lancamentos1 = nums1.Where(u003cu003e9_51132); + Func 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(u003cu003e9_51133) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping nums2 = f; + Func 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 lancamentos2 = nums2.Where(u003cu003e9_51134); + Func 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(u003cu003e9_51135); + List lancamentos3 = lancamentos13; + Func 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 lancamentos4 = lancamentos3.Where(u003cu003e9_51136); + Func 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(u003cu003e9_51137)) * new decimal(100); + } + dadosFechamento.set_PercentualCredito(zero); + IGrouping nums3 = f; + Func 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 lancamentos5 = nums3.Where(u003cu003e9_51138); + Func 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(u003cu003e9_51139)); + IGrouping nums4 = f; + Func 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 lancamentos6 = nums4.Where(u003cu003e9_51140); + Func 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(u003cu003e9_51141) == decimal.Zero) + { + num = decimal.Zero; + } + else + { + IGrouping nums5 = f; + Func 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 lancamentos7 = nums5.Where(u003cu003e9_51142); + Func 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(u003cu003e9_51143); + List lancamentos8 = lancamentos13; + Func 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 lancamentos9 = lancamentos8.Where(u003cu003e9_51144); + Func 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(u003cu003e9_51145)) * new decimal(100); + } + dadosFechamento.set_PercentualDebito(num); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro3 = fechamentoFinanceiro2; + List dadosFechamentos3 = fechamentoFinanceiro3.get_Dados(); + DadosFechamento dadosFechamento2 = new DadosFechamento(); + dadosFechamento2.set_Planos("TOTAL"); + List dadosFechamentos4 = fechamentoFinanceiro3.get_Dados(); + dadosFechamento2.set_Credito(dadosFechamentos4.Sum((DadosFechamento t) => t.get_Credito())); + List dadosFechamentos5 = fechamentoFinanceiro3.get_Dados(); + dadosFechamento2.set_Debito(dadosFechamentos5.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos6 = fechamentoFinanceiro3.get_Dados(); + if (dadosFechamentos6.Sum((DadosFechamento t) => t.get_Credito()) == decimal.Zero) + { + num7 = decimal.Zero; + } + else + { + List dadosFechamentos7 = fechamentoFinanceiro3.get_Dados(); + decimal num18 = dadosFechamentos7.Sum((DadosFechamento t) => t.get_Credito()); + List lancamentos18 = lancamentos13; + IEnumerable lancamentos19 = lancamentos18.Where((Lancamento s) => { + if (s.get_Controle() == null) + { + return false; + } + return s.get_Sinal() == 0; + }); + num7 = (num18 / lancamentos19.Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento2.set_PercentualCredito(num7); + List dadosFechamentos8 = fechamentoFinanceiro3.get_Dados(); + if (dadosFechamentos8.Sum((DadosFechamento t) => t.get_Debito()) == decimal.Zero) + { + num8 = decimal.Zero; + } + else + { + List dadosFechamentos9 = fechamentoFinanceiro3.get_Dados(); + decimal num19 = dadosFechamentos9.Sum((DadosFechamento t) => t.get_Debito()); + List lancamentos20 = lancamentos13; + IEnumerable lancamentos21 = lancamentos20.Where((Lancamento s) => { + if (s.get_Controle() == null) + { + return false; + } + return s.get_Sinal() == 1; + }); + num8 = (num19 / lancamentos21.Sum((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 lancamentos22 = lancamentos13; + IEnumerable lancamentos23 = lancamentos22.Where((Lancamento x) => { + object plano; + ControleFinanceiro controle = x.get_Controle(); + if (controle != null) + { + plano = controle.get_Plano(); + } + else + { + plano = null; + } + return plano == null; + }); + IOrderedEnumerable descricao1 = + from x in lancamentos23 + orderby x.get_Conta().get_Descricao() + select x; + IEnumerable> id = + from x in descricao1 + group x by x.get_Conta().get_Id(); + fechamentoFinanceiro4.set_Dados(id.Select, DadosFechamento>((IGrouping f) => { + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(f.First().get_Conta().get_Descricao()); + dadosFechamento.set_Credito(( + from s in f + where s.get_Sinal() == 0 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())); + dadosFechamento.set_PercentualCredito((( + from s in f + where s.get_Sinal() == 0 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) == decimal.Zero ? decimal.Zero : (( + from s in f + where s.get_Sinal() == 0 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) / ( + from s in f + where s.get_Sinal() == 0 + select s).Sum((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 s) => s.get_ValorPago().GetValueOrDefault())); + dadosFechamento.set_PercentualDebito((( + from s in f + where s.get_Sinal() == 1 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) == decimal.Zero ? decimal.Zero : (( + from s in f + where s.get_Sinal() == 1 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault()) / ( + from s in f + where s.get_Sinal() == 1 + select s).Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100))); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro5 = fechamentoFinanceiro4; + List dadosFechamentos10 = fechamentoFinanceiro5.get_Dados(); + DadosFechamento dadosFechamento3 = new DadosFechamento(); + dadosFechamento3.set_Planos("TOTAL"); + List dadosFechamentos11 = fechamentoFinanceiro5.get_Dados(); + dadosFechamento3.set_Credito(dadosFechamentos11.Sum((DadosFechamento t) => t.get_Credito())); + List dadosFechamentos12 = fechamentoFinanceiro5.get_Dados(); + dadosFechamento3.set_Debito(dadosFechamentos12.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos13 = fechamentoFinanceiro5.get_Dados(); + if (dadosFechamentos13.Sum((DadosFechamento t) => t.get_Credito()) == decimal.Zero) + { + num9 = decimal.Zero; + } + else + { + List dadosFechamentos14 = fechamentoFinanceiro5.get_Dados(); + decimal num20 = dadosFechamentos14.Sum((DadosFechamento t) => t.get_Credito()); + List lancamentos24 = lancamentos13; + IEnumerable lancamentos25 = lancamentos24.Where((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 s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento3.set_PercentualCredito(num9); + List dadosFechamentos15 = fechamentoFinanceiro5.get_Dados(); + if (dadosFechamentos15.Sum((DadosFechamento t) => t.get_Debito()) == decimal.Zero) + { + num10 = decimal.Zero; + } + else + { + List dadosFechamentos16 = fechamentoFinanceiro5.get_Dados(); + decimal num21 = dadosFechamentos16.Sum((DadosFechamento t) => t.get_Debito()); + List lancamentos26 = lancamentos13; + IEnumerable lancamentos27 = lancamentos26.Where((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 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 lancamentos28 = lancamentos13; + IOrderedEnumerable 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, DadosFechamento>((IGrouping f) => { + decimal zero; + decimal num; + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(f.First().get_Conta().get_Descricao()); + IGrouping nums = f; + Func 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 lancamentos = nums.Where(u003cu003e9_51189); + Func 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(u003cu003e9_51190)); + IGrouping nums1 = f; + Func 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 lancamentos1 = nums1.Where(u003cu003e9_51191); + Func 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(u003cu003e9_51192) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping nums2 = f; + Func 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 lancamentos2 = nums2.Where(u003cu003e9_51193); + Func 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(u003cu003e9_51194); + List lancamentos3 = lancamentos13; + Func 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 lancamentos4 = lancamentos3.Where(u003cu003e9_51195); + Func 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(u003cu003e9_51196)) * new decimal(100); + } + dadosFechamento.set_PercentualCredito(zero); + IGrouping nums3 = f; + Func 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 lancamentos5 = nums3.Where(u003cu003e9_51197); + Func 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(u003cu003e9_51198)); + IGrouping nums4 = f; + Func 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 lancamentos6 = nums4.Where(u003cu003e9_51199); + Func 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(u003cu003e9_51200) == decimal.Zero) + { + num = decimal.Zero; + } + else + { + IGrouping nums5 = f; + Func 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 lancamentos7 = nums5.Where(u003cu003e9_51201); + Func 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(u003cu003e9_51202); + List lancamentos8 = lancamentos13; + Func 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 lancamentos9 = lancamentos8.Where(u003cu003e9_51203); + Func 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(u003cu003e9_51204)) * new decimal(100); + } + dadosFechamento.set_PercentualDebito(num); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro7 = fechamentoFinanceiro6; + List dadosFechamentos17 = fechamentoFinanceiro7.get_Dados(); + DadosFechamento dadosFechamento4 = new DadosFechamento(); + dadosFechamento4.set_Planos("TOTAL"); + List dadosFechamentos18 = fechamentoFinanceiro7.get_Dados(); + dadosFechamento4.set_Credito(dadosFechamentos18.Sum((DadosFechamento t) => t.get_Credito())); + List dadosFechamentos19 = fechamentoFinanceiro7.get_Dados(); + dadosFechamento4.set_Debito(dadosFechamentos19.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos20 = fechamentoFinanceiro7.get_Dados(); + if (dadosFechamentos20.Sum((DadosFechamento t) => t.get_Credito()) == decimal.Zero) + { + num11 = decimal.Zero; + } + else + { + List dadosFechamentos21 = fechamentoFinanceiro7.get_Dados(); + decimal num22 = dadosFechamentos21.Sum((DadosFechamento t) => t.get_Credito()); + List lancamentos29 = lancamentos13; + IEnumerable sinal = + from s in lancamentos29 + where s.get_Sinal() == 0 + select s; + num11 = (num22 / sinal.Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento4.set_PercentualCredito(num11); + List dadosFechamentos22 = fechamentoFinanceiro7.get_Dados(); + if (dadosFechamentos22.Sum((DadosFechamento t) => t.get_Debito()) == decimal.Zero) + { + num12 = decimal.Zero; + } + else + { + List dadosFechamentos23 = fechamentoFinanceiro7.get_Dados(); + decimal num23 = dadosFechamentos23.Sum((DadosFechamento t) => t.get_Debito()); + List lancamentos30 = lancamentos13; + IEnumerable sinal1 = + from s in lancamentos30 + where s.get_Sinal() == 1 + select s; + num12 = (num23 / sinal1.Sum((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 lancamentos31 = lancamentos13; + IEnumerable lancamentos32 = lancamentos31.Where((Lancamento x) => { + object plano; + ControleFinanceiro controle = x.get_Controle(); + if (controle != null) + { + plano = controle.get_Plano(); + } + else + { + plano = null; + } + return plano != null; + }); + IOrderedEnumerable 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, DadosFechamento>((IGrouping f) => { + decimal zero; + decimal num; + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(f.First().get_Controle().get_Centro().get_Descricao()); + IGrouping nums = f; + Func 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 lancamentos = nums.Where(u003cu003e9_51219); + Func 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(u003cu003e9_51220)); + IGrouping nums1 = f; + Func 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 lancamentos1 = nums1.Where(u003cu003e9_51221); + Func 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(u003cu003e9_51222) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping nums2 = f; + Func 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 lancamentos2 = nums2.Where(u003cu003e9_51223); + Func 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(u003cu003e9_51224); + List lancamentos3 = lancamentos13; + Func 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 lancamentos4 = lancamentos3.Where(u003cu003e9_51225); + Func 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(u003cu003e9_51226)) * new decimal(100); + } + dadosFechamento.set_PercentualCredito(zero); + IGrouping nums3 = f; + Func 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 lancamentos5 = nums3.Where(u003cu003e9_51227); + Func 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(u003cu003e9_51228)); + IGrouping nums4 = f; + Func 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 lancamentos6 = nums4.Where(u003cu003e9_51229); + Func 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(u003cu003e9_51230) == decimal.Zero) + { + num = decimal.Zero; + } + else + { + IGrouping nums5 = f; + Func 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 lancamentos7 = nums5.Where(u003cu003e9_51231); + Func 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(u003cu003e9_51232); + List lancamentos8 = lancamentos13; + Func 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 lancamentos9 = lancamentos8.Where(u003cu003e9_51233); + Func 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(u003cu003e9_51234)) * new decimal(100); + } + dadosFechamento.set_PercentualDebito(num); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro9 = fechamentoFinanceiro8; + List dadosFechamentos24 = fechamentoFinanceiro9.get_Dados(); + DadosFechamento dadosFechamento5 = new DadosFechamento(); + dadosFechamento5.set_Planos("TOTAL"); + List dadosFechamentos25 = fechamentoFinanceiro9.get_Dados(); + dadosFechamento5.set_Credito(dadosFechamentos25.Sum((DadosFechamento t) => t.get_Credito())); + List dadosFechamentos26 = fechamentoFinanceiro9.get_Dados(); + dadosFechamento5.set_Debito(dadosFechamentos26.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos27 = fechamentoFinanceiro9.get_Dados(); + if (dadosFechamentos27.Sum((DadosFechamento t) => t.get_Credito()) == decimal.Zero) + { + num13 = decimal.Zero; + } + else + { + List dadosFechamentos28 = fechamentoFinanceiro9.get_Dados(); + decimal num24 = dadosFechamentos28.Sum((DadosFechamento t) => t.get_Credito()); + List lancamentos33 = lancamentos13; + IEnumerable lancamentos34 = lancamentos33.Where((Lancamento s) => { + if (s.get_Controle() == null) + { + return false; + } + return s.get_Sinal() == 0; + }); + num13 = (num24 / lancamentos34.Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento5.set_PercentualCredito(num13); + List dadosFechamentos29 = fechamentoFinanceiro9.get_Dados(); + if (dadosFechamentos29.Sum((DadosFechamento t) => t.get_Debito()) == decimal.Zero) + { + num14 = decimal.Zero; + } + else + { + List dadosFechamentos30 = fechamentoFinanceiro9.get_Dados(); + decimal num25 = dadosFechamentos30.Sum((DadosFechamento t) => t.get_Debito()); + List lancamentos35 = lancamentos13; + IEnumerable lancamentos36 = lancamentos35.Where((Lancamento s) => { + if (s.get_Controle() == null) + { + return false; + } + return s.get_Sinal() == 1; + }); + num14 = (num25 / lancamentos36.Sum((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 lancamentos37 = lancamentos13; + IOrderedEnumerable description = + from x in lancamentos37 + orderby EnumHelper.GetDescription(x.get_TipoPagamento()) + select x; + fechamentoFinanceiro10.set_Dados(( + from x in description + group x by x.get_TipoPagamento()).Select, DadosFechamento>((IGrouping f) => { + decimal zero; + decimal num; + DadosFechamento dadosFechamento = new DadosFechamento(); + dadosFechamento.set_Planos(EnumHelper.GetDescription(f.First().get_TipoPagamento())); + IGrouping tipoPagamentos = f; + Func 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 lancamentos = tipoPagamentos.Where(u003cu003e9_51248); + Func 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(u003cu003e9_51249)); + IGrouping tipoPagamentos1 = f; + Func 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 lancamentos1 = tipoPagamentos1.Where(u003cu003e9_51250); + Func 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(u003cu003e9_51251) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping tipoPagamentos2 = f; + Func 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 lancamentos2 = tipoPagamentos2.Where(u003cu003e9_51252); + Func 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(u003cu003e9_51253); + List lancamentos3 = lancamentos13; + Func 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 lancamentos4 = lancamentos3.Where(u003cu003e9_51254); + Func 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(u003cu003e9_51255)) * new decimal(100); + } + dadosFechamento.set_PercentualCredito(zero); + IGrouping tipoPagamentos3 = f; + Func 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 lancamentos5 = tipoPagamentos3.Where(u003cu003e9_51256); + Func 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(u003cu003e9_51257)); + IGrouping tipoPagamentos4 = f; + Func 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 lancamentos6 = tipoPagamentos4.Where(u003cu003e9_51258); + Func 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(u003cu003e9_51259) == decimal.Zero) + { + num = decimal.Zero; + } + else + { + IGrouping tipoPagamentos5 = f; + Func 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 lancamentos7 = tipoPagamentos5.Where(u003cu003e9_51260); + Func 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(u003cu003e9_51261); + List lancamentos8 = lancamentos13; + Func 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 lancamentos9 = lancamentos8.Where(u003cu003e9_51262); + Func 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(u003cu003e9_51263)) * new decimal(100); + } + dadosFechamento.set_PercentualDebito(num); + return dadosFechamento; + }).ToList()); + FechamentoFinanceiro fechamentoFinanceiro11 = fechamentoFinanceiro10; + List dadosFechamentos31 = fechamentoFinanceiro11.get_Dados(); + DadosFechamento dadosFechamento6 = new DadosFechamento(); + dadosFechamento6.set_Planos("TOTAL"); + List dadosFechamentos32 = fechamentoFinanceiro11.get_Dados(); + dadosFechamento6.set_Credito(dadosFechamentos32.Sum((DadosFechamento t) => t.get_Credito())); + List dadosFechamentos33 = fechamentoFinanceiro11.get_Dados(); + dadosFechamento6.set_Debito(dadosFechamentos33.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos34 = fechamentoFinanceiro11.get_Dados(); + if (dadosFechamentos34.Sum((DadosFechamento t) => t.get_Credito()) == decimal.Zero) + { + num15 = decimal.Zero; + } + else + { + List dadosFechamentos35 = fechamentoFinanceiro11.get_Dados(); + decimal num26 = dadosFechamentos35.Sum((DadosFechamento t) => t.get_Credito()); + List lancamentos38 = lancamentos13; + IEnumerable sinal2 = + from s in lancamentos38 + where s.get_Sinal() == 0 + select s; + num15 = (num26 / sinal2.Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento6.set_PercentualCredito(num15); + List dadosFechamentos36 = fechamentoFinanceiro11.get_Dados(); + if (dadosFechamentos36.Sum((DadosFechamento t) => t.get_Debito()) == decimal.Zero) + { + num16 = decimal.Zero; + } + else + { + List dadosFechamentos37 = fechamentoFinanceiro11.get_Dados(); + decimal num27 = dadosFechamentos37.Sum((DadosFechamento t) => t.get_Debito()); + List lancamentos39 = lancamentos13; + IEnumerable sinal3 = + from s in lancamentos39 + where s.get_Sinal() == 1 + select s; + num16 = (num27 / sinal3.Sum((Lancamento s) => s.get_ValorPago().GetValueOrDefault())) * new decimal(100); + } + dadosFechamento6.set_PercentualDebito(num16); + List dadosFechamentos38 = fechamentoFinanceiro11.get_Dados(); + decimal num28 = dadosFechamentos38.Sum((DadosFechamento t) => t.get_Credito()); + List dadosFechamentos39 = fechamentoFinanceiro11.get_Dados(); + dadosFechamento6.set_Soma(num28 - dadosFechamentos39.Sum((DadosFechamento t) => t.get_Debito())); + List dadosFechamentos40 = fechamentoFinanceiro11.get_Dados(); + decimal num29 = dadosFechamentos40.Sum((DadosFechamento t) => t.get_Credito()); + List dadosFechamentos41 = fechamentoFinanceiro11.get_Dados(); + if ((num29 + dadosFechamentos41.Sum((DadosFechamento t) => t.get_Debito())) == decimal.Zero) + { + num17 = decimal.Zero; + } + else + { + List dadosFechamentos42 = fechamentoFinanceiro11.get_Dados(); + decimal num30 = dadosFechamentos42.Sum((DadosFechamento t) => t.get_Credito()); + List dadosFechamentos43 = fechamentoFinanceiro11.get_Dados(); + decimal num31 = (num30 - dadosFechamentos43.Sum((DadosFechamento t) => t.get_Debito())) * new decimal(100); + List dadosFechamentos44 = fechamentoFinanceiro11.get_Dados(); + decimal num32 = dadosFechamentos44.Sum((DadosFechamento t) => t.get_Credito()); + List dadosFechamentos45 = fechamentoFinanceiro11.get_Dados(); + num17 = num31 / (num32 + dadosFechamentos45.Sum((DadosFechamento t) => t.get_Debito())); + } + dadosFechamento6.set_SomaPercentual(num17); + dadosFechamentos31.Add(dadosFechamento6); + this.Fechamento.Add(fechamentoFinanceiro11); + } + else + { + this.FechamentoAnalitico = new List(); + List lancamentos40 = lancamentos13; + IEnumerable lancamentos41 = lancamentos40.Where((Lancamento x) => { + object plano; + ControleFinanceiro controle = x.get_Controle(); + if (controle != null) + { + plano = controle.get_Plano(); + } + else + { + plano = null; + } + return plano != null; + }); + IOrderedEnumerable 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>().ForEach((IGrouping x) => { + FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico = new FechamentoFinanceiroAnalitico(); + fechamentoFinanceiroAnalitico.set_NomeConta(x.First().get_Controle().get_Plano().get_Plano().get_Descricao().ToUpper()); + IGrouping nums19 = x; + Func 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 lancamentos12 = nums19.OrderBy(u003cu003e9_5112); + Func 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(u003cu003e9_5113).Select, DadosFechamentoAnalitico>((IGrouping f) => { + Func func; + decimal zero; + decimal zero1; + DadosFechamentoAnalitico dadosFechamentoAnalitico = new DadosFechamentoAnalitico(); + dadosFechamentoAnalitico.set_Nome(f.First().get_Controle().get_Plano().get_Descricao()); + IGrouping nums = f; + Func u003cu003e9_15 = func8; + if (u003cu003e9_15 == null) + { + Func 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 list = nums.Where(u003cu003e9_15).ToList(); + Func 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(u003cu003e9_5116)); + IGrouping nums1 = f; + Func u003cu003e9_17 = func9; + if (u003cu003e9_17 == null) + { + Func 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 lancamentos = nums1.Where(u003cu003e9_17).ToList(); + Func 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(u003cu003e9_5118)); + IGrouping nums2 = f; + Func u003cu003e9_19 = func10; + if (u003cu003e9_19 == null) + { + Func 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 list1 = nums2.Where(u003cu003e9_19).ToList(); + Func 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(u003cu003e9_5120)); + IGrouping nums3 = f; + Func u003cu003e9_21 = func11; + if (u003cu003e9_21 == null) + { + Func 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 lancamentos1 = nums3.Where(u003cu003e9_21).ToList(); + Func 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(u003cu003e9_5122)); + IGrouping nums4 = f; + Func u003cu003e9_23 = func12; + if (u003cu003e9_23 == null) + { + Func 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 list2 = nums4.Where(u003cu003e9_23).ToList(); + Func 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(u003cu003e9_5124)); + IGrouping nums5 = f; + Func u003cu003e9_25 = func13; + if (u003cu003e9_25 == null) + { + Func 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 lancamentos2 = nums5.Where(u003cu003e9_25).ToList(); + Func 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(u003cu003e9_5126)); + IGrouping nums6 = f; + Func u003cu003e9_27 = func14; + if (u003cu003e9_27 == null) + { + Func 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 list3 = nums6.Where(u003cu003e9_27).ToList(); + Func 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(u003cu003e9_5128)); + IGrouping nums7 = f; + Func u003cu003e9_29 = func15; + if (u003cu003e9_29 == null) + { + Func 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 lancamentos3 = nums7.Where(u003cu003e9_29).ToList(); + Func 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(u003cu003e9_5130)); + IGrouping nums8 = f; + Func u003cu003e9_31 = func16; + if (u003cu003e9_31 == null) + { + Func 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 list4 = nums8.Where(u003cu003e9_31).ToList(); + Func 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(u003cu003e9_5132)); + IGrouping nums9 = f; + Func u003cu003e9_33 = func17; + if (u003cu003e9_33 == null) + { + Func 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 lancamentos4 = nums9.Where(u003cu003e9_33).ToList(); + Func 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(u003cu003e9_5134)); + IGrouping nums10 = f; + Func u003cu003e9_35 = func18; + if (u003cu003e9_35 == null) + { + Func 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 list5 = nums10.Where(u003cu003e9_35).ToList(); + Func 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(u003cu003e9_5136)); + IGrouping nums11 = f; + Func u003cu003e9_37 = func19; + if (u003cu003e9_37 == null) + { + Func 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 lancamentos5 = nums11.Where(u003cu003e9_37).ToList(); + Func 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(u003cu003e9_5138)); + IGrouping nums12 = f; + Func 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(u003cu003e9_5139)); + IGrouping nums13 = f; + Func 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 lancamentos6 = nums13.Where(u003cu003e9_5140); + Func 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(u003cu003e9_5141) == decimal.Zero) + { + zero = decimal.Zero; + } + else + { + IGrouping nums14 = f; + Func 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 lancamentos7 = nums14.Where(u003cu003e9_5142); + Func 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(u003cu003e9_5143); + IGrouping nums15 = x; + Func 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 lancamentos8 = nums15.Where(u003cu003e9_5144); + Func 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(u003cu003e9_5145)) * new decimal(100); + } + dadosFechamentoAnalitico.set_PercentualCredito(zero); + IGrouping nums16 = f; + Func 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 lancamentos9 = nums16.Where(u003cu003e9_5146); + Func 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(u003cu003e9_5147) == decimal.Zero) + { + zero1 = decimal.Zero; + } + else + { + IGrouping nums17 = f; + Func 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 lancamentos10 = nums17.Where(u003cu003e9_5148); + Func 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(u003cu003e9_5149); + IGrouping nums18 = x; + Func 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 lancamentos11 = nums18.Where(u003cu003e9_5150); + Func 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(u003cu003e9_5151)) * new decimal(100); + } + dadosFechamentoAnalitico.set_PercentualDebito(zero1); + return dadosFechamentoAnalitico; + }).ToList()); + FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico1 = fechamentoFinanceiroAnalitico; + List dados = fechamentoFinanceiroAnalitico1.get_Dados(); + DadosFechamentoAnalitico dadosFechamentoAnalitico1 = new DadosFechamentoAnalitico(); + dadosFechamentoAnalitico1.set_Nome("TOTAL"); + List dadosFechamentoAnaliticos = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5152)); + List dados1 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5153)); + List dadosFechamentoAnaliticos1 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5154)); + List dados2 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5155)); + List dadosFechamentoAnaliticos2 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5156)); + List dados3 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5157)); + List dadosFechamentoAnaliticos3 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5158)); + List dados4 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5159)); + List dadosFechamentoAnaliticos4 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5160)); + List dados5 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5161)); + List dadosFechamentoAnaliticos5 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5162)); + List dados6 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5163)); + List dadosFechamentoAnaliticos6 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5164)); + List dados7 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(u003cu003e9_5165)); + List dadosFechamentoAnaliticos7 = fechamentoFinanceiroAnalitico1.get_Dados(); + Func 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(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()); + FechamentoFinanceiroAnalitico fechamentoFinanceiroAnalitico3 = fechamentoFinanceiroAnalitico2; + List dadosFechamentoAnaliticos8 = fechamentoFinanceiroAnalitico3.get_Dados(); + DadosFechamentoAnalitico dadosFechamentoAnalitico2 = new DadosFechamentoAnalitico(); + dadosFechamentoAnalitico2.set_Nome("TOTAL"); + List fechamentoAnalitico = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Jan(fechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Jan(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Fev(fechamentoFinanceiroAnaliticos.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Fev(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico1 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Mar(fechamentoAnalitico1.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Mar(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos1 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Abr(fechamentoFinanceiroAnaliticos1.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Abr(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico2 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Mai(fechamentoAnalitico2.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Mai(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos2 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Jun(fechamentoFinanceiroAnaliticos2.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Jun(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico3 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Jul(fechamentoAnalitico3.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Jul(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos3 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Ago(fechamentoFinanceiroAnaliticos3.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Ago(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico4 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Set(fechamentoAnalitico4.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Set(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos4 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Out(fechamentoFinanceiroAnaliticos4.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Out(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico5 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Nov(fechamentoAnalitico5.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Nov(); + } + return new decimal?(new decimal()); + }))); + List fechamentoFinanceiroAnaliticos5 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Dez(fechamentoFinanceiroAnaliticos5.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((DadosFechamentoAnalitico y) => { + if (y.get_Nome() != "TOTAL") + { + return y.get_Dez(); + } + return new decimal?(new decimal()); + }))); + List fechamentoAnalitico6 = this.FechamentoAnalitico; + dadosFechamentoAnalitico2.set_Total(fechamentoAnalitico6.Sum((FechamentoFinanceiroAnalitico x) => x.get_Dados().Sum((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 -- cgit v1.2.3