diff --git a/Ventas/vender.cs b/Ventas/vender.cs index ad47acf..bfb2a62 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -505,6 +505,8 @@ namespace compabetov2 MessageBox.Show("Venta hecha"); eliminarProductosTocket(); llenarLayout(); + total= 0; + } } @@ -538,6 +540,63 @@ namespace compabetov2 } } + private void ImprimirTicketEnvio() + { + using (PrintDocument documentoImpresion = new PrintDocument()) + { + documentoImpresion.PrintPage += (sender, e) => ImprimirContenidoEnvio(e); + using (PrintDialog printDialog = new PrintDialog()) + { + printDialog.Document = documentoImpresion; + + if (printDialog.ShowDialog() == DialogResult.OK) + { + documentoImpresion.Print(); + } + } + } + } + + + private void ImprimirContenidoEnvio(PrintPageEventArgs e) + { + + string responsable = responsablecb.SelectedItem.ToString(); + // Contenido que deseas imprimir + string contenido = " Mini Súper\n" + + " Compa BETO\n" + + " Saturnino Peña #44\n" + + " Lomas de la Laguna\n" + + " 311 169 2829\n" + + $" Fecha: {DateTime.Now.ToString("dd/MM/yyyy")}\n" + + $" Hora: {DateTime.Now.ToString("hh:mm:ss")}\n" + + $" Atendió:\n " + + $" {responsable}\n" + + $" ENVIO:\n " + + $" EN CAMINO:\n " + + + "Producto | Precio | Cantidad\n" + + "------------------------------------\n"; + + contenido += crearContenidoImprimir(); + + contenido += $"------------------------------------\n" + + $" Total: ${total}\n" + + "------------------------------------\n" + + " Mini Súper\n" + + " Compa BETO\n" + + " ¡Gracias por su compra!"; + + + // Configuración de la fuente y del área de impresión + Font fuente = new Font("Arial", 10); // Ajustar el tamaño de fuente según sea necesario + PointF posicion = new PointF(0, e.MarginBounds.Top); + + // Imprimir el contenido + e.Graphics.DrawString(contenido, fuente, Brushes.Black, posicion); + } + + private void ImprimirContenido(PrintPageEventArgs e) { @@ -566,7 +625,7 @@ namespace compabetov2 // Configuración de la fuente y del área de impresión - Font fuente = new Font("Arial", 10); // Ajustar el tamaño de fuente según sea necesario + Font fuente = new Font("Arial", 8); // Ajustar el tamaño de fuente según sea necesario PointF posicion = new PointF(0, e.MarginBounds.Top); // Imprimir el contenido @@ -830,6 +889,8 @@ namespace compabetov2 MessageBox.Show("Envio hecho"); eliminarProductosTocket(); llenarLayout(); + + ImprimirTicketEnvio(); } else { @@ -847,6 +908,7 @@ namespace compabetov2 flowLayoutPanel1.Controls.Remove(c); } label1.Text = "Total: 0"; + txtbusqueda.Text = ""; } diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 849b06f..3e90dbe 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index 50d288a..e0e8003 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/bin/Debug/data.db b/bin/Debug/data.db index aea5672..62f1481 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index c454b25..afe2a02 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 849b06f..3e90dbe 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index 50d288a..e0e8003 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ