/// <summary> /// Obtém movimentações da conta / caixa no período especificado /// </summary> private void ObterMovimentacaoPeriodo() { DateTime dataInicial = dateTimePickerInicial.Value.Date; DateTime dataFinal = dateTimePickerFinal.Value.Date; dataFinal = dataFinal.AddMinutes(24 * 60); int codContaBanco = (int)codContaBancoComboBox.SelectedValue; IEnumerable <TotaisMovimentacaoConta> totaisMovimentacaoConta = GerenciadorMovimentacaoConta.GetInstance(null).ObterTotalMovimentacaoContaPeriodo(codContaBanco, dataInicial, dataFinal); totaisMovimentacaoContaBindingSource.DataSource = totaisMovimentacaoConta; textTotalMovimentacao.Text = totaisMovimentacaoConta.Sum(t => t.TotalMovimentacaoConta).ToString("N2"); IEnumerable <TotalPagamentoSaida> totaisSaida = GerenciadorSaidaPagamento.GetInstance(null).ObterTotalPagamentoSaida(dataInicial, dataFinal); TotalPagamentoSaida totalPagamentoSaidaDinheiro = totaisSaida.Where(t => t.CodFormaPagamentos.Equals(FormaPagamento.DINHEIRO)).FirstOrDefault(); if (totalPagamentoSaidaDinheiro != null) { decimal trocoPorPeriodo = GerenciadorSaida.GetInstance(null).ObterTrocoPorPeriodo(dataInicial, dataFinal); totalPagamentoSaidaDinheiro.TotalPagamento -= trocoPorPeriodo; } totaisSaidaBindingSource.DataSource = totaisSaida; textTotalVendas.Text = totaisSaida.Sum(t => t.TotalPagamento).ToString("N2"); IEnumerable <VendasCartao> vendasCartao = GerenciadorSaidaPagamento.GetInstance(null).ObterVendasCartao(dataInicial, dataFinal); VendasCartaoBindingSource.DataSource = vendasCartao; textTotalCartao.Text = vendasCartao.Sum(t => t.TotalCartao).ToString("N2"); }
/// <summary> /// Obtém movimentações da conta / caixa no período especificado /// </summary> private void ObterMovimentacaoPeriodo() { DateTime dataInicial = dateTimePickerInicial.Value.Date; DateTime dataFinal = dateTimePickerFinal.Value.Date; dataFinal = dataFinal.AddDays(1).AddSeconds(-1); int codContaBanco = (int)codContaBancoComboBox.SelectedValue; IEnumerable <TotaisMovimentacaoConta> totaisMovimentacaoConta = GerenciadorMovimentacaoConta.GetInstance(null).ObterTotalMovimentacaoContaPeriodo(codContaBanco, dataInicial, dataFinal); totaisMovimentacaoContaBindingSource.DataSource = totaisMovimentacaoConta; textTotalMovimentacao.Text = totaisMovimentacaoConta.Sum(t => t.TotalMovimentacaoConta).ToString("N2"); IEnumerable <TotalPagamentoSaida> totaisSaida = GerenciadorSaidaPagamento.GetInstance(null).ObterTotalPagamentoSaida(dataInicial, dataFinal); TotalPagamentoSaida totalPagamentoSaidaDinheiro = totaisSaida.Where(t => t.CodFormaPagamentos.Equals(FormaPagamento.DINHEIRO)).FirstOrDefault(); if (totalPagamentoSaidaDinheiro != null) { decimal trocoPorPeriodo = GerenciadorSaida.GetInstance(null).ObterTrocoPorPeriodo(dataInicial, dataFinal); totalPagamentoSaidaDinheiro.TotalPagamento -= trocoPorPeriodo; } totaisSaidaBindingSource.DataSource = totaisSaida; textTotalVendas.Text = totaisSaida.Sum(t => t.TotalPagamento).ToString("N2"); IEnumerable <VendasCartao> vendasCartao = GerenciadorSaidaPagamento.GetInstance(null).ObterVendasCartao(dataInicial, dataFinal); IEnumerable <VendasCartao> redeCredito = vendasCartao.Where(vendas => vendas.CodCartao != BANESECARD_CREDITO && vendas.TipoCartao != "DEBITO"); IEnumerable <VendasCartao> redeDebito = vendasCartao.Where(vendas => vendas.TipoCartao == "DEBITO"); IEnumerable <VendasCartao> baneseCredito = vendasCartao.Where(vendas => vendas.CodCartao == BANESECARD_CREDITO); vendasCartaoRede.DataSource = RemoverDuplicados(redeCredito.Union(redeDebito)); vendasCartaoBaneseCredito.DataSource = RemoverDuplicados(baneseCredito); totalCreditoRede.Text = redeCredito.Sum(t => t.TotalCartao).ToString("N2"); totalDebitoRede.Text = redeDebito.Sum(t => t.TotalCartao).ToString("N2"); totalRede.Text = (redeCredito.Sum(t => t.TotalCartao) + redeDebito.Sum(t => t.TotalCartao)).ToString("N2"); totalCreditoBanese.Text = baneseCredito.Sum(t => t.TotalCartao).ToString("N2"); }