Cada vez más cercas del fina4
This commit is contained in:
@@ -27,6 +27,7 @@ namespace compabetov2
|
||||
private List<Producto> productos;
|
||||
private List<TableLayoutPanel> cartas = new List<TableLayoutPanel>();
|
||||
private decimal total = 0;
|
||||
private Label ticketLabel;
|
||||
|
||||
|
||||
|
||||
@@ -52,13 +53,20 @@ namespace compabetov2
|
||||
carta.Width = 200;
|
||||
carta.Height = 300;
|
||||
|
||||
PictureBox pic = new PictureBox();
|
||||
pic.Dock = DockStyle.Fill;
|
||||
pic.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img);
|
||||
pic.Image = Image.FromFile(rutaImg);
|
||||
pic.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
pic.Tag = producto.idProducto;
|
||||
PictureBox pic = new PictureBox();
|
||||
pic.Dock = DockStyle.Fill;
|
||||
pic.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img);
|
||||
pic.Image = Image.FromFile(rutaImg);//hay error aquí
|
||||
pic.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
pic.Tag = producto.idProducto;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Label id = new Label();
|
||||
id.Text = producto.idProducto.ToString();
|
||||
@@ -138,11 +146,11 @@ namespace compabetov2
|
||||
total += producto.precion;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Obtener información del Label id y precio
|
||||
int idProducto = int.Parse(id.Text);
|
||||
decimal precioProducto = producto.precion;
|
||||
decimal precioProducto = producto.precion;
|
||||
if (decimal.TryParse(precio.Text, NumberStyles.Currency, CultureInfo.CurrentCulture, out precioProducto))
|
||||
{
|
||||
// Generar ticket y agregarlo al flowLayoutPanel2
|
||||
@@ -157,7 +165,7 @@ namespace compabetov2
|
||||
// Generar ticket y agregarlo al flowLayoutPanel2
|
||||
GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total);
|
||||
|
||||
// ... (código existente)
|
||||
|
||||
});
|
||||
|
||||
HUD.Controls.Add(btnMenos);
|
||||
@@ -168,12 +176,15 @@ namespace compabetov2
|
||||
carta.Controls.Add(HUD, 0, 1);
|
||||
cartas.Add(carta);
|
||||
flowLayoutPanel3.Controls.Add(carta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -182,8 +193,9 @@ namespace compabetov2
|
||||
// Crear un nuevo control (puede ser un Label, Panel, etc.) para representar el ticket
|
||||
Label ticketLabel = new Label();
|
||||
ticketLabel.Text = $"ID: {idProducto} | Producto: {nombreProducto} | Precio: ${precio} | Cantidad: {cantidad} | Total: ${total}";
|
||||
ticketLabel.BackColor = Color.LightGray; // Puedes ajustar el color de fondo según tu diseño
|
||||
|
||||
ticketLabel.AutoSize = true;
|
||||
labeltotal.Text = total.ToString();
|
||||
|
||||
// Agregar el ticket al flowLayoutPanel2
|
||||
flowLayoutPanel2.Controls.Add(ticketLabel);
|
||||
@@ -196,6 +208,7 @@ namespace compabetov2
|
||||
|
||||
|
||||
|
||||
|
||||
private void getData()
|
||||
{
|
||||
this.productos = service.conseguirProductos();
|
||||
@@ -243,6 +256,11 @@ namespace compabetov2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user