campos de precio de comrpa y venta agregados a las ventas

This commit is contained in:
carlos
2024-06-18 17:13:46 -06:00
parent 8ebdbf4f74
commit e489535f2f
11 changed files with 22 additions and 12 deletions
+3 -1
View File
@@ -752,7 +752,7 @@ namespace compabetov2.database
try
{
string sqlVenta = "INSERT INTO venta (fecha, total,responzable) VALUES(@fecha, @total,@responzable);";
string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_variante, cantidad) VALUES(@idVenta, @fk_variante, @cantidada);";
string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_variante, cantidad,precioCompra,precioVenta) VALUES(@idVenta, @fk_variante, @cantidada,@precioCompra,@precioVenta);";
string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1";
string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto";
string sqlProductoUpdate = "UPDATE Producto SET stock = @stock WHERE idproducto = @idproducto";
@@ -782,6 +782,8 @@ namespace compabetov2.database
commandEmpleado.Parameters.AddWithValue("@idVenta", idVenta);
commandEmpleado.Parameters.AddWithValue("@fk_variante", detalleVenta.producto.idVariante);
commandEmpleado.Parameters.AddWithValue("@cantidada", detalleVenta.cantidad);
commandEmpleado.Parameters.AddWithValue("@precioCompra", detalleVenta.producto.precioCompra);
commandEmpleado.Parameters.AddWithValue("@precioVenta", detalleVenta.producto.precio);
commandEmpleado.ExecuteNonQuery();
SQLiteCommand commandProdcutoStock = new SQLiteCommand(sqlProductoStock, conexion);