ticket listo
This commit is contained in:
@@ -200,22 +200,25 @@ namespace compabetov2
|
||||
{
|
||||
contador_saltar_2_vueltas++;
|
||||
continue;
|
||||
|
||||
}
|
||||
TableLayoutPanel panelProducto = item as TableLayoutPanel;
|
||||
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
|
||||
Label lbnombre = panelInfo.Controls[0] as Label;
|
||||
string textoLb = lbnombre.Text;
|
||||
string[] cadenas = textoLb.Split(' ');
|
||||
if (cadenas[1].Equals(nombreProducto))
|
||||
string[] cadenas = textoLb.Split(':');
|
||||
string cadena = cadenas[1].Remove(0, 1);
|
||||
|
||||
if (cadena.Equals(nombreProducto))
|
||||
{
|
||||
|
||||
existeProducto=true;
|
||||
Label Lbcantidad = panelInfo.Controls[0] as Label;
|
||||
Label Lbtotal = panelInfo.Controls[0] as Label;
|
||||
Label Lbcantidad = panelInfo.Controls[2] as Label;
|
||||
Label Lbtotal = panelInfo.Controls[3] as Label;
|
||||
string textcantidad = Lbcantidad.Text;
|
||||
int NuevaCantiad = int.Parse(textcantidad.Split(' ')[1]);
|
||||
string textoTotal = Lbtotal.Text;
|
||||
int NuevoTotal = int.Parse(textoTotal.Split('$')[1]) * cantidad;
|
||||
string[] cantidadCadenas = textcantidad.Split(' ');
|
||||
int NuevaCantiad = int.Parse(cantidadCadenas[1]) + 1;
|
||||
|
||||
int NuevoTotal = (int)(NuevaCantiad * precio);
|
||||
|
||||
Lbcantidad.Text = $"Cantidad: {NuevaCantiad}";
|
||||
Lbtotal.Text = $"Total: ${NuevoTotal}";
|
||||
@@ -245,18 +248,22 @@ namespace compabetov2
|
||||
Label lbNombre = new Label();
|
||||
lbNombre.Dock = DockStyle.Fill;
|
||||
lbNombre.Text = $"producto: {nombreProducto}";
|
||||
lbNombre.ForeColor = Color.White;
|
||||
|
||||
Label lbPrecio = new Label();
|
||||
lbPrecio.Dock = DockStyle.Fill;
|
||||
lbPrecio.Text = $"Precio: ${precio}";
|
||||
lbPrecio.ForeColor = Color.White;
|
||||
|
||||
Label lbCantidad = new Label();
|
||||
lbCantidad.Dock = DockStyle.Fill;
|
||||
lbCantidad.Text = $"Cantidad: {cantidad}";
|
||||
lbCantidad.ForeColor = Color.White;
|
||||
|
||||
Label lbTotal = new Label();
|
||||
lbTotal.Dock = DockStyle.Fill;
|
||||
lbTotal.Text = $"Total: ${cantidad * precio}";
|
||||
lbTotal.ForeColor = Color.White;
|
||||
|
||||
infoTicket.Controls.Add(lbNombre, 0, 0);
|
||||
infoTicket.Controls.Add(lbPrecio, 0, 1);
|
||||
|
||||
Reference in New Issue
Block a user