private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { Models.Configuration configuracion = new Models.Configuration(); using (configuracion) { List <Models.Configuration> config = configuracion.getConfiguration(); Font font = new Font("Verdana", 8, FontStyle.Regular); int y = 70; var format = new StringFormat() { Alignment = StringAlignment.Center }; if (config[0].Logo_ticket != "") { if (File.Exists(config[0].Logo_ticket)) { Image logo = Image.FromFile(config[0].Logo_ticket); e.Graphics.DrawImage(logo, new Rectangle(0, 00, 250, 70)); } } y = y + 10; e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format); y = y + 10; e.Graphics.DrawString(config[0].RFC, font, Brushes.Black, 125, y, format); y = y + 10; string calle = config[0].Calle + " " + config[0].No_ext; if (config[0].No_int != "") { calle += "-" + config[0].No_int; } e.Graphics.DrawString(calle, font, Brushes.Black, 125, y, format); y = y + 10; e.Graphics.DrawString(config[0].Municipio + " " + config[0].Estado, font, Brushes.Black, 125, y, format); y = y + 10; e.Graphics.DrawString("Telefono" + config[0].Telefono, font, Brushes.Black, 125, y, format); y = y + 10; e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format); format = new StringFormat() { Alignment = StringAlignment.Far }; y = y + 10; e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y); y = y + 15; e.Graphics.DrawString("Transferencia: " + txtFolios.Text, font, Brushes.Black, 0, y); /* y = y + 10; * e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y); */ y = y + 20; e.Graphics.DrawString("Cant.", font, Brushes.Black, 50, y, format); e.Graphics.DrawString("P/U.", font, Brushes.Black, 100, y, format); e.Graphics.DrawString("IMPTE.", font, Brushes.Black, 220, y, format); y = y + 10; e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y); foreach (DataGridViewRow row in dtProductos.Rows) { y = y + 30; e.Graphics.DrawString(row.Cells["descripcion"].Value.ToString(), font, Brushes.Black, 10, y); e.Graphics.DrawString(row.Cells["cantidad"].Value.ToString(), font, Brushes.Black, 50, y + 10, format); e.Graphics.DrawString(formato(row.Cells["p_u"].Value.ToString()), font, Brushes.Black, 100, y + 10, format); e.Graphics.DrawString(formato(row.Cells["Importe"].Value.ToString()), font, Brushes.Black, 220, y + 10, format); } y = y + 15; e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y); y = y + 15; e.Graphics.DrawString("Total", font, Brushes.Black, 150, y + 10, format); e.Graphics.DrawString(txtSubtotal.Text, font, Brushes.Black, 220, y + 10, format); y = y + 40; intercambios inter = new intercambios(); e.Graphics.DrawString(inter.enletras(txtSubtotal.Text), font, Brushes.Black, 0, y); y = y + 30; e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y); } }