diff --git a/.vs/compabetoOG/v17/.wsuo b/.vs/compabetoOG/v17/.wsuo index 0c5db0d..0bc8be2 100644 Binary files a/.vs/compabetoOG/v17/.wsuo and b/.vs/compabetoOG/v17/.wsuo differ diff --git a/Ventas/vender.cs b/Ventas/vender.cs index 90fa72f..d7f3120 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -26,7 +26,6 @@ namespace compabetov2 { private int numeroPagina = 1; // Variable para rastrear el número de página actual private Point lastPoint; - private Point lastAutoScrollPosition; private List productos; public decimal total = 0; private LoginModel loginPrincipal; @@ -48,6 +47,9 @@ namespace compabetov2 private void InitializeFlowLayout() { + + flowLayoutPanel3.AutoScroll = true; + // Inicializar el flowLayoutPanel3 (asegúrate de que ya está creado en tu formulario) // Habilitar eventos táctiles simulados @@ -59,7 +61,7 @@ namespace compabetov2 private void FlowLayoutPanel3_MouseDown(object sender, MouseEventArgs e) { lastPoint = new Point(e.X, e.Y); - flowLayoutPanel3.Capture = false; + flowLayoutPanel3.Capture = true; } private void FlowLayoutPanel3_MouseMove(object sender, MouseEventArgs e) @@ -70,7 +72,11 @@ namespace compabetov2 int deltaY = lastPoint.Y - e.Y; // Ajustar la dirección del desplazamiento - flowLayoutPanel3.AutoScrollPosition = new Point(flowLayoutPanel3.AutoScrollPosition.X + deltaX, flowLayoutPanel3.AutoScrollPosition.Y - deltaY); + Point scrollPosition = flowLayoutPanel3.AutoScrollPosition; + scrollPosition.Offset(deltaX, deltaY); + + // Ajustar la posición de desplazamiento + flowLayoutPanel3.AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y); lastPoint = new Point(e.X, e.Y); } @@ -79,8 +85,7 @@ namespace compabetov2 private void FlowLayoutPanel3_MouseUp(object sender, MouseEventArgs e) { - lastPoint = new Point(e.X, e.Y); - flowLayoutPanel3.Capture =false; + flowLayoutPanel3.Capture = false; } @@ -137,7 +142,7 @@ namespace compabetov2 pic.Controls.Add(id); Label precio = new Label(); - precio.Text = "$" + producto.precio.ToString() + " - " + producto.nombre; + precio.Text = "$" + producto.precioCompra.ToString() + " - " + producto.nombre; precio.BackColor = Color.FromArgb(82, 82, 82); precio.ForeColor = Color.White; precio.Width = 40; @@ -170,6 +175,10 @@ namespace compabetov2 btnMenos.BackColor = Color.FromArgb(33, 90, 255); btnMenos.Click += new EventHandler(delegate (object sender, EventArgs e) { + flowLayoutPanel3.MouseMove -= FlowLayoutPanel3_MouseMove; // Desactivar el evento MouseMove temporalmente + + Point scrollPosition = flowLayoutPanel3.AutoScrollPosition; // Guardar posición de scroll actual + int numeroContador = int.Parse(contador.Text.ToString()); @@ -196,7 +205,11 @@ namespace compabetov2 { MessageBox.Show("No puedes vender menos de 0 cosas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - }); + + flowLayoutPanel3.AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y); // Restaurar posición de scroll + flowLayoutPanel3.MouseMove += FlowLayoutPanel3_MouseMove; // Reactivar el evento MouseMove + + }); @@ -213,6 +226,11 @@ namespace compabetov2 btnMas.FlatAppearance.BorderSize = 0; btnMas.Click += new EventHandler(delegate (object sender, EventArgs e) { + + + flowLayoutPanel3.MouseMove -= FlowLayoutPanel3_MouseMove; // Desactivar el evento MouseMove temporalmente + + Point scrollPosition = flowLayoutPanel3.AutoScrollPosition; // Guardar posición de scroll actual if (int.Parse(contador.Text.ToString()) < 0 && !existeTocket(producto.nombre)) { contador.Text = "0"; @@ -237,6 +255,10 @@ namespace compabetov2 } GenerarTicket(idProducto, producto.nombre, producto.precio, int.Parse(contador.Text), total, Path.Combine(Application.StartupPath, "Resources", producto.img)); + + flowLayoutPanel3.AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y); // Restaurar posición de scroll + flowLayoutPanel3.MouseMove += FlowLayoutPanel3_MouseMove; // Reactivar el evento MouseMove + }); HUD.Controls.Add(btnMenos); diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 88751ea..dd99c03 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 c977b04..6ef41be 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/database/service.cs b/database/service.cs index f017c84..4aab680 100644 --- a/database/service.cs +++ b/database/service.cs @@ -512,7 +512,8 @@ namespace compabetov2.database int cantidadIndex = reader.GetOrdinal("cantidad"); int imgIndex = reader.GetOrdinal("img"); int fkProductoIndex = reader.GetOrdinal("fk_producto"); - decimal precioCompra = reader.GetOrdinal("precioCompra"); + int precioCompraIndex = reader.GetOrdinal("precioCompra"); + while (reader.Read()) { @@ -524,7 +525,7 @@ namespace compabetov2.database reader.GetInt32(cantidadIndex), reader.GetString(imgIndex), reader.GetInt32(fkProductoIndex), - precioCompra + reader.GetDecimal(precioCompraIndex) ); productos.Add(producto); diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 10a1a65..4382aa9 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt index 30ee1d3..be904cf 100644 --- a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt +++ b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt @@ -180,3 +180,5 @@ C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.a C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.RegistroVentas.resources C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.Importe.resources C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.Importe1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.AgregarImporte.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.visualizarImportes.resources diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 88751ea..dd99c03 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 c977b04..6ef41be 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ