private void printDocumentVenta_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { int x = 5, y = 5; currentVentaCabecera = VentaNegocio.DevolverVentaCabecera(id_venta); currentVentaDetalle = VentaNegocio.DevolverVentaDetalle(id_venta); Pen blackPen = new Pen(Color.Black, 3); Font fuenteCabecera = new Font("Arial", 14, FontStyle.Bold); Font fuenteCabecera2 = new Font("Arial", 10, FontStyle.Bold); Font fuenteCabecera3 = new Font("Times New Roman", 8, FontStyle.Bold); Font fuenteDetalle = new Font("Times New Roman", 8, FontStyle.Regular); //MessageBox.Show(e.PageSettings.PaperSize.ToString()); //1100 875 e.Graphics.DrawString("COMPROBANTE DE VENTA", fuenteCabecera, Brushes.DarkBlue, x + 50, y += 10); Image imagen = Properties.Resources.logo1; e.Graphics.DrawImage(imagen, x + 325, y, 50, 30); e.Graphics.DrawString("ACRIVIDRIO'S", fuenteCabecera2, Brushes.Black, x + 103, y += 20); e.Graphics.DrawString("Ruc: 001 340 230 1001", fuenteCabecera2, Brushes.Black, x + 95, y += 20); Barcode codigo = new Barcode(); codigo.IncludeLabel = true; Image miCodigo = codigo.Encode(BarcodeLib.TYPE.CODE128, currentVentaCabecera.Cedula + "-" + currentVentaCabecera.Id, Color.Black, Color.White, 400, 100); e.Graphics.DrawImage(miCodigo, x, y += 30, miCodigo.Width, miCodigo.Height); //Datos cabecera e.Graphics.DrawString("Cedula: " + currentVentaCabecera.Cedula, fuenteDetalle, Brushes.Black, x, y += 100); e.Graphics.DrawString("Cliente: " + currentVentaCabecera.Apellido + " " + currentVentaCabecera.Nombre, fuenteDetalle, Brushes.Black, x, y += 20); e.Graphics.DrawString("Dirección: " + currentVentaCabecera.Direccion, fuenteDetalle, Brushes.Black, x, y += 20); e.Graphics.DrawString("Teléfono: " + currentVentaCabecera.Telefono, fuenteDetalle, Brushes.Black, x, y += 20); e.Graphics.DrawString("Fecha Vemta: " + currentVentaCabecera.FechaVenta, fuenteDetalle, Brushes.Black, x, y += 20); // //Datos detalle e.Graphics.DrawString("Producto", fuenteCabecera3, Brushes.Black, x, y += 40); e.Graphics.DrawString("Precio Unitario", fuenteCabecera3, Brushes.Black, x + 100, y); e.Graphics.DrawString("Cantidad", fuenteCabecera3, Brushes.Black, x + 200, y); e.Graphics.DrawString("Subtotal", fuenteCabecera3, Brushes.Black, x + 300, y); foreach (var item in currentVentaDetalle) { e.Graphics.DrawString(item.Nombre, fuenteDetalle, Brushes.Black, x, y += 20); e.Graphics.DrawString(item.Precio.ToString(), fuenteDetalle, Brushes.Black, x + 100, y); e.Graphics.DrawString(item.Cantidad.ToString(), fuenteDetalle, Brushes.Black, x + 200, y); e.Graphics.DrawString((item.Precio_Total).ToString(), fuenteDetalle, Brushes.Black, x + 300, y); } e.Graphics.DrawString("Subtotal".ToString(), fuenteDetalle, Brushes.Black, x + 200, y += 20); double subtotal = (currentVentaCabecera.Total - currentVentaCabecera.Ganancia) / 1.12; e.Graphics.DrawString(subtotal.ToString(), fuenteDetalle, Brushes.Black, x + 300, y); e.Graphics.DrawString("Iva".ToString(), fuenteDetalle, Brushes.Black, x + 200, y += 20); e.Graphics.DrawString((currentVentaCabecera.Total - currentVentaCabecera.Ganancia - subtotal).ToString(), fuenteDetalle, Brushes.Black, x + 300, y); e.Graphics.DrawString("Mano de obra".ToString(), fuenteDetalle, Brushes.Black, x + 200, y += 20); e.Graphics.DrawString(currentVentaCabecera.Ganancia.ToString(), fuenteDetalle, Brushes.Black, x + 300, y); e.Graphics.DrawString("Total".ToString(), fuenteDetalle, Brushes.Black, x + 200, y += 20); e.Graphics.DrawString(currentVentaCabecera.Total.ToString(), fuenteDetalle, Brushes.Black, x + 300, y); Rectangle rectangle = new Rectangle(0, 0, 400, y + 40); e.Graphics.DrawRectangle(blackPen, rectangle); }