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:
Michael Robles
2024-07-02 15:05:34 -07:00
parent de494fc86d
commit 621c80a3b2
10 changed files with 22 additions and 13 deletions
+7 -2
View File
@@ -63,7 +63,7 @@ namespace compabetov2
lbResponzable.Width = 700; lbResponzable.Width = 700;
Label lbTotal = new Label(); Label lbTotal = new Label();
lbTotal.Text = $"Total: {venta.total}"; lbTotal.Text = $"Total: ${venta.total}";
lbTotal.Font = new Font(lbTotal.Font.FontFamily, 16); lbTotal.Font = new Font(lbTotal.Font.FontFamily, 16);
lbTotal.Width = 700; lbTotal.Width = 700;
@@ -91,7 +91,12 @@ namespace compabetov2
{ {
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
} }
mensaje += $"Total: {venta.total}"; decimal totalImporte = 0;
foreach (DetalleImporte importe in ventaYDetalles["importes"]) {
totalImporte += importe.cantidad * importe.precioImporte;
}
mensaje += $"Importe: ${totalImporte}\n";
mensaje += $"Total: ${venta.total}";
MessageBox.Show(mensaje); MessageBox.Show(mensaje);
}); });
+1 -1
View File
@@ -70,7 +70,7 @@ namespace compabetov2.admin
Label nombreStock = new Label(); Label nombreStock = new Label();
nombreStock.Text = variante.nombre + " - $" + variante.precio; nombreStock.Text = variante.nombre + " - $" + variante.precio + $"\nPrecio de compra: ${variante.precioCompra}";
nombreStock.Font = new Font(nombreStock.Font.FontFamily, 14); nombreStock.Font = new Font(nombreStock.Font.FontFamily, 14);
nombreStock.Dock = DockStyle.Fill; nombreStock.Dock = DockStyle.Fill;
nombreStock.TextAlign = ContentAlignment.MiddleCenter; nombreStock.TextAlign = ContentAlignment.MiddleCenter;
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+5 -3
View File
@@ -1056,7 +1056,7 @@ namespace compabetov2.database
try try
{ {
string sqlCuenta = "INSERT INTO cuenta (total, fecha, estado, descripcion,cliente) VALUES(@total, @fecha, 'ACTIVO', @descripcion,@cliente);"; 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 sqlIdCuenta = "SELECT idCuenta FROM cuenta ORDER BY idCuenta DESC LIMIT 1";
string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto"; string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto";
string sqlProductoUpdate = "UPDATE Producto SET stock = @stock 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_cuenta", idCuenta);
commandDetalle.Parameters.AddWithValue("@fk_variante", detalleCuenta.producto.idVariante); commandDetalle.Parameters.AddWithValue("@fk_variante", detalleCuenta.producto.idVariante);
commandDetalle.Parameters.AddWithValue("@cantidad", detalleCuenta.cantidad); commandDetalle.Parameters.AddWithValue("@cantidad", detalleCuenta.cantidad);
commandDetalle.Parameters.AddWithValue("@precioVenta", detalleCuenta.producto.precio);
commandDetalle.Parameters.AddWithValue("@precioCompra", detalleCuenta.producto.precioCompra);
commandDetalle.ExecuteNonQuery(); commandDetalle.ExecuteNonQuery();
//modificar stock //modificar stock
@@ -1145,7 +1147,7 @@ namespace compabetov2.database
conexion.Open(); 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;"; "WHERE dc.fk_variante = v.idVariante and dc.fk_cuenta = @fk_cuenta;";
SQLiteCommand command = new SQLiteCommand(sql, conexion); SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_cuenta", idCuenta); command.Parameters.AddWithValue("@fk_cuenta", idCuenta);
@@ -1525,7 +1527,7 @@ namespace compabetov2.database
conexion.Open(); 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;"; "WHERE de.fk_variante = v.idVariante and de.fk_envios = @fk_envios;";
SQLiteCommand command = new SQLiteCommand(sql, conexion); SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_envios", idEnvio); command.Parameters.AddWithValue("@fk_envios", idEnvio);
+3 -3
View File
@@ -11,14 +11,14 @@ namespace compabetov2.database.modelos
public int idCuenta; public int idCuenta;
public Variante producto; public Variante producto;
public int cantidad; 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.idCuenta = idCuenta;
this.producto = producto; this.producto = producto;
this.cantidad = cantidad; this.cantidad = cantidad;
this.nombreProducto = nombreProducto; this.total = total;
} }
} }
} }
+6 -4
View File
@@ -270,9 +270,10 @@ namespace compabetov2.database
while (reader.Read()) while (reader.Read())
{ {
int idVariaante = (int)reader.GetInt64(0); 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( 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) (int)reader.GetInt64(4)
); );
detallesCuentas.Add(detalleCuenta); detallesCuentas.Add(detalleCuenta);
@@ -399,10 +400,11 @@ namespace compabetov2.database
while (reader.Read()) while (reader.Read())
{ {
int idVariante = (int)reader.GetInt64(0); 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( DetalleEnvioModel detalleEnvio = new DetalleEnvioModel(
idEnvio, 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 (int)reader.GetInt64(4)//cantidad
); );
detallesEnvio.Add(detalleEnvio); detallesEnvio.Add(detalleEnvio);
Binary file not shown.
Binary file not shown.