Subo cambios 534
This commit is contained in:
+30
-9
@@ -143,21 +143,20 @@ namespace compabetov2.Ventas
|
||||
// Verifica la longitud de la dirección
|
||||
if (direccion.Length > maxCaracteresPorLinea)
|
||||
{
|
||||
// Inserta un salto de línea después de 8 caracteres
|
||||
int segmentos = direccion.Length / maxCaracteresPorLinea;
|
||||
string direccionFormateada = "";
|
||||
StringBuilder direccionFormateada = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < segmentos; i++)
|
||||
for (int i = 0; i < direccion.Length; i += maxCaracteresPorLinea)
|
||||
{
|
||||
int inicio = i * maxCaracteresPorLinea;
|
||||
direccionFormateada += direccion.Substring(inicio, maxCaracteresPorLinea) + "\n";
|
||||
int caracteresRestantes = direccion.Length - i;
|
||||
int caracteresEnEstaLinea = Math.Min(caracteresRestantes, maxCaracteresPorLinea);
|
||||
|
||||
direccionFormateada.AppendLine(direccion.Substring(i, caracteresEnEstaLinea));
|
||||
}
|
||||
|
||||
return direccionFormateada;
|
||||
return direccionFormateada.ToString();
|
||||
}
|
||||
|
||||
// Devuelve la dirección sin cambios si no se necesita ajustar
|
||||
return direccion;
|
||||
return direccion; // Devuelve la dirección sin cambios si no es necesario ajustarla
|
||||
}
|
||||
|
||||
public void ImprimirTicketEnvio()
|
||||
@@ -186,5 +185,27 @@ namespace compabetov2.Ventas
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void pictureBox2_Click(object sender, EventArgs e)
|
||||
{
|
||||
envio.cliente = txtCliente.Text;
|
||||
envio.direccion = txtDireccion.Text;
|
||||
envio.telefono = txtTelefono.Text;
|
||||
if (service.crearEnvio(envio, detallesEnvio))
|
||||
{
|
||||
MessageBox.Show("Envio hecho");
|
||||
ImprimirTicketEnvio();
|
||||
ventanaPadre.eliminarProductosTocket();
|
||||
ventanaPadre.llenarLayout();
|
||||
ventanaPadre.total = 0;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user