Anda di halaman 1dari 3

void Reportar()

{
Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10);
try
{
PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Res
ponse.OutputStream);
//Open PDF Document to write data
pdfDoc.Open();
iTextSharp.text.Font _standardFont = new iTextSharp.text.Font(iT
extSharp.text.Font.FontFamily.HELVETICA, 8, iTextSharp.text.Font.NORMAL, BaseCol
or.BLACK);
pdfDoc.Add(new Paragraph("Orden Aprobada"));
pdfDoc.Add(Chunk.NEWLINE);
string cadenaFinal = "";
PdfPTable tblPrueba = new PdfPTable(2);
PdfPCell cl1 = new PdfPCell(new Phrase("", _standardFont));
PdfPCell cl2 = new PdfPCell(new Phrase("", _standardFont));

tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("ID_Venta", _standardFont));
cl2 = new PdfPCell(new Phrase( TextBox1.Text , _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Nit del Cliente", _standardFont))
;
cl2 = new PdfPCell(new Phrase(nitdelcliente(Convert.ToInt32(Text
Box1.Text)), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Nombre", _standardFont));
cl2 = new PdfPCell(new Phrase(nombrecliente(nitdelcliente(Conver
t.ToInt32(TextBox1.Text))), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Domicilio", _standardFont));
cl2 = new PdfPCell(new Phrase(dircliente(nitdelcliente(Convert.T
oInt32(TextBox1.Text))), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("nit del Vendedor", _standardFont)
);
cl2 = new PdfPCell(new Phrase(nitvendedor(), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);

cl1 = new PdfPCell(new Phrase("nit del Vendedor", _standardFont)


);
cl2 = new PdfPCell(new Phrase(nitvendedor(), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Le Atendi ", _standardFont));
cl2 = new PdfPCell(new Phrase(nombre, _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Puesto del Vendedor ", _standardF
ont));
cl2 = new PdfPCell(new Phrase("Administrador", _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Monto a Pagar ", _standardFont));
cl2 = new PdfPCell(new Phrase(monto(Convert.ToInt32(TextBox1.Tex
t)), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Fecha aprobacin : ", _standardFont
));
cl2 = new PdfPCell(new Phrase(System.DateTime.Today.ToString() ,
_standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Aprobada por : ", _standardFont)
);
cl2 = new PdfPCell(new Phrase(nombre, _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Cargo ", _standardFont));
cl2 = new PdfPCell(new Phrase("Administrador", _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);
cl1 = new PdfPCell(new Phrase("Detalle ", _standardFont));
cl2 = new PdfPCell(new Phrase( detalle(Convert.ToInt32(TextBox1.
Text)), _standardFont));
tblPrueba.AddCell(cl1);
tblPrueba.AddCell(cl2);

pdfDoc.Add(tblPrueba);
//Close your PDF
pdfDoc.Close();
Response.ContentType = "application/pdf";

//Set default file Name as current datetime


Response.AddHeader("content-disposition", "attachment; filename=
Recibo.pdf");
System.Web.HttpContext.Current.Response.Write(pdfDoc);
Response.Flush();
Response.End();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}

Anda mungkin juga menyukai