How can I print my complete invoice in c #?

0

I have a software made in c #, for the impressions but when I print I printed a piece of the invoice, Invoice must be the printed points of sales as the Star SP500 printer. This is the code I use for printing.

private void DocumentoFactura_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            int y = 0;
            //Titulo
            e.Graphics.DrawString("Sistema Xenesis", new Font("Arial", 20, FontStyle.Regular), Brushes.Black, 300, 5);
            e.Graphics.DrawString(empresa.Nombre, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 300, 20);
            e.Graphics.DrawString(empresa.Direccion, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 300, 35);
            e.Graphics.DrawString("Tel: " + empresa.Telefono1 + "/ " + empresa.Telefono2, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 300, 35);
            //Datos
            e.Graphics.DrawString("Cliente: "+ Actualcliente.PrimerNombre, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 50);
            e.Graphics.DrawString("Codigo Cliente: " + Actualcliente.Codigo, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 70);
            e.Graphics.DrawString("Codigo De Compra: " + CodigoCompra, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 90);
            e.Graphics.DrawString("Fecha: " + Fecha, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 110);
            e.Graphics.DrawString("Sucursal: "+empresa.Sucursal , new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 130);
            e.Graphics.DrawString("RNC: " + empresa.RNC, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, 100, 150);


            //Rayas
            e.Graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(90, 145), new Point(755, 145));
            e.Graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(90, 175), new Point(755, 175));
            e.Graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(90, 1110), new Point(755, 1110));
            e.Graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(90, 1140), new Point(755, 1140));
            //Compras
            e.Graphics.DrawString("CANT.", new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 100, 150);
            e.Graphics.DrawString("DESCRIPCION", new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 180, 150);
            e.Graphics.DrawString("DESCUENTO", new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 380, 150);
            e.Graphics.DrawString("PRECIO UNIT.", new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 580, 150);

            for (int i = 0; i < dgbProductos.Rows.Count; i++)
            {
                y = 178 + (20 * i + 1);
                e.Graphics.DrawString(dgbProductos.Rows[i].Cells["Cantidad"].Value.ToString(), new Font("Arial", 10, FontStyle.Regular), Brushes.Black, 110, y);
                e.Graphics.DrawString(dgbProductos.Rows[i].Cells["Producto"].Value.ToString(), new Font("Arial", 10, FontStyle.Regular), Brushes.Black, 180, y);
                e.Graphics.DrawString(dgbProductos.Rows[i].Cells["cDescuento"].Value.ToString(), new Font("Arial", 10, FontStyle.Regular), Brushes.Black, 380, y); 
                e.Graphics.DrawString(dgbProductos.Rows[i].Cells["Precio"].Value.ToString(), new Font("Arial", 10, FontStyle.Regular), Brushes.Black, 580, y);

            }

            e.Graphics.DrawString("Total: "+Dinero, new Font("Arial", 11, FontStyle.Bold), Brushes.Black, 535, y + 20);
            e.Graphics.DrawString("Dinero: " + txtdinero.Text.ToString(), new Font("Arial", 11, FontStyle.Bold), Brushes.Black, 523, y + 35);
            e.Graphics.DrawString("Devuelta: " + string.Format("{0}", int.Parse(txtdinero.Text.ToString()) - Dinero), new Font("Arial", 11, FontStyle.Bold), Brushes.Black, 507, y + 50);
            e.Graphics.DrawString("GRACIAS POR SU COMPRA", new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 300, 1115);
    
asked by Diogenes Monegro 30.07.2018 в 18:53
source

0 answers