Subo cambios 508
This commit is contained in:
+26
-1
@@ -44,6 +44,8 @@ namespace compabetov2.Ventas
|
||||
ventanaPadre.eliminarProductosTocket();
|
||||
ventanaPadre.llenarLayout();
|
||||
ventanaPadre.total = 0;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +125,7 @@ namespace compabetov2.Ventas
|
||||
"------------------------------------\n" +
|
||||
" Detalle envío:\n" +
|
||||
$" Cliente: {txtCliente.Text}\n" +
|
||||
$" Dirección: {txtDireccion.Text}\n" +
|
||||
$" Dirección: {AjustarDireccion(txtDireccion.Text)}\n" +//tengo duda aquí
|
||||
$" Teléfono: {txtTelefono.Text}";
|
||||
|
||||
|
||||
@@ -134,6 +136,29 @@ namespace compabetov2.Ventas
|
||||
// Imprimir el contenido
|
||||
e.Graphics.DrawString(contenido, fuente, Brushes.Black, posicion);
|
||||
}
|
||||
private string AjustarDireccion(string direccion)
|
||||
{
|
||||
const int maxCaracteresPorLinea = 8;
|
||||
|
||||
// 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 = "";
|
||||
|
||||
for (int i = 0; i < segmentos; i++)
|
||||
{
|
||||
int inicio = i * maxCaracteresPorLinea;
|
||||
direccionFormateada += direccion.Substring(inicio, maxCaracteresPorLinea) + "\n";
|
||||
}
|
||||
|
||||
return direccionFormateada;
|
||||
}
|
||||
|
||||
// Devuelve la dirección sin cambios si no se necesita ajustar
|
||||
return direccion;
|
||||
}
|
||||
|
||||
public void ImprimirTicketEnvio()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user