Esempio n. 1
0
        public override void UpdateBag()
        {
            base.UpdateBag();

            ViewBag.QtdeClientesAtivos = _clienteService.List().Count().ToString();
            ViewBag.QtdeConsultasHoje  = _agendaService.List().Where(x => x.DataInicio.Date.Equals(DateTime.Now.Date)).Count().ToString();
            ViewBag.VlrReceberHoje     = _recebimentoService.List().Where(x => x.DataVencimento.Date.Equals(DateTime.Now.Date)).Sum(y => y.ValorDevido).ToString();

            ViewBag.ListaAgendaHoje      = _agendaService.List().Where(x => x.DataInicio.Date.Equals(DateTime.Now.Date) && x.SituacaoPresenca.Equals(SituacaoPresenca.Pendente)).ToList();
            ViewBag.ListaRecebimentoHoje = _recebimentoService.List().Where(x => x.DataVencimento.Date.Equals(DateTime.Now.Date) && x.SituacaoPagamento.Equals(SituacaoPagamento.Pendente)).ToList();

            ViewBag.ListaClientes = _clienteService.List().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text  = x.Nome
            });

            ViewBag.ListaEspecialidades = _especialidadeService.List().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text  = x.Descricao
            });

            ViewBag.ListaServicos = _servicoService.List().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text  = x.Descricao
            });

            ViewBag.ListaProfissionais = _profissionalService.List().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text  = x.Nome
            });
        }
Esempio n. 2
0
        public JsonResult RecuperarDadosRecebimento(int codigoRecebimento)
        {
            var recebimento = _recebimentoService
                              .List()
                              .Where(y => y.Id.Equals(codigoRecebimento))
                              .Select(x => new RecebimentoClienteDto
            {
                IdRecebimento       = x.Id,
                CodigoCliente       = x.CodigoCliente,
                CodigoServico       = x.CodigoServico,
                CodigoEspecialidade = x.CodigoEspecialidade,
                CodigoProfissional  = x.CodigoProfissional,
                DataAquisicao       = x.DataAquisicao,
                DataPagamento       = x.DataPagamento,
                DataVencimento      = x.DataVencimento,
                DescricaoServico    = x.Servico.Descricao,
                SituacaoPagamento   = FuncoesGerais.GetEnumDescription(x.SituacaoPagamento),
                TipoPagamento       = FuncoesGerais.GetEnumDescription(x.TipoPagamento),
                CodTipoPagamento    = Convert.ToInt32(x.TipoPagamento),
                UsuarioRecebimento  = x.UsuarioRecebimento,
                ValorDevido         = x.ValorDevido,
                ValorRecebido       = x.ValorRecebido
            })
                              .FirstOrDefault();

            return(Json(recebimento, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public List <EventosDto> RecuperarEventos()
        {
            var dadosClinica = _clinicaService.List().FirstOrDefault();

            string corEventoAniversariantes = dadosClinica.CorEventoAniversariantes;
            string corEventoRecebimentos    = dadosClinica.CorEventoRecebimentos;

            List <EventosDto> eventos = new List <EventosDto>();

            eventos.AddRange(_agendaService.List().Where(y => !y.SituacaoPresenca.Equals(SituacaoPresenca.Falta)).Select(x => new EventosDto
            {
                Title           = _clienteService.GetById(x.CodigoCliente).Nome + "(" + _especialidadeService.GetById(x.CodigoEspecialidade).Descricao + ")",
                Start           = x.DataInicio.ToString("yyyy-MM-dd HH:mm"),
                End             = x.DataFim.ToString("yyyy-MM-dd HH:mm"),
                Id              = x.Id,
                BackgroundColor = _especialidadeService.GetById(x.CodigoEspecialidade).CorEvento,
                TipoEvento      = 0
            }).ToList());

            eventos.AddRange(_clienteService.List().Select(x => new EventosDto
            {
                Title           = x.Nome,
                Start           = x.DataNascimento.Value.ToString(DateTime.Now.Year + "-MM-dd HH:mm"),
                AllDay          = true,
                BackgroundColor = corEventoAniversariantes == null ? "#ffee05" : corEventoAniversariantes,
                Icone           = "birthday-cake",
                TipoEvento      = 1,
                CodigoCliente   = x.Id
            }).ToList());

            eventos.AddRange(_recebimentoService.List().Where(y => y.SituacaoPagamento.Equals(SituacaoPagamento.Pendente)).Select(x => new EventosDto
            {
                Title             = _clienteService.GetById(x.CodigoCliente).Nome + "( R$ " + x.ValorDevido + ")",
                Start             = x.DataVencimento.ToString("yyyy-MM-dd HH:mm"),
                AllDay            = true,
                BackgroundColor   = corEventoRecebimentos == null ? "#40c42f" : corEventoRecebimentos,
                Icone             = "dollar-sign",
                TipoEvento        = 2,
                CodigoRecebimento = x.Id
            }).ToList());

            eventos.AddRange(_despesaService.List().Select(x => new EventosDto
            {
                Title           = x.Descricao + "( R$ " + x.ValorDespesa + ")",
                Start           = x.DataVencimento.ToString("yyyy-MM-dd HH:mm"),
                AllDay          = true,
                BackgroundColor = "#cd5c5c",
                Icone           = "dollar-sign",
                TipoEvento      = 3,
                CodigoDespesa   = x.Id
            }).ToList());

            return(eventos);
        }
Esempio n. 4
0
        public string GerarFechamentoFinanceiro(DateTime dtInicio, DateTime dtFim)
        {
            PdfPTable tabela = new PdfPTable(3);

            var normalFont   = FontFactory.GetFont(FontFactory.HELVETICA, 11, BaseColor.GRAY);
            var detailsFont  = FontFactory.GetFont(FontFactory.HELVETICA, 9, BaseColor.GRAY);
            var cellFont     = FontFactory.GetFont(FontFactory.HELVETICA, 10, BaseColor.GRAY);
            var boldFont     = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 11, BaseColor.GRAY);
            var boldTextFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 11, BaseColor.MAGENTA);
            var tituloFont   = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 14, BaseColor.MAGENTA);

            string dirArquivo      = Server.MapPath("~/Relatorios");
            string nomeArquivo     = "RelFechamentoFinanceiro_" + DateTime.Now.ToString("ddMMyyyyhhmss");
            string caminhoCompleto = dirArquivo + "\\" + nomeArquivo + ".pdf";

            Document doc = InicializarDocumento(caminhoCompleto);

            doc.Open();

            doc = EscreverCabeçalho(doc);

            Paragraph paragrafo = new Paragraph();

            paragrafo.Alignment = Element.ALIGN_CENTER;
            paragrafo.Add(new Phrase("FECHAMENTO FINANCEIRO\n", tituloFont));
            paragrafo.Add(new Phrase(dtInicio.ToString("dd/MM/yyyy") + " a " + dtFim.ToString("dd/MM/yyyy"), boldFont));
            paragrafo.Add("\n");
            paragrafo.Add("\n");
            doc.Add(paragrafo);

            PdfPTable table = new PdfPTable(4);
            PdfPCell  pcell = new PdfPCell();

            float[]   widths = new float[] { 20, 20, 50, 20 };
            Paragraph lineP  = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.LIGHT_GRAY, Element.ALIGN_LEFT, 1)));

            var recebimentos = _recebimento.List().Where(x => x.DataPagamento >= dtInicio && x.DataPagamento <= dtFim).ToList();

            foreach (var tipoPagto in Enum.GetValues(typeof(TipoPagamento)))
            {
                TipoPagamento tipoPagamentoEnum = (TipoPagamento)tipoPagto;

                var recebimentoPorPagamento = recebimentos.Where(y => y.TipoPagamento.Equals(tipoPagto)).OrderBy(x => x.DataPagamento).ToList();

                if (recebimentoPorPagamento.Count > 0)
                {
                    paragrafo = new Paragraph();

                    paragrafo.Alignment = Element.ALIGN_LEFT;
                    paragrafo.Add(new Phrase("FORMA DE PAGAMENTO: " + FuncoesGerais.GetEnumDescription(tipoPagamentoEnum) + "\n \n", boldTextFont));
                    doc.Add(paragrafo);

                    table = new PdfPTable(4);
                    table.DefaultCell.Border  = Rectangle.BOTTOM_BORDER;
                    table.WidthPercentage     = 100;
                    table.HorizontalAlignment = Element.ALIGN_MIDDLE;
                    table.SetWidths(widths);

                    pcell = new PdfPCell();

                    pcell = new PdfPCell(new Phrase("Dt Pagamento", boldFont));
                    pcell.HorizontalAlignment = Element.ALIGN_CENTER;
                    pcell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                    pcell.Border      = PdfPCell.BOTTOM_BORDER;
                    pcell.BorderColor = BaseColor.GRAY;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("Dt Vencimento", boldFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                    pcell.Border      = PdfPCell.BOTTOM_BORDER;
                    pcell.BorderColor = BaseColor.GRAY;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("Descrição", boldFont));
                    pcell.HorizontalAlignment = Element.ALIGN_CENTER;
                    pcell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                    pcell.Border      = PdfPCell.BOTTOM_BORDER;
                    pcell.BorderColor = BaseColor.GRAY;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("Valor Recebido", boldFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                    pcell.Border      = PdfPCell.BOTTOM_BORDER;
                    pcell.BorderColor = BaseColor.GRAY;
                    table.AddCell(pcell);

                    foreach (var item in recebimentoPorPagamento)
                    {
                        pcell = new PdfPCell(new Phrase(item.DataPagamento.Value.ToString("dd/MM/yyyy"), cellFont));
                        pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                        pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                        pcell.Border      = PdfPCell.BOTTOM_BORDER;
                        pcell.BorderColor = BaseColor.LIGHT_GRAY;
                        table.AddCell(pcell);

                        pcell = new PdfPCell(new Phrase(item.DataVencimento.ToString("dd/MM/yyyy"), cellFont));
                        pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                        pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                        pcell.Border      = PdfPCell.BOTTOM_BORDER;
                        pcell.BorderColor = BaseColor.LIGHT_GRAY;
                        table.AddCell(pcell);

                        pcell = new PdfPCell();
                        pcell.AddElement(new Phrase("Serviço: " + item.Servico.Descricao, cellFont));
                        pcell.AddElement(new Phrase(new Phrase("Cliente: " + item.Cliente.Nome, cellFont)));
                        pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                        pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                        pcell.Border      = PdfPCell.BOTTOM_BORDER;
                        pcell.BorderColor = BaseColor.LIGHT_GRAY;
                        table.AddCell(pcell);

                        pcell = new PdfPCell(new Phrase("R$ " + item.ValorRecebido.ToString(), cellFont));
                        pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                        pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                        pcell.Border      = PdfPCell.BOTTOM_BORDER;
                        pcell.BorderColor = BaseColor.LIGHT_GRAY;
                        table.AddCell(pcell);
                    }

                    pcell = new PdfPCell(new Phrase("", normalFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                    pcell.Border            = PdfPCell.NO_BORDER;
                    pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("Total", boldFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                    pcell.Border            = PdfPCell.NO_BORDER;
                    pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("", normalFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                    pcell.Border            = PdfPCell.NO_BORDER;
                    pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
                    table.AddCell(pcell);

                    pcell = new PdfPCell(new Phrase("R$ " + recebimentoPorPagamento.Sum(x => x.ValorRecebido).ToString(), boldFont));
                    pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                    pcell.Border = PdfPCell.NO_BORDER;
                    table.AddCell(pcell);

                    doc.Add(table);

                    paragrafo = new Paragraph();
                    paragrafo.Add("\n");
                    paragrafo.Add("\n");
                    doc.Add(paragrafo);
                }
            }

            paragrafo = new Paragraph();
            paragrafo.Add("\n");
            paragrafo.Alignment = Element.ALIGN_LEFT;
            paragrafo.Add(new Phrase("DESPESAS \n", boldTextFont));
            paragrafo.Add("\n");
            doc.Add(paragrafo);

            table  = new PdfPTable(4);
            pcell  = new PdfPCell();
            widths = new float[] { 20, 50, 20, 20 };
            lineP  = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.LIGHT_GRAY, Element.ALIGN_LEFT, 1)));
            table.SetWidths(widths);
            table.WidthPercentage = 100;

            var despesas = _despesaService.List().Where(x => x.DataPagamento >= dtInicio && x.DataPagamento <= dtFim && x.Situacao.Equals(SituacaoDespesa.Liquidado)).ToList();

            pcell = new PdfPCell();

            pcell = new PdfPCell(new Phrase("Dt Vencimento", boldFont));
            pcell.HorizontalAlignment = Element.ALIGN_CENTER;
            pcell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pcell.Border      = PdfPCell.BOTTOM_BORDER;
            pcell.BorderColor = BaseColor.GRAY;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("Descrição", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
            pcell.Border      = PdfPCell.BOTTOM_BORDER;
            pcell.BorderColor = BaseColor.GRAY;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("Dt Pagamento", boldFont));
            pcell.HorizontalAlignment = Element.ALIGN_CENTER;
            pcell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pcell.Border      = PdfPCell.BOTTOM_BORDER;
            pcell.BorderColor = BaseColor.GRAY;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("Valor Pago", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
            pcell.Border      = PdfPCell.BOTTOM_BORDER;
            pcell.BorderColor = BaseColor.GRAY;
            table.AddCell(pcell);

            foreach (var item in despesas)
            {
                pcell = new PdfPCell(new Phrase(item.DataVencimento.ToString("dd/MM/yyyy"), cellFont));
                pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                pcell.Border      = PdfPCell.BOTTOM_BORDER;
                pcell.BorderColor = BaseColor.LIGHT_GRAY;
                table.AddCell(pcell);

                pcell = new PdfPCell();
                pcell.AddElement(new Phrase(item.Descricao, cellFont));
                pcell.AddElement(new Phrase(new Phrase("Fornecedor: " + item.Fornecedor, cellFont)));
                pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                pcell.Border      = PdfPCell.BOTTOM_BORDER;
                pcell.BorderColor = BaseColor.LIGHT_GRAY;
                table.AddCell(pcell);

                pcell = new PdfPCell(new Phrase(item.DataPagamento == null ? "-" : item.DataPagamento.Value.ToString("dd/MM/yyyy"), cellFont));
                pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                pcell.Border      = PdfPCell.BOTTOM_BORDER;
                pcell.BorderColor = BaseColor.LIGHT_GRAY;
                table.AddCell(pcell);

                pcell = new PdfPCell(new Phrase(item.ValorPagamento == null ? "-" : "R$ " + item.ValorPagamento.ToString(), cellFont));
                pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                pcell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
                pcell.Border      = PdfPCell.BOTTOM_BORDER;
                pcell.BorderColor = BaseColor.LIGHT_GRAY;
                table.AddCell(pcell);
            }

            doc.Add(table);

            table  = new PdfPTable(4);
            widths = new float[] { 20, 20, 50, 20 };
            table.WidthPercentage = 100;
            table.SetWidths(widths);

            pcell = new PdfPCell(new Phrase("", normalFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("Total", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("", normalFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("R$ " + despesas.Sum(x => x.ValorPagamento).ToString(), boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            table.AddCell(pcell);

            doc.Add(table);

            widths = new float[] { 30, 40, 20, 20 };

            paragrafo = new Paragraph();
            paragrafo.Add("\n");
            paragrafo.Add("\n");
            doc.Add(paragrafo);

            // TOTAL RECEITA
            table = new PdfPTable(4);
            table.DefaultCell.Border  = Rectangle.BOTTOM_BORDER;
            table.WidthPercentage     = 100;
            table.HorizontalAlignment = Element.ALIGN_MIDDLE;
            table.SetWidths(widths);

            pcell = new PdfPCell(new Phrase("TOTAL RECEITAS (+)", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_CENTER;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("R$ " + recebimentos.Sum(x => x.ValorRecebido).ToString(), boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            table.AddCell(pcell);

            doc.Add(table);

            // TOTAL DESPESA
            table = new PdfPTable(4);
            table.DefaultCell.Border  = Rectangle.BOTTOM_BORDER;
            table.WidthPercentage     = 100;
            table.HorizontalAlignment = Element.ALIGN_MIDDLE;
            table.SetWidths(widths);

            pcell = new PdfPCell(new Phrase("TOTAL DESPESAS (-)", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_CENTER;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell(new Phrase("R$ " + despesas.Sum(x => x.ValorPagamento).ToString(), boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            table.AddCell(pcell);

            doc.Add(table);

            // TOTAL GERAL
            table = new PdfPTable(4);
            table.DefaultCell.Border  = Rectangle.BOTTOM_BORDER;
            table.WidthPercentage     = 100;
            table.HorizontalAlignment = Element.ALIGN_MIDDLE;
            table.SetWidths(widths);

            pcell = new PdfPCell(new Phrase("TOTAL GERAL", boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
            pcell.Border            = PdfPCell.NO_BORDER;
            pcell.VerticalAlignment = PdfPCell.ALIGN_CENTER;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            pcell = new PdfPCell();
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.AddElement(new Phrase("", normalFont));
            pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(pcell);

            decimal totalGeral = recebimentos.Sum(x => x.ValorRecebido).Value - despesas.Sum(x => x.ValorPagamento).Value;

            pcell = new PdfPCell(new Phrase("R$ " + totalGeral.ToString(), boldFont));
            pcell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            pcell.Border = PdfPCell.NO_BORDER;
            table.AddCell(pcell);

            doc.Add(table);

            doc.Close();

            return(nomeArquivo);
        }