venta envio lista y bug del stcok en vender arreglado

This commit is contained in:
carlos
2024-02-14 20:05:42 -06:00
parent 93d7aef100
commit c2008264f2
12 changed files with 66 additions and 68 deletions
+7 -43
View File
@@ -675,7 +675,7 @@ namespace compabetov2
return resultado;
}
private void button7_Click(object sender, EventArgs e)
/*private void button7_Click(object sender, EventArgs e)
{
List<DetalleVentaModel> detalleVentas = listaProductosVenta();
if (detalleVentas.Count > 0)
@@ -731,7 +731,7 @@ namespace compabetov2
}
return detalleVentas;
}
}*/
private void button6_Click(object sender, EventArgs e)
{
@@ -836,49 +836,13 @@ namespace compabetov2
}
}
private List<DetalleEnvioModel> listaProductosEnvio()
{
List<DetalleEnvioModel> detallesEnvio = new List<DetalleEnvioModel>();
int contador_saltar_2_vueltas = 1;
foreach (var item in flowLayoutPanel2.Controls)
{
if (contador_saltar_2_vueltas <= 3)
{
contador_saltar_2_vueltas++;
continue;
}
TableLayoutPanel panelProducto = item as TableLayoutPanel;
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
PictureBox pic = panelProducto.Controls[0] as PictureBox;
Label idLabel = null;
foreach (Control control in pic.Controls)
{
if (control is Label)
{
idLabel = (Label)control;
break;
}
}
int idProducto = int.Parse(idLabel.Text);
Producto producto = new Producto(idProducto);
Label Lbcantidad = panelInfo.Controls[2] as Label;
string textcantidad = Lbcantidad.Text;
string[] cantidadCadenas = textcantidad.Split(' ');
int cantidad = int.Parse(cantidadCadenas[1]);
DetalleEnvioModel detalleEnvio = new DetalleEnvioModel(-1, producto, cantidad);
detallesEnvio.Add(detalleEnvio);
}
return detallesEnvio;
}
private void btnEnviar_Click(object sender, EventArgs e)
{
List<DetalleEnvioModel> detallesEnvio = listaProductosEnvio();
List<DetalleEnvioModel> detallesEnvio = new List<DetalleEnvioModel>();
foreach(DetalleVentaModel detalleVenta in carrito)
{
detallesEnvio.Add(detalleVenta.convertirADetalleEnvio());
}
string responsable = responsablecb.Text.Equals("") ? loginPrincipal.usuario : responsablecb.Text;
Envio envio = new Envio(-1, DateTime.Now.ToString(), "", "", responsable, "", "", total);
if (detallesEnvio.Count > 0)