diff --git a/Ventas/vender.Designer.cs b/Ventas/vender.Designer.cs index d97a746..128351a 100644 --- a/Ventas/vender.Designer.cs +++ b/Ventas/vender.Designer.cs @@ -335,7 +335,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1300, 627); + this.ClientSize = new System.Drawing.Size(1370, 627); this.ControlBox = false; this.Controls.Add(this.btnEnviar); this.Controls.Add(this.btnFiar); diff --git a/Ventas/vender.cs b/Ventas/vender.cs index a0fc6a4..aadb28c 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -51,6 +51,7 @@ namespace compabetov2 private void llenarLayout() { + flowLayoutPanel3.Controls.Clear(); foreach (Producto producto in productos) { @@ -429,6 +430,8 @@ namespace compabetov2 if (service.crearVentaDAO(ventaModel, detalleVentas)) { MessageBox.Show("Venta hecha"); + eliminarProductosTocket(); + llenarLayout(); } } else @@ -614,6 +617,8 @@ namespace compabetov2 if (service.crearCuenta(ventaModel, detallesCuenta)) { MessageBox.Show("Fiado"); + eliminarProductosTocket(); + llenarLayout(); } } else @@ -725,6 +730,8 @@ namespace compabetov2 if (service.crearEnvio(envio, detallesEnvio)) { MessageBox.Show("Envio hecho"); + eliminarProductosTocket(); + llenarLayout(); } else { @@ -733,5 +740,15 @@ namespace compabetov2 } } + private void eliminarProductosTocket() + { + for (int i = flowLayoutPanel2.Controls.Count -1; i > 2; i--) + { + Control c = flowLayoutPanel2.Controls[i]; + c.Dispose(); + flowLayoutPanel1.Controls.Remove(c); + } + label1.Text = "Total: 0"; + } } } diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 733f4a9..644c22a 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index 134b235..6edea12 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/bin/Debug/data.db b/bin/Debug/data.db index 35c296f..a0eb90d 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/database/DAO.cs b/database/DAO.cs index df8c748..1d578fa 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -1431,7 +1431,7 @@ namespace compabetov2.database { try { - string sqlVenta = "INSERT INTO venta (fecha, total) VALUES(@fecha, @total);"; + string sqlVenta = "INSERT INTO venta (fecha, total,responzable) VALUES(@fecha, @total,@responzable);"; string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_producto, cantidad) VALUES(@idVenta, @idProducto, @cantidada);"; string sqlEnvio = "UPDATE envios SET estado ='CONCLUIDO' WHERE idEnvios = @idEnvios;"; string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1"; @@ -1440,6 +1440,7 @@ namespace compabetov2.database SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion); commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); commandVenta.Parameters.AddWithValue("@total", envio.total); + commandVenta.Parameters.AddWithValue("@responzable", envio.responsable); commandVenta.ExecuteNonQuery(); SQLiteCommand commandEnvio = new SQLiteCommand(sqlEnvio, conexion); diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 63d063b..fe63dfd 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 733f4a9..644c22a 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index 134b235..6edea12 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ