public Document relatorioSangria(bool tipo = false, Document doc = null, Paragraph informacao = null, Paragraph titulo = null) { selecionado = 5; string caminho = ""; DadosTableAdapters.Observacoes_SangriaTableAdapter sangria = new DadosTableAdapters.Observacoes_SangriaTableAdapter(); if (tipo) { Document docLimpo = new Document(PageSize.A4); //colocando margens no pdf docLimpo.SetMargins(40, 40, 40, 80); doc = docLimpo; string aux = deData.ToString("dd-MM-yyyy") + " - " + ateData.ToString("dd-MM-yyyy"); caminho = @"C:\pdv\relatorios\sangria-" + aux.ToString() + ".pdf"; PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(caminho, FileMode.Create)); doc.Open(); Paragraph tituloLimpo = new Paragraph(); titulo = tituloLimpo; titulo.Font = FontFactory.GetFont("Arial", 18); titulo.Alignment = Element.ALIGN_CENTER; titulo.Add("Sangria " + deData.ToString("dd/MM/yyyy") + " - " + ateData.ToString("dd/MM/yyyy") + " \n\n"); doc.Add(titulo); Paragraph informacaoLimpo = new Paragraph(); informacao = informacaoLimpo; informacao.Font = FontFactory.GetFont("Arial", 12, BaseColor.BLUE); informacao.Alignment = Element.ALIGN_LEFT; } informacao.Clear(); informacao.Add("\n\n" + ("Sangria") + "\n\n"); doc.Add(informacao); var auxSangria = sangria.retornarSangriaPorData(deData.ToString("dd/MM/yyyy"), ateData.ToString("dd/MM/yyyy")); DadosTableAdapters.FuncionarioTableAdapter funcionario = new DadosTableAdapters.FuncionarioTableAdapter(); if (auxSangria.Count > 0) { informacao.Font = FontFactory.GetFont("Arial", 14, BaseColor.RED); informacao.Clear(); PdfPTable table7 = new PdfPTable(4); table7.AddCell("Data da Sangria"); table7.AddCell("Colaborador"); table7.AddCell("Observações"); table7.AddCell("Valor da sangria"); for (int i = 0; i < auxSangria.Count; i++) { table7.AddCell(Convert.ToDateTime(auxSangria[i]["dataSangria"]).ToString("dd/MM/yyyy") + " " + auxSangria[i]["horaSangria"].ToString().Substring(0, 5)); var auxFunc = funcionario.retornarColaboradorPorId(Convert.ToInt32(auxSangria[i]["idColaborador"])); table7.AddCell(auxFunc[0]["nomeFunc"].ToString()); table7.AddCell(auxSangria[i]["observacoes"].ToString()); table7.AddCell("R$" + Convert.ToDouble(auxSangria[i]["valorSangria"]).ToString("F2")); //var desconto = pagamento.retornarDescPorIdVenda(Convert.ToInt32(vendasCanceladas[i]["idVenda"])); //table7.AddCell("R$" + Convert.ToDouble(Convert.ToDouble(vendasCanceladas[i]["valorDaVenda"]))); } doc.Add(table7); } if (tipo) { doc.Close(); abrirPdf(caminho); //MessageBox.Show("Relatório gerado com sucesso!"); } return(doc); }