diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
index 51e4833..dc00168 100644
--- a/.vs/VSWorkspaceState.json
+++ b/.vs/VSWorkspaceState.json
@@ -1,8 +1,9 @@
{
"ExpandedNodes": [
"",
- "\\database"
+ "\\database",
+ "\\database\\modelos"
],
- "SelectedNode": "\\App.config",
+ "SelectedNode": "\\.sln",
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
diff --git a/.vs/compabetoOG/v17/.wsuo b/.vs/compabetoOG/v17/.wsuo
index b6ef866..89c25f0 100644
Binary files a/.vs/compabetoOG/v17/.wsuo and b/.vs/compabetoOG/v17/.wsuo differ
diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe
index 7d92b74..60291aa 100644
Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ
diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb
index 2d7ea08..07b203c 100644
Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ
diff --git a/bin/Debug/data.db b/bin/Debug/data.db
index 1882aa4..ef4609c 100644
Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ
diff --git a/compabetov2.csproj b/compabetov2.csproj
index 051a0a4..b787e4c 100644
--- a/compabetov2.csproj
+++ b/compabetov2.csproj
@@ -297,7 +297,7 @@
-
+
diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache
index 3d46ab8..b1fcf0d 100644
Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ
diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 6fd8f5d..eaa118c 100644
Binary files a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache
index 7586091..46c7c97 100644
Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ
diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache
index 2b14cea..02cf15a 100644
Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ
diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe
index 7d92b74..60291aa 100644
Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ
diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb
index 2d7ea08..07b203c 100644
Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ
diff --git a/vender.Designer.cs b/vender.Designer.cs
index 8043b6f..e444501 100644
--- a/vender.Designer.cs
+++ b/vender.Designer.cs
@@ -36,6 +36,8 @@
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox9 = new System.Windows.Forms.PictureBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.labeltotal = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
@@ -67,9 +69,10 @@
this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy;
- this.lblfecha.Location = new System.Drawing.Point(493, 105);
+ this.lblfecha.Location = new System.Drawing.Point(370, 85);
+ this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblfecha.Name = "lblfecha";
- this.lblfecha.Size = new System.Drawing.Size(159, 58);
+ this.lblfecha.Size = new System.Drawing.Size(126, 46);
this.lblfecha.TabIndex = 13;
this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -80,9 +83,10 @@
this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue;
- this.lblhora.Location = new System.Drawing.Point(681, -14);
+ this.lblhora.Location = new System.Drawing.Point(511, -11);
+ this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhora.Name = "lblhora";
- this.lblhora.Size = new System.Drawing.Size(318, 113);
+ this.lblhora.Size = new System.Drawing.Size(249, 91);
this.lblhora.TabIndex = 12;
this.lblhora.Text = "label1";
this.lblhora.Click += new System.EventHandler(this.lblhora_Click);
@@ -91,10 +95,12 @@
//
this.flowLayoutPanel2.BackgroundImage = global::compabetov2.Properties.Resources.rec;
this.flowLayoutPanel2.Controls.Add(this.panel1);
- this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1);
- this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel2.Controls.Add(this.label1);
+ this.flowLayoutPanel2.Controls.Add(this.labeltotal);
+ this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1);
+ this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
- this.flowLayoutPanel2.Size = new System.Drawing.Size(324, 1191);
+ this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968);
this.flowLayoutPanel2.TabIndex = 11;
this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint);
//
@@ -102,23 +108,49 @@
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.pictureBox9);
- this.panel1.Location = new System.Drawing.Point(3, 2);
- this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panel1.Location = new System.Drawing.Point(2, 2);
+ this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(312, 263);
+ this.panel1.Size = new System.Drawing.Size(234, 214);
this.panel1.TabIndex = 8;
//
// pictureBox9
//
this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu;
- this.pictureBox9.Location = new System.Drawing.Point(64, 34);
- this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.pictureBox9.Location = new System.Drawing.Point(48, 28);
+ this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox9.TabIndex = 8;
this.pictureBox9.TabStop = false;
//
+ // 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(2, 218);
+ this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(83, 31);
+ 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(89, 218);
+ this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.labeltotal.Name = "labeltotal";
+ this.labeltotal.Size = new System.Drawing.Size(0, 31);
+ this.labeltotal.TabIndex = 18;
+ //
// flowLayoutPanel1
//
this.flowLayoutPanel1.BackgroundImage = global::compabetov2.Properties.Resources.rec;
@@ -129,26 +161,26 @@
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 0);
- this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
- this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1199);
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
- this.panel2.Location = new System.Drawing.Point(3, 2);
- this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panel2.Location = new System.Drawing.Point(2, 2);
+ this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(312, 263);
+ this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8;
//
// pictureBox7
//
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
- this.pictureBox7.Location = new System.Drawing.Point(64, 34);
- this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.pictureBox7.Location = new System.Drawing.Point(48, 28);
+ this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -164,11 +196,11 @@
this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button1.Location = new System.Drawing.Point(3, 269);
- this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button1.Location = new System.Drawing.Point(2, 220);
+ this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1";
- this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button1.Size = new System.Drawing.Size(312, 114);
+ this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button1.Size = new System.Drawing.Size(234, 93);
this.button1.TabIndex = 8;
this.button1.Text = "Menú";
this.button1.UseVisualStyleBackColor = false;
@@ -183,11 +215,11 @@
this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button2.Location = new System.Drawing.Point(3, 387);
- this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button2.Location = new System.Drawing.Point(2, 317);
+ this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button2.Name = "button2";
- this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button2.Size = new System.Drawing.Size(312, 114);
+ this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button2.Size = new System.Drawing.Size(234, 93);
this.button2.TabIndex = 9;
this.button2.Text = "Estadisticas";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -202,11 +234,11 @@
this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button3.Location = new System.Drawing.Point(3, 505);
- this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button3.Location = new System.Drawing.Point(2, 414);
+ this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button3.Name = "button3";
- this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button3.Size = new System.Drawing.Size(312, 114);
+ this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button3.Size = new System.Drawing.Size(234, 93);
this.button3.TabIndex = 10;
this.button3.Text = "Productos";
this.button3.UseVisualStyleBackColor = false;
@@ -220,11 +252,11 @@
this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button4.Image = global::compabetov2.Properties.Resources.reportesi;
this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button4.Location = new System.Drawing.Point(3, 623);
- this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button4.Location = new System.Drawing.Point(2, 511);
+ this.button4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button4.Name = "button4";
- this.button4.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button4.Size = new System.Drawing.Size(312, 114);
+ this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button4.Size = new System.Drawing.Size(234, 93);
this.button4.TabIndex = 11;
this.button4.Text = "Reportes";
this.button4.UseVisualStyleBackColor = false;
@@ -238,48 +270,48 @@
this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button5.Location = new System.Drawing.Point(3, 741);
- this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button5.Location = new System.Drawing.Point(2, 608);
+ this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button5.Name = "button5";
- this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button5.Size = new System.Drawing.Size(312, 114);
+ this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button5.Size = new System.Drawing.Size(234, 93);
this.button5.TabIndex = 12;
this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false;
//
// flowLayoutPanel3
//
- this.flowLayoutPanel3.Location = new System.Drawing.Point(325, 283);
- this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel3.Location = new System.Drawing.Point(244, 230);
+ this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
- this.flowLayoutPanel3.Size = new System.Drawing.Size(1273, 946);
+ this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 769);
this.flowLayoutPanel3.TabIndex = 14;
this.flowLayoutPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint);
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
- this.textBox1.Location = new System.Drawing.Point(365, 229);
- this.textBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.textBox1.Location = new System.Drawing.Point(274, 186);
+ this.textBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(399, 36);
+ this.textBox1.Size = new System.Drawing.Size(300, 30);
this.textBox1.TabIndex = 15;
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
- this.textBox2.Location = new System.Drawing.Point(792, 229);
- this.textBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.textBox2.Location = new System.Drawing.Point(594, 186);
+ this.textBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(399, 36);
+ this.textBox2.Size = new System.Drawing.Size(300, 30);
this.textBox2.TabIndex = 16;
//
// vender
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
- this.ClientSize = new System.Drawing.Size(1924, 750);
+ this.ClientSize = new System.Drawing.Size(1370, 609);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.flowLayoutPanel3);
@@ -287,12 +319,13 @@
this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1);
- this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "vender";
this.Text = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load);
this.flowLayoutPanel2.ResumeLayout(false);
+ this.flowLayoutPanel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit();
@@ -327,5 +360,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label labeltotal;
}
}
\ No newline at end of file
diff --git a/vender.cs b/vender.cs
index 6d12471..60b2bbc 100644
--- a/vender.cs
+++ b/vender.cs
@@ -13,6 +13,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
namespace compabetov2
{
@@ -26,7 +27,9 @@ namespace compabetov2
private bool menosBtnPresionado = false;
private List productos;
private List cartas = new List();
+ // private List
private decimal total = 0;
+ private Label ticketLabel;
@@ -49,16 +52,23 @@ namespace compabetov2
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 80F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 20F));
- carta.Width = 200;
+ carta.Width = 220;
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();
@@ -89,7 +99,7 @@ namespace compabetov2
contador.Text = "0";
contador.Dock = DockStyle.Fill;
contador.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- contador.Font = new Font(contador.Font.FontFamily, 30);
+ contador.Font = new Font(contador.Font.FontFamily, 25);
Button btnMenos = new Button();
btnMenos.Text = "-";
@@ -138,15 +148,15 @@ 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
- GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total);
+ //GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total);
}
else
{
@@ -155,9 +165,9 @@ namespace compabetov2
}
// Generar ticket y agregarlo al flowLayoutPanel2
- GenerarTicket(idProducto, producto.nombre, precioProducto, int.Parse(contador.Text), total);
+ GenerarTicket(idProducto, producto.nombre, producto.precion, int.Parse(contador.Text), total, rutaImg);
+
- // ... (código existente)
});
HUD.Controls.Add(btnMenos);
@@ -168,25 +178,97 @@ namespace compabetov2
carta.Controls.Add(HUD, 0, 1);
cartas.Add(carta);
flowLayoutPanel3.Controls.Add(carta);
+
+
}
-
-
-
+
+
+
+
}
- 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, string rutaImg)
{
- // 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;
+ bool existeProducto = false;
+ int contador_saltar_2_vueltas = 1;
+ foreach(var item in flowLayoutPanel2.Controls)
+ {
+ if(contador_saltar_2_vueltas <= 3)
+ {
+ contador_saltar_2_vueltas++;
+ continue;
- // Agregar el ticket al flowLayoutPanel2
- flowLayoutPanel2.Controls.Add(ticketLabel);
+ }
+ 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))
+ {
+ existeProducto=true;
+ Label Lbcantidad = panelInfo.Controls[0] as Label;
+ Label Lbtotal = panelInfo.Controls[0] 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;
+
+ Lbcantidad.Text = $"Cantidad: {NuevaCantiad}";
+ Lbtotal.Text = $"Total: ${NuevoTotal}";
+ }
+ }
+
+ if (!existeProducto)
+ {
+ TableLayoutPanel ticketProducto = new TableLayoutPanel();
+ ticketProducto.RowCount = 1;
+ ticketProducto.ColumnCount = 2;
+ ticketProducto.Height = 100;
+ ticketProducto.Width = 250;
+ ticketProducto.BackColor = Color.FromArgb(33, 90, 255);
+
+ PictureBox pic = new PictureBox();
+ pic.Dock = DockStyle.Fill;
+ pic.SizeMode = PictureBoxSizeMode.Zoom;
+ pic.Image = Image.FromFile(rutaImg);//hay error aquí
+ pic.BackgroundImageLayout = ImageLayout.Stretch;
+
+ TableLayoutPanel infoTicket = new TableLayoutPanel();
+ infoTicket.ColumnCount = 1;
+ infoTicket.RowCount = 4;
+ infoTicket.Dock = DockStyle.Fill;
+
+ Label lbNombre = new Label();
+ lbNombre.Dock = DockStyle.Fill;
+ lbNombre.Text = $"producto: {nombreProducto}";
+
+ Label lbPrecio = new Label();
+ lbPrecio.Dock = DockStyle.Fill;
+ lbPrecio.Text = $"Precio: ${precio}";
+
+ Label lbCantidad = new Label();
+ lbCantidad.Dock = DockStyle.Fill;
+ lbCantidad.Text = $"Cantidad: {cantidad}";
+
+ Label lbTotal = new Label();
+ lbTotal.Dock = DockStyle.Fill;
+ lbTotal.Text = $"Total: ${cantidad * precio}";
+
+ infoTicket.Controls.Add(lbNombre, 0, 0);
+ infoTicket.Controls.Add(lbPrecio, 0, 1);
+ infoTicket.Controls.Add(lbCantidad, 0, 2);
+ infoTicket.Controls.Add(lbTotal, 0, 3);
+
+ ticketProducto.Controls.Add(pic, 0, 0);
+ ticketProducto.Controls.Add(infoTicket, 1, 0);
+
+ // Agregar el ticket al flowLayoutPanel2
+ flowLayoutPanel2.Controls.Add(ticketProducto);
+ }
}
@@ -196,6 +278,7 @@ namespace compabetov2
+
private void getData()
{
this.productos = service.conseguirProductos();
@@ -243,6 +326,11 @@ namespace compabetov2
{
}
+
+ private void label1_Click(object sender, EventArgs e)
+ {
+
+ }
}
}