ticket listo

This commit is contained in:
carlos
2024-01-08 22:06:03 -06:00
parent d17242fbac
commit be04898414
6 changed files with 15 additions and 8 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15 -8
View File
@@ -200,22 +200,25 @@ namespace compabetov2
{ {
contador_saltar_2_vueltas++; contador_saltar_2_vueltas++;
continue; continue;
} }
TableLayoutPanel panelProducto = item as TableLayoutPanel; TableLayoutPanel panelProducto = item as TableLayoutPanel;
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel; TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
Label lbnombre = panelInfo.Controls[0] as Label; Label lbnombre = panelInfo.Controls[0] as Label;
string textoLb = lbnombre.Text; string textoLb = lbnombre.Text;
string[] cadenas = textoLb.Split(' '); string[] cadenas = textoLb.Split(':');
if (cadenas[1].Equals(nombreProducto)) string cadena = cadenas[1].Remove(0, 1);
if (cadena.Equals(nombreProducto))
{ {
existeProducto=true; existeProducto=true;
Label Lbcantidad = panelInfo.Controls[0] as Label; Label Lbcantidad = panelInfo.Controls[2] as Label;
Label Lbtotal = panelInfo.Controls[0] as Label; Label Lbtotal = panelInfo.Controls[3] as Label;
string textcantidad = Lbcantidad.Text; string textcantidad = Lbcantidad.Text;
int NuevaCantiad = int.Parse(textcantidad.Split(' ')[1]); string[] cantidadCadenas = textcantidad.Split(' ');
string textoTotal = Lbtotal.Text; int NuevaCantiad = int.Parse(cantidadCadenas[1]) + 1;
int NuevoTotal = int.Parse(textoTotal.Split('$')[1]) * cantidad;
int NuevoTotal = (int)(NuevaCantiad * precio);
Lbcantidad.Text = $"Cantidad: {NuevaCantiad}"; Lbcantidad.Text = $"Cantidad: {NuevaCantiad}";
Lbtotal.Text = $"Total: ${NuevoTotal}"; Lbtotal.Text = $"Total: ${NuevoTotal}";
@@ -245,18 +248,22 @@ namespace compabetov2
Label lbNombre = new Label(); Label lbNombre = new Label();
lbNombre.Dock = DockStyle.Fill; lbNombre.Dock = DockStyle.Fill;
lbNombre.Text = $"producto: {nombreProducto}"; lbNombre.Text = $"producto: {nombreProducto}";
lbNombre.ForeColor = Color.White;
Label lbPrecio = new Label(); Label lbPrecio = new Label();
lbPrecio.Dock = DockStyle.Fill; lbPrecio.Dock = DockStyle.Fill;
lbPrecio.Text = $"Precio: ${precio}"; lbPrecio.Text = $"Precio: ${precio}";
lbPrecio.ForeColor = Color.White;
Label lbCantidad = new Label(); Label lbCantidad = new Label();
lbCantidad.Dock = DockStyle.Fill; lbCantidad.Dock = DockStyle.Fill;
lbCantidad.Text = $"Cantidad: {cantidad}"; lbCantidad.Text = $"Cantidad: {cantidad}";
lbCantidad.ForeColor = Color.White;
Label lbTotal = new Label(); Label lbTotal = new Label();
lbTotal.Dock = DockStyle.Fill; lbTotal.Dock = DockStyle.Fill;
lbTotal.Text = $"Total: ${cantidad * precio}"; lbTotal.Text = $"Total: ${cantidad * precio}";
lbTotal.ForeColor = Color.White;
infoTicket.Controls.Add(lbNombre, 0, 0); infoTicket.Controls.Add(lbNombre, 0, 0);
infoTicket.Controls.Add(lbPrecio, 0, 1); infoTicket.Controls.Add(lbPrecio, 0, 1);