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)); }
public JsonResult RecuperarPresencasPorCliente(int codigoCliente) { List <DadosPresencaDto> presencas = _agendaService .List() .Where(x => x.CodigoCliente == codigoCliente) .Select(y => new DadosPresencaDto() { CodigoCliente = y.CodigoCliente, CodigoEspecialidade = y.CodigoEspecialidade, CodigoProfissional = y.CodigoProfissional, CodSituacaoPresenca = (Int32)y.SituacaoPresenca, DataFimEvento = y.DataFim, DataInicioEvento = y.DataInicio, DescricaoEspecialidade = y.Especialidade.Descricao, IdAgenda = y.Id, Justificativa = y.ObservacaoPresenca, NomeCliente = y.Cliente.Nome, NomeProfissional = y.Profissional.Nome, SituacaoPresenca = FuncoesGerais.GetEnumDescription(y.SituacaoPresenca) }).ToList(); return(Json(presencas, JsonRequestBehavior.AllowGet)); }
public JsonResult RecuperarDadosRecebimentoCliente(int codigoCliente) { var recebimentos = _clienteService.GetById(codigoCliente) .Recebimentos .Select(x => new RecebimentoClienteDto { IdRecebimento = x.Id, CodigoCliente = x.CodigoCliente, CodigoServico = x.CodigoServico, DataAquisicao = x.DataAquisicao, DataPagamento = x.DataPagamento, DataVencimento = x.DataVencimento, DescricaoServico = x.Servico.Descricao, SituacaoPagamento = FuncoesGerais.GetEnumDescription(x.SituacaoPagamento), TipoPagamento = FuncoesGerais.GetEnumDescription(x.TipoPagamento), UsuarioRecebimento = x.UsuarioRecebimento, ValorDevido = x.ValorDevido, ValorRecebido = x.ValorRecebido }) .OrderByDescending(y => y.DataVencimento) .ToList(); return(Json(recebimentos, JsonRequestBehavior.AllowGet)); }
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); }
public string GerarHistoricoCliente(int codigoCliente) { string dirArquivo = Server.MapPath("~/Relatorios"); string nomeArquivo = "RelHistoricoCliente_" + DateTime.Now.ToString("ddMMyyyyhhmss"); string caminhoCompleto = dirArquivo + "\\" + nomeArquivo + ".pdf"; 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); Document doc = InicializarDocumento(caminhoCompleto); doc.Open(); doc = EscreverCabeçalho(doc); Cliente dadosCliente = _clienteService.GetById(codigoCliente); // Informações do Cliente Paragraph paragrafo = new Paragraph(); paragrafo.Alignment = Element.ALIGN_CENTER; paragrafo.Add(new Phrase("HISTÓRICO DO CLIENTE\n", tituloFont)); paragrafo.Add("\n"); paragrafo.Add("\n"); doc.Add(paragrafo); paragrafo = new Paragraph(); paragrafo.Alignment = Element.ALIGN_LEFT; paragrafo.Add(new Phrase("DADOS PESSOAIS \n", boldTextFont)); paragrafo.Add("\n"); doc.Add(paragrafo); paragrafo = new Paragraph(); paragrafo.Add(new Phrase("Cliente: ", boldFont)); paragrafo.Add(new Phrase(dadosCliente.Nome, normalFont)); paragrafo.Add("\n"); if (dadosCliente.DataNascimento != null) { paragrafo.Add(new Phrase("Aniversário: ", boldFont)); paragrafo.Add(new Phrase(dadosCliente.DataNascimento.Value.ToString("dd/MM"), normalFont)); paragrafo.Add("\n"); } if (dadosCliente.Endereco != null) { paragrafo.Add(new Phrase("Endereço: ", boldFont)); paragrafo.Add(new Phrase(dadosCliente.Endereco + ", " + dadosCliente.Bairro, normalFont)); paragrafo.Add("\n"); } if (dadosCliente.Cidade != null) { paragrafo.Add(new Phrase("Cidade: ", boldFont)); paragrafo.Add(new Phrase(dadosCliente.Cidade + "/" + dadosCliente.Uf.ToUpper(), normalFont)); paragrafo.Add("\n"); } paragrafo.Add(new Phrase("Telefone: ", boldFont)); paragrafo.Add(new Phrase((dadosCliente.TelefoneFixo != null ? dadosCliente.TelefoneFixo + "/" : "") + (dadosCliente.TelefoneCelular ?? ""), normalFont)); paragrafo.Add("\n"); paragrafo.Add(new Phrase("Email: ", boldFont)); paragrafo.Add(new Phrase((dadosCliente.Email ?? "-"), normalFont)); paragrafo.Add("\n"); doc.Add(paragrafo); paragrafo = new Paragraph(); paragrafo.Add("\n"); paragrafo.Alignment = Element.ALIGN_LEFT; paragrafo.Add(new Phrase("CONSULTAS REALIZADAS \n", boldTextFont)); paragrafo.Add("\n"); doc.Add(paragrafo); PdfPCell pcell = new PdfPCell(); PdfPTable table = new PdfPTable(4); table.DefaultCell.Border = Rectangle.BOTTOM_BORDER; table.WidthPercentage = 100; float[] widths = new float[] { 15, 55, 20, 20 }; table.SetWidths(widths); pcell = new PdfPCell(); pcell = new PdfPCell(new Phrase("Data", 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("Serviço", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_LEFT; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); pcell = new PdfPCell(new Phrase("Profissional", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_LEFT; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); pcell = new PdfPCell(new Phrase("Presença", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_LEFT; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); foreach (var item in dadosCliente.Compromissos.OrderBy(x => x.DataInicio).OrderBy(y => y.DataInicio).ToList()) { pcell = new PdfPCell(new Phrase(item.DataInicio.ToString("dd/MM/yyyy"), normalFont)); 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.Servico == null ? "" : item.Servico.Descricao, normalFont)); 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.Profissional.Nome, normalFont)); 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(FuncoesGerais.GetEnumDescription(item.SituacaoPresenca), normalFont)); pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; pcell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.LIGHT_GRAY; table.AddCell(pcell); } doc.Add(table); paragrafo = new Paragraph(); paragrafo.Add("\n"); paragrafo.Alignment = Element.ALIGN_LEFT; paragrafo.Add(new Phrase("PAGAMENTOS REALIZADOS \n", boldTextFont)); paragrafo.Add("\n"); doc.Add(paragrafo); table = new PdfPTable(4); table.DefaultCell.Border = Rectangle.BOTTOM_BORDER; table.WidthPercentage = 100; widths = new float[] { 15, 55, 20, 20 }; table.SetWidths(widths); pcell = new PdfPCell(); pcell = new PdfPCell(new Phrase("Data", 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("Serviço", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_LEFT; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); pcell = new PdfPCell(new Phrase("Profissional", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_LEFT; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); pcell = new PdfPCell(new Phrase("Vlr Pago", boldFont)); pcell.HorizontalAlignment = Element.ALIGN_CENTER; pcell.VerticalAlignment = Element.ALIGN_MIDDLE; pcell.Border = PdfPCell.BOTTOM_BORDER; pcell.BorderColor = BaseColor.GRAY; table.AddCell(pcell); foreach (var item in dadosCliente.Recebimentos.Where(x => x.SituacaoPagamento.Equals(SituacaoPagamento.Recebido)).OrderBy(x => x.DataPagamento).OrderBy(y => y.DataPagamento).ToList()) { pcell = new PdfPCell(new Phrase(item.DataPagamento.Value.ToString("dd/MM/yyyy"), normalFont)); 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.Servico == null ? "" : item.Servico.Descricao, normalFont)); 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.Profissional.Nome, normalFont)); 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(), normalFont)); 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); doc.Close(); return(nomeArquivo); }
/// <summary> /// Obtem o conteúdo do atributo "Description" do item da enum. Ver também Trans.<seealso cref="Trans.GetEnumDescription"/> /// </summary> /// <param name="element">Elemento da Enum a verificar</param> public static string GetDescription(this Enum element) { return(FuncoesGerais.GetEnumDescription(element)); }