Cada vez más cercas del fina4

This commit is contained in:
Michael Robles
2024-01-08 19:05:10 -07:00
parent d5fff38293
commit c89c85970b
11 changed files with 65 additions and 16 deletions
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -297,7 +297,7 @@
<Content Include="icono.ico" /> <Content Include="icono.ico" />
<None Include="Resources\mas.png" /> <None Include="Resources\mas.png" />
<None Include="Resources\menos.png" /> <None Include="Resources\menos.png" />
<None Include="Resources\Modelo.jpg" /> <Content Include="Resources\Modelo.jpg" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2"> <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
Binary file not shown.
@@ -1 +1 @@
424f6d4f8bcbc47e89c98d2fa689cb77dffd9f6b5116717e9e8dca5ece3777d7 953cb31f9b6e74dde952aba09707a9add648ded1
Binary file not shown.
Binary file not shown.
Binary file not shown.
+31
View File
@@ -49,6 +49,8 @@
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.labeltotal = new System.Windows.Forms.Label();
this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
@@ -91,6 +93,8 @@
// //
this.flowLayoutPanel2.BackgroundImage = global::compabetov2.Properties.Resources.rec; this.flowLayoutPanel2.BackgroundImage = global::compabetov2.Properties.Resources.rec;
this.flowLayoutPanel2.Controls.Add(this.panel1); this.flowLayoutPanel2.Controls.Add(this.panel1);
this.flowLayoutPanel2.Controls.Add(this.label1);
this.flowLayoutPanel2.Controls.Add(this.labeltotal);
this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1); this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Name = "flowLayoutPanel2";
@@ -274,6 +278,30 @@
this.textBox2.Size = new System.Drawing.Size(399, 36); this.textBox2.Size = new System.Drawing.Size(399, 36);
this.textBox2.TabIndex = 16; this.textBox2.TabIndex = 16;
// //
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.AliceBlue;
this.label1.Location = new System.Drawing.Point(3, 267);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(102, 39);
this.label1.TabIndex = 17;
this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// labeltotal
//
this.labeltotal.AutoSize = true;
this.labeltotal.BackColor = System.Drawing.Color.Transparent;
this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue;
this.labeltotal.Location = new System.Drawing.Point(111, 267);
this.labeltotal.Name = "labeltotal";
this.labeltotal.Size = new System.Drawing.Size(0, 39);
this.labeltotal.TabIndex = 18;
//
// vender // vender
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -293,6 +321,7 @@
this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load); this.Load += new System.EventHandler(this.vender_Load);
this.flowLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit();
@@ -327,5 +356,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label labeltotal;
} }
} }
+21 -3
View File
@@ -27,6 +27,7 @@ namespace compabetov2
private List<Producto> productos; private List<Producto> productos;
private List<TableLayoutPanel> cartas = new List<TableLayoutPanel>(); private List<TableLayoutPanel> cartas = new List<TableLayoutPanel>();
private decimal total = 0; private decimal total = 0;
private Label ticketLabel;
@@ -56,10 +57,17 @@ namespace compabetov2
pic.Dock = DockStyle.Fill; pic.Dock = DockStyle.Fill;
pic.SizeMode = PictureBoxSizeMode.Zoom; pic.SizeMode = PictureBoxSizeMode.Zoom;
string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img); string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img);
pic.Image = Image.FromFile(rutaImg); pic.Image = Image.FromFile(rutaImg);//hay error aquí
pic.BackgroundImageLayout = ImageLayout.Stretch; pic.BackgroundImageLayout = ImageLayout.Stretch;
pic.Tag = producto.idProducto; pic.Tag = producto.idProducto;
Label id = new Label(); Label id = new Label();
id.Text = producto.idProducto.ToString(); id.Text = producto.idProducto.ToString();
id.BackColor = Color.FromArgb(82, 82, 82); id.BackColor = Color.FromArgb(82, 82, 82);
@@ -157,7 +165,7 @@ namespace compabetov2
// Generar ticket y agregarlo al flowLayoutPanel2 // Generar ticket y agregarlo al flowLayoutPanel2
GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total); GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total);
// ... (código existente)
}); });
HUD.Controls.Add(btnMenos); HUD.Controls.Add(btnMenos);
@@ -168,6 +176,8 @@ namespace compabetov2
carta.Controls.Add(HUD, 0, 1); carta.Controls.Add(HUD, 0, 1);
cartas.Add(carta); cartas.Add(carta);
flowLayoutPanel3.Controls.Add(carta); flowLayoutPanel3.Controls.Add(carta);
} }
@@ -175,6 +185,7 @@ namespace compabetov2
} }
private void GenerarTicket(int idProducto, string nombreProducto, decimal precio, int cantidad, decimal total) private void GenerarTicket(int idProducto, string nombreProducto, decimal precio, int cantidad, decimal total)
@@ -182,8 +193,9 @@ namespace compabetov2
// Crear un nuevo control (puede ser un Label, Panel, etc.) para representar el ticket // Crear un nuevo control (puede ser un Label, Panel, etc.) para representar el ticket
Label ticketLabel = new Label(); Label ticketLabel = new Label();
ticketLabel.Text = $"ID: {idProducto} | Producto: {nombreProducto} | Precio: ${precio} | Cantidad: {cantidad} | Total: ${total}"; 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; ticketLabel.AutoSize = true;
labeltotal.Text = total.ToString();
// Agregar el ticket al flowLayoutPanel2 // Agregar el ticket al flowLayoutPanel2
flowLayoutPanel2.Controls.Add(ticketLabel); flowLayoutPanel2.Controls.Add(ticketLabel);
@@ -196,6 +208,7 @@ namespace compabetov2
private void getData() private void getData()
{ {
this.productos = service.conseguirProductos(); this.productos = service.conseguirProductos();
@@ -243,6 +256,11 @@ namespace compabetov2
{ {
} }
private void label1_Click(object sender, EventArgs e)
{
}
} }
} }