Subo cambios 457
This commit is contained in:
Generated
+28
-18
@@ -42,62 +42,69 @@
|
|||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label1.Location = new System.Drawing.Point(22, 25);
|
this.label1.Location = new System.Drawing.Point(29, 31);
|
||||||
|
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(62, 20);
|
this.label1.Size = new System.Drawing.Size(79, 25);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Cliente:";
|
this.label1.Text = "Cliente:";
|
||||||
//
|
//
|
||||||
// txtCliente
|
// txtCliente
|
||||||
//
|
//
|
||||||
this.txtCliente.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.txtCliente.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.txtCliente.Location = new System.Drawing.Point(25, 61);
|
this.txtCliente.Location = new System.Drawing.Point(33, 75);
|
||||||
|
this.txtCliente.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.txtCliente.Name = "txtCliente";
|
this.txtCliente.Name = "txtCliente";
|
||||||
this.txtCliente.Size = new System.Drawing.Size(337, 26);
|
this.txtCliente.Size = new System.Drawing.Size(448, 30);
|
||||||
this.txtCliente.TabIndex = 1;
|
this.txtCliente.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// txtDireccion
|
// txtDireccion
|
||||||
//
|
//
|
||||||
this.txtDireccion.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.txtDireccion.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.txtDireccion.Location = new System.Drawing.Point(25, 149);
|
this.txtDireccion.Location = new System.Drawing.Point(33, 183);
|
||||||
|
this.txtDireccion.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.txtDireccion.Name = "txtDireccion";
|
this.txtDireccion.Name = "txtDireccion";
|
||||||
this.txtDireccion.Size = new System.Drawing.Size(337, 26);
|
this.txtDireccion.Size = new System.Drawing.Size(448, 30);
|
||||||
this.txtDireccion.TabIndex = 3;
|
this.txtDireccion.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label2.Location = new System.Drawing.Point(22, 110);
|
this.label2.Location = new System.Drawing.Point(29, 135);
|
||||||
|
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(79, 20);
|
this.label2.Size = new System.Drawing.Size(99, 25);
|
||||||
this.label2.TabIndex = 2;
|
this.label2.TabIndex = 2;
|
||||||
this.label2.Text = "Direccion:";
|
this.label2.Text = "Direccion:";
|
||||||
//
|
//
|
||||||
// txtTelefono
|
// txtTelefono
|
||||||
//
|
//
|
||||||
this.txtTelefono.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.txtTelefono.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.txtTelefono.Location = new System.Drawing.Point(24, 227);
|
this.txtTelefono.Location = new System.Drawing.Point(32, 279);
|
||||||
|
this.txtTelefono.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.txtTelefono.Name = "txtTelefono";
|
this.txtTelefono.Name = "txtTelefono";
|
||||||
this.txtTelefono.Size = new System.Drawing.Size(338, 26);
|
this.txtTelefono.Size = new System.Drawing.Size(449, 30);
|
||||||
this.txtTelefono.TabIndex = 5;
|
this.txtTelefono.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label3.Location = new System.Drawing.Point(21, 191);
|
this.label3.Location = new System.Drawing.Point(28, 235);
|
||||||
|
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(75, 20);
|
this.label3.Size = new System.Drawing.Size(95, 25);
|
||||||
this.label3.TabIndex = 4;
|
this.label3.TabIndex = 4;
|
||||||
this.label3.Text = "Telefono:";
|
this.label3.Text = "Telefono:";
|
||||||
//
|
//
|
||||||
// btnAceptar
|
// btnAceptar
|
||||||
//
|
//
|
||||||
this.btnAceptar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.btnAceptar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.btnAceptar.Location = new System.Drawing.Point(103, 277);
|
this.btnAceptar.Location = new System.Drawing.Point(137, 341);
|
||||||
|
this.btnAceptar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.btnAceptar.Name = "btnAceptar";
|
this.btnAceptar.Name = "btnAceptar";
|
||||||
this.btnAceptar.Size = new System.Drawing.Size(77, 31);
|
this.btnAceptar.Size = new System.Drawing.Size(103, 38);
|
||||||
this.btnAceptar.TabIndex = 6;
|
this.btnAceptar.TabIndex = 6;
|
||||||
this.btnAceptar.Text = "Aceptar";
|
this.btnAceptar.Text = "Aceptar";
|
||||||
this.btnAceptar.UseVisualStyleBackColor = true;
|
this.btnAceptar.UseVisualStyleBackColor = true;
|
||||||
@@ -106,9 +113,10 @@
|
|||||||
// btnCancelar
|
// btnCancelar
|
||||||
//
|
//
|
||||||
this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.btnCancelar.Location = new System.Drawing.Point(203, 277);
|
this.btnCancelar.Location = new System.Drawing.Point(271, 341);
|
||||||
|
this.btnCancelar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.btnCancelar.Name = "btnCancelar";
|
this.btnCancelar.Name = "btnCancelar";
|
||||||
this.btnCancelar.Size = new System.Drawing.Size(83, 31);
|
this.btnCancelar.Size = new System.Drawing.Size(111, 38);
|
||||||
this.btnCancelar.TabIndex = 8;
|
this.btnCancelar.TabIndex = 8;
|
||||||
this.btnCancelar.Text = "Cancelar";
|
this.btnCancelar.Text = "Cancelar";
|
||||||
this.btnCancelar.UseVisualStyleBackColor = true;
|
this.btnCancelar.UseVisualStyleBackColor = true;
|
||||||
@@ -116,9 +124,9 @@
|
|||||||
//
|
//
|
||||||
// datosEnvio
|
// datosEnvio
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(374, 341);
|
this.ClientSize = new System.Drawing.Size(499, 420);
|
||||||
this.Controls.Add(this.btnCancelar);
|
this.Controls.Add(this.btnCancelar);
|
||||||
this.Controls.Add(this.btnAceptar);
|
this.Controls.Add(this.btnAceptar);
|
||||||
this.Controls.Add(this.txtTelefono);
|
this.Controls.Add(this.txtTelefono);
|
||||||
@@ -127,8 +135,10 @@
|
|||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.txtCliente);
|
this.Controls.Add(this.txtCliente);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||||
this.Name = "datosEnvio";
|
this.Name = "datosEnvio";
|
||||||
this.Text = "Datos del envio";
|
this.Text = "Datos del envio";
|
||||||
|
this.Load += new System.EventHandler(this.datosEnvio_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|||||||
+118
-1
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Printing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -14,6 +15,10 @@ namespace compabetov2.Ventas
|
|||||||
{
|
{
|
||||||
public partial class datosEnvio : Form
|
public partial class datosEnvio : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public string Cliente => txtCliente.Text;
|
||||||
|
public string Direccion => txtDireccion.Text;
|
||||||
|
public string Telefono => txtTelefono.Text;
|
||||||
private Envio envio;
|
private Envio envio;
|
||||||
List<DetalleEnvioModel> detallesEnvio;
|
List<DetalleEnvioModel> detallesEnvio;
|
||||||
vender ventanaPadre;
|
vender ventanaPadre;
|
||||||
@@ -25,6 +30,8 @@ namespace compabetov2.Ventas
|
|||||||
this.ventanaPadre = ventanaPadre;
|
this.ventanaPadre = ventanaPadre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void btnAceptar_Click(object sender, EventArgs e)
|
private void btnAceptar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
envio.cliente = txtCliente.Text;
|
envio.cliente = txtCliente.Text;
|
||||||
@@ -33,16 +40,126 @@ namespace compabetov2.Ventas
|
|||||||
if (service.crearEnvio(envio, detallesEnvio))
|
if (service.crearEnvio(envio, detallesEnvio))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Envio hecho");
|
MessageBox.Show("Envio hecho");
|
||||||
ventanaPadre.ImprimirTicketEnvio();
|
ImprimirTicketEnvio();
|
||||||
ventanaPadre.eliminarProductosTocket();
|
ventanaPadre.eliminarProductosTocket();
|
||||||
ventanaPadre.llenarLayout();
|
ventanaPadre.llenarLayout();
|
||||||
ventanaPadre.total = 0;
|
ventanaPadre.total = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string crearContenidoImprimir()
|
||||||
|
{
|
||||||
|
int contador_saltar_2_vueltas = 1;
|
||||||
|
string resultado = "";
|
||||||
|
foreach (var item in ventanaPadre.flowLayoutPanel2.Controls)
|
||||||
|
{
|
||||||
|
if (contador_saltar_2_vueltas <= 3)
|
||||||
|
{
|
||||||
|
contador_saltar_2_vueltas++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
TableLayoutPanel panelProducto = item as TableLayoutPanel;
|
||||||
|
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
|
||||||
|
Label lbnombre = panelInfo.Controls[0] as Label;
|
||||||
|
Label lbPrecio = panelInfo.Controls[1] as Label;
|
||||||
|
Label Lbcantidad = panelInfo.Controls[2] as Label;
|
||||||
|
Label Lbtotal = panelInfo.Controls[3] as Label;
|
||||||
|
//nombre producto
|
||||||
|
string textoLbnombre = lbnombre.Text;
|
||||||
|
string[] cadenas = textoLbnombre.Split(':');
|
||||||
|
string productoNombre = cadenas[1].Remove(0, 1);
|
||||||
|
|
||||||
|
//precio
|
||||||
|
string textoLbPrecio = lbPrecio.Text;
|
||||||
|
cadenas = textoLbPrecio.Split('$');
|
||||||
|
string precioProducto = cadenas[1];
|
||||||
|
|
||||||
|
//cantidad
|
||||||
|
string textoLbCantidad = Lbcantidad.Text;
|
||||||
|
cadenas = textoLbCantidad.Split(':');
|
||||||
|
string cantidadProducto = cadenas[1].Remove(0, 1);
|
||||||
|
|
||||||
|
//total
|
||||||
|
string textoLbTotal = Lbtotal.Text;
|
||||||
|
cadenas = textoLbTotal.Split('$');
|
||||||
|
string totalProducto = cadenas[1];
|
||||||
|
|
||||||
|
resultado += $"{(productoNombre.Length > 10 ? $"{productoNombre}\n" : $"{productoNombre}")} | ${precioProducto} | {cantidadProducto}\n";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return resultado;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ImprimirContenidoEnvio(PrintPageEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
string responsable = envio.responsable;
|
||||||
|
// 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: ${envio.total + 10}\n" +
|
||||||
|
"------------------------------------\n" +
|
||||||
|
" Mini Súper\n" +
|
||||||
|
" Compa BETO\n" +
|
||||||
|
" ¡Gracias por su compra!\n" +
|
||||||
|
"------------------------------------\n" +
|
||||||
|
" Detalle envío:\n" +
|
||||||
|
$" Cliente: {txtCliente.Text}\n" +
|
||||||
|
$" Dirección: {txtDireccion.Text}\n" +
|
||||||
|
$" Teléfono: {txtTelefono.Text}";
|
||||||
|
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public 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 btnCancelar_Click(object sender, EventArgs e)
|
private void btnCancelar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void datosEnvio_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+1
-1
@@ -376,7 +376,7 @@
|
|||||||
private System.Windows.Forms.Button button5;
|
private System.Windows.Forms.Button button5;
|
||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
public System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||||
private System.Windows.Forms.Panel panel1;
|
private System.Windows.Forms.Panel panel1;
|
||||||
private System.Windows.Forms.PictureBox pictureBox9;
|
private System.Windows.Forms.PictureBox pictureBox9;
|
||||||
private System.Windows.Forms.Timer horafecha;
|
private System.Windows.Forms.Timer horafecha;
|
||||||
|
|||||||
+26
-56
@@ -23,7 +23,7 @@ namespace compabetov2
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
private int numeroPagina = 1; // Variable para rastrear el número de página actual
|
||||||
private Point lastPoint;
|
private Point lastPoint;
|
||||||
private List<Producto> productos;
|
private List<Producto> productos;
|
||||||
public decimal total = 0;
|
public decimal total = 0;
|
||||||
@@ -475,7 +475,7 @@ namespace compabetov2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void flowLayoutPanel2_Paint(object sender, PaintEventArgs e)
|
public void flowLayoutPanel2_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -485,6 +485,7 @@ namespace compabetov2
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void bntImprimir_Click(object sender, EventArgs e)
|
private void bntImprimir_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult resultado = MessageBox.Show("¿Quieres hacer esa venta?", "Confirmación de Venta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
DialogResult resultado = MessageBox.Show("¿Quieres hacer esa venta?", "Confirmación de Venta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
@@ -529,74 +530,25 @@ namespace compabetov2
|
|||||||
using (PrintDocument documentoImpresion = new PrintDocument())
|
using (PrintDocument documentoImpresion = new PrintDocument())
|
||||||
{
|
{
|
||||||
documentoImpresion.PrintPage += (sender, e) => ImprimirContenido(e);
|
documentoImpresion.PrintPage += (sender, e) => ImprimirContenido(e);
|
||||||
|
documentoImpresion.PrintController = new StandardPrintController(); // Evita que el documento se imprima automáticamente
|
||||||
|
|
||||||
using (PrintDialog printDialog = new PrintDialog())
|
using (PrintDialog printDialog = new PrintDialog())
|
||||||
{
|
{
|
||||||
printDialog.Document = documentoImpresion;
|
printDialog.Document = documentoImpresion;
|
||||||
|
|
||||||
if (printDialog.ShowDialog() == DialogResult.OK)
|
if (printDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
// Imprime el documento
|
||||||
documentoImpresion.Print();
|
documentoImpresion.Print();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public 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)
|
private void ImprimirContenido(PrintPageEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -631,6 +583,24 @@ namespace compabetov2
|
|||||||
|
|
||||||
// Imprimir el contenido
|
// Imprimir el contenido
|
||||||
e.Graphics.DrawString(contenido, fuente, Brushes.Black, posicion);
|
e.Graphics.DrawString(contenido, fuente, Brushes.Black, posicion);
|
||||||
|
|
||||||
|
// Incrementa el número de página
|
||||||
|
// Tu lógica de impresión actual aquí
|
||||||
|
|
||||||
|
// Incrementa el número de página
|
||||||
|
numeroPagina++;
|
||||||
|
|
||||||
|
// Imprime solo dos páginas
|
||||||
|
if (numeroPagina <= 2)
|
||||||
|
{
|
||||||
|
e.HasMorePages = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.HasMorePages = false;
|
||||||
|
numeroPagina = 1; // Reinicia el número de página para futuras impresiones
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user