version de produccion, solucion de envios y cuentas. Agregado precio de compra en variantes y signos de pesos en registroVenta
This commit is contained in:
+5
-3
@@ -1056,7 +1056,7 @@ namespace compabetov2.database
|
||||
try
|
||||
{
|
||||
string sqlCuenta = "INSERT INTO cuenta (total, fecha, estado, descripcion,cliente) VALUES(@total, @fecha, 'ACTIVO', @descripcion,@cliente);";
|
||||
string sqlDetalle = "INSERT INTO detalle_cuenta (fk_cuenta, fk_variante, cantidad) VALUES(@fk_cuenta, @fk_variante, @cantidad);";
|
||||
string sqlDetalle = "INSERT INTO detalle_cuenta (fk_cuenta, fk_variante, cantidad, precioVenta, precioCompra) VALUES(@fk_cuenta, @fk_variante, @cantidad,@precioVenta,@precioCompra);";
|
||||
string sqlIdCuenta = "SELECT idCuenta FROM cuenta ORDER BY idCuenta DESC LIMIT 1";
|
||||
string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto";
|
||||
string sqlProductoUpdate = "UPDATE Producto SET stock = @stock WHERE idproducto = @idproducto";
|
||||
@@ -1084,6 +1084,8 @@ namespace compabetov2.database
|
||||
commandDetalle.Parameters.AddWithValue("@fk_cuenta", idCuenta);
|
||||
commandDetalle.Parameters.AddWithValue("@fk_variante", detalleCuenta.producto.idVariante);
|
||||
commandDetalle.Parameters.AddWithValue("@cantidad", detalleCuenta.cantidad);
|
||||
commandDetalle.Parameters.AddWithValue("@precioVenta", detalleCuenta.producto.precio);
|
||||
commandDetalle.Parameters.AddWithValue("@precioCompra", detalleCuenta.producto.precioCompra);
|
||||
commandDetalle.ExecuteNonQuery();
|
||||
|
||||
//modificar stock
|
||||
@@ -1145,7 +1147,7 @@ namespace compabetov2.database
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "Select v.idVariante , v.nombre ,v.cantidad ,v.fk_producto , dc.cantidad from detalle_cuenta dc, variantes v " +
|
||||
string sql = "Select v.idVariante , v.nombre ,v.cantidad ,v.fk_producto , dc.cantidad, dc.precioCompra , dc.precioVenta from detalle_cuenta dc, variantes v " +
|
||||
"WHERE dc.fk_variante = v.idVariante and dc.fk_cuenta = @fk_cuenta;";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@fk_cuenta", idCuenta);
|
||||
@@ -1525,7 +1527,7 @@ namespace compabetov2.database
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "Select v.idVariante, v.nombre, v.cantidad, v.fk_producto, de.cantidad from detalle_envios de,variantes v " +
|
||||
string sql = "Select v.idVariante, v.nombre, v.cantidad, v.fk_producto, de.cantidad,de.precioCompra , de.precioVenta from detalle_envios de,variantes v " +
|
||||
"WHERE de.fk_variante = v.idVariante and de.fk_envios = @fk_envios;";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@fk_envios", idEnvio);
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace compabetov2.database.modelos
|
||||
public int idCuenta;
|
||||
public Variante producto;
|
||||
public int cantidad;
|
||||
public string nombreProducto;
|
||||
public decimal total;
|
||||
|
||||
public DetalleCuentaModel(Variante producto, int cantidad, int idCuenta =-1, string nombreProducto = "")
|
||||
public DetalleCuentaModel(Variante producto, int cantidad, int idCuenta =-1, decimal total = 0)
|
||||
{
|
||||
this.idCuenta = idCuenta;
|
||||
this.producto = producto;
|
||||
this.cantidad = cantidad;
|
||||
this.nombreProducto = nombreProducto;
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -270,9 +270,10 @@ namespace compabetov2.database
|
||||
while (reader.Read())
|
||||
{
|
||||
int idVariaante = (int)reader.GetInt64(0);
|
||||
decimal precioCompra = reader.GetOrdinal("precioCompra");
|
||||
decimal precioCompra = reader.GetDecimal(5);
|
||||
decimal precio = reader.GetDecimal(6);
|
||||
DetalleCuentaModel detalleCuenta = new DetalleCuentaModel(
|
||||
new Variante(idVariaante, reader["nombre"].ToString(),0,(int)reader.GetInt64(2),"",(int)reader.GetInt64(3), precioCompra),
|
||||
new Variante(idVariaante, reader["nombre"].ToString(),precio,(int)reader.GetInt64(2),"",(int)reader.GetInt64(3), precioCompra),
|
||||
(int)reader.GetInt64(4)
|
||||
);
|
||||
detallesCuentas.Add(detalleCuenta);
|
||||
@@ -399,10 +400,11 @@ namespace compabetov2.database
|
||||
while (reader.Read())
|
||||
{
|
||||
int idVariante = (int)reader.GetInt64(0);
|
||||
decimal precioCompra = reader.GetOrdinal("precioCompra");
|
||||
decimal precioCompra = reader.GetDecimal(5);
|
||||
decimal precio = reader.GetDecimal(6);
|
||||
DetalleEnvioModel detalleEnvio = new DetalleEnvioModel(
|
||||
idEnvio,
|
||||
new Variante(idVariante, reader["nombre"].ToString(),0,(int)reader.GetInt64(2),"", (int)reader.GetInt64(3), precioCompra),//fkproducto
|
||||
new Variante(idVariante, reader["nombre"].ToString(),precio,(int)reader.GetInt64(2),"", (int)reader.GetInt64(3), precioCompra),//fkproducto
|
||||
(int)reader.GetInt64(4)//cantidad
|
||||
);
|
||||
detallesEnvio.Add(detalleEnvio);
|
||||
|
||||
Reference in New Issue
Block a user