Cada vez más cercas del fippp
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
{
|
||||
"ExpandedNodes": [
|
||||
"",
|
||||
"\\database",
|
||||
"\\database\\modelos"
|
||||
""
|
||||
],
|
||||
"SelectedNode": "\\.sln",
|
||||
"PreviewInSolutionExplorer": false
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
424f6d4f8bcbc47e89c98d2fa689cb77dffd9f6b5116717e9e8dca5ece3777d7
|
||||
c1cf5d87017027705d6c2ec0d3ad2a8c7ff08f19
|
||||
|
||||
@@ -58,3 +58,33 @@ C:\Users\carsu\Source\Repos\compabetoOG\bin\Debug\compabetov2.application
|
||||
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.exe.manifest
|
||||
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.application
|
||||
C:\Users\Googl\Documents\compabetov2\obj\Debug\compabetov2.envios.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\compabetov2.exe.config
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\compabetov2.exe.manifest
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\compabetov2.application
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\compabetov2.exe
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\compabetov2.pdb
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\EntityFramework.dll
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\EntityFramework.SqlServer.dll
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\System.Data.SQLite.dll
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\System.Data.SQLite.EF6.dll
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\System.Data.SQLite.Linq.dll
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\EntityFramework.xml
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\EntityFramework.SqlServer.xml
|
||||
C:\Users\Googl\Documents\compabetoOG\bin\Debug\System.Data.SQLite.xml
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.csproj.AssemblyReference.cache
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.cuentas.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.envios.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.inventario.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.login.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.MenuPrincipal.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.mermas.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.personal.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Properties.Resources.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.vender.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.csproj.GenerateResource.cache
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.exe.manifest
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.application
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.csproj.CopyComplete
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.exe
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.pdb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -120,11 +120,18 @@ namespace compabetov2
|
||||
{
|
||||
contador.Text = (numeroContador - 1).ToString();
|
||||
total -= producto.precion;
|
||||
|
||||
// Obtener información del Label id y precio
|
||||
int idProducto = int.Parse(id.Text);
|
||||
decimal precioProducto = producto.precion;
|
||||
|
||||
// Restar al ticket existente si ya se agregó
|
||||
RestarDelTicket(idProducto, producto.nombre, precioProducto, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mostrar mensaje de advertencia
|
||||
MessageBox.Show("No puedes vender cosas negativas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show("No puedes vender menos de 0 cosas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -190,6 +197,55 @@ namespace compabetov2
|
||||
|
||||
}
|
||||
|
||||
private void RestarDelTicket(int idProducto, string nombreProducto, decimal precio, int cantidad)
|
||||
{
|
||||
foreach (var item in flowLayoutPanel2.Controls)
|
||||
{
|
||||
TableLayoutPanel panelProducto = item as TableLayoutPanel;
|
||||
if (panelProducto != null && panelProducto.Controls.Count > 1)
|
||||
{
|
||||
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
|
||||
if (panelInfo != null && panelInfo.Controls.Count > 2)
|
||||
{
|
||||
Label lbnombre = panelInfo.Controls[0] as Label;
|
||||
if (lbnombre != null)
|
||||
{
|
||||
string textoLb = lbnombre.Text;
|
||||
string[] cadenas = textoLb.Split(':');
|
||||
string cadena = cadenas[1].Remove(0, 1);
|
||||
|
||||
if (cadena.Equals(nombreProducto))
|
||||
{
|
||||
Label Lbcantidad = panelInfo.Controls[2] as Label;
|
||||
Label Lbtotal = panelInfo.Controls[3] as Label;
|
||||
|
||||
if (Lbcantidad != null && Lbtotal != null)
|
||||
{
|
||||
string textcantidad = Lbcantidad.Text;
|
||||
string[] cantidadCadenas = textcantidad.Split(' ');
|
||||
int NuevaCantiad = int.Parse(cantidadCadenas[1]) - cantidad;
|
||||
|
||||
int NuevoTotal = (int)(NuevaCantiad * precio);
|
||||
|
||||
// Actualizar el ticket existente
|
||||
Lbcantidad.Text = $"Cantidad: {NuevaCantiad}";
|
||||
Lbtotal.Text = $"Total: ${NuevoTotal}";
|
||||
|
||||
// Si la cantidad llega a 0, eliminar el ticket del flowLayoutPanel2
|
||||
if (NuevaCantiad == 0)
|
||||
{
|
||||
flowLayoutPanel2.Controls.Remove(panelProducto);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void GenerarTicket(int idProducto, string nombreProducto, decimal precio, int cantidad, decimal total, string rutaImg)
|
||||
{
|
||||
bool existeProducto = false;
|
||||
|
||||
Reference in New Issue
Block a user