diff --git a/.vs/compabetov2.csproj.dtbcache.json b/.vs/compabetov2.csproj.dtbcache.json
index 10c629f..bfa86c2 100644
--- a/.vs/compabetov2.csproj.dtbcache.json
+++ b/.vs/compabetov2.csproj.dtbcache.json
@@ -1 +1 @@
-{"RootPath":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG","ProjectFileName":"compabetov2.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"AgregarEmpleado.cs"},{"SourceFile":"AgregarEmpleado.Designer.cs"},{"SourceFile":"AgregarLogin.cs"},{"SourceFile":"AgregarLogin.Designer.cs"},{"SourceFile":"cuentas.cs"},{"SourceFile":"cuentas.Designer.cs"},{"SourceFile":"database\\conexion.cs"},{"SourceFile":"database\\DAO.cs"},{"SourceFile":"database\\modelos\\Categoria.cs"},{"SourceFile":"database\\modelos\\Cliente.cs"},{"SourceFile":"database\\modelos\\Empleado.cs"},{"SourceFile":"database\\modelos\\LoginModel.cs"},{"SourceFile":"database\\modelos\\Producto.cs"},{"SourceFile":"database\\modelos\\usuario.cs"},{"SourceFile":"database\\service.cs"},{"SourceFile":"EditarEmpleado.cs"},{"SourceFile":"EditarEmpleado.Designer.cs"},{"SourceFile":"envios.cs"},{"SourceFile":"envios.Designer.cs"},{"SourceFile":"inventario.cs"},{"SourceFile":"inventario.Designer.cs"},{"SourceFile":"login.cs"},{"SourceFile":"login.Designer.cs"},{"SourceFile":"MenuPrincipal.cs"},{"SourceFile":"MenuPrincipal.Designer.cs"},{"SourceFile":"mermas.cs"},{"SourceFile":"mermas.Designer.cs"},{"SourceFile":"ModificarContra.cs"},{"SourceFile":"ModificarContra.Designer.cs"},{"SourceFile":"personal.cs"},{"SourceFile":"personal.Designer.cs"},{"SourceFile":"preguntaLogin.cs"},{"SourceFile":"preguntaLogin.Designer.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"vender.cs"},{"SourceFile":"vender.Designer.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\packages\\EntityFramework.6.4.4\\lib\\net45\\EntityFramework.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\packages\\EntityFramework.6.4.4\\lib\\net45\\EntityFramework.SqlServer.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.ComponentModel.DataAnnotations.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\packages\\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\\lib\\net46\\System.Data.SQLite.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\packages\\System.Data.SQLite.EF6.1.0.118.0\\lib\\net46\\System.Data.SQLite.EF6.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\packages\\System.Data.SQLite.Linq.1.0.118.0\\lib\\net46\\System.Data.SQLite.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\bin\\Debug\\compabetov2.exe","OutputItemRelativePath":"compabetov2.exe"},{"OutputItemFullPath":"C:\\Users\\carsu\\Source\\Repos\\compabetoOG\\bin\\Debug\\compabetov2.pdb","OutputItemRelativePath":"compabetov2.pdb"}],"CopyToOutputEntries":[]}
\ No newline at end of file
+{"RootPath":"C:\\Users\\carsu\\source\\repos\\compabetoOG","ProjectFileName":"compabetov2.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"ActualizarMerma.cs"},{"SourceFile":"ActualizarMerma.Designer.cs"},{"SourceFile":"AgregarEmpleado.cs"},{"SourceFile":"AgregarEmpleado.Designer.cs"},{"SourceFile":"AgregarLogin.cs"},{"SourceFile":"AgregarLogin.Designer.cs"},{"SourceFile":"agregarmermas.cs"},{"SourceFile":"agregarmermas.Designer.cs"},{"SourceFile":"cuentas.cs"},{"SourceFile":"cuentas.Designer.cs"},{"SourceFile":"database\\conexion.cs"},{"SourceFile":"database\\DAO.cs"},{"SourceFile":"database\\modelos\\Categoria.cs"},{"SourceFile":"database\\modelos\\Cliente.cs"},{"SourceFile":"database\\modelos\\DetalleVentaModel.cs"},{"SourceFile":"database\\modelos\\Empleado.cs"},{"SourceFile":"database\\modelos\\LoginModel.cs"},{"SourceFile":"database\\modelos\\Merma.cs"},{"SourceFile":"database\\modelos\\Producto.cs"},{"SourceFile":"database\\modelos\\usuario.cs"},{"SourceFile":"database\\modelos\\VentaModel.cs"},{"SourceFile":"database\\service.cs"},{"SourceFile":"EditarEmpleado.cs"},{"SourceFile":"EditarEmpleado.Designer.cs"},{"SourceFile":"envios.cs"},{"SourceFile":"envios.Designer.cs"},{"SourceFile":"inventario.cs"},{"SourceFile":"inventario.Designer.cs"},{"SourceFile":"login.cs"},{"SourceFile":"login.Designer.cs"},{"SourceFile":"MenuPrincipal.cs"},{"SourceFile":"MenuPrincipal.Designer.cs"},{"SourceFile":"mermas.cs"},{"SourceFile":"mermas.Designer.cs"},{"SourceFile":"ModificarContra.cs"},{"SourceFile":"ModificarContra.Designer.cs"},{"SourceFile":"personal.cs"},{"SourceFile":"personal.Designer.cs"},{"SourceFile":"preguntaLogin.cs"},{"SourceFile":"preguntaLogin.Designer.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"vender.cs"},{"SourceFile":"vender.Designer.cs"},{"SourceFile":"verMerma.cs"},{"SourceFile":"verMerma.Designer.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\packages\\EntityFramework.6.4.4\\lib\\net45\\EntityFramework.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\packages\\EntityFramework.6.4.4\\lib\\net45\\EntityFramework.SqlServer.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.ComponentModel.DataAnnotations.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\packages\\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\\lib\\net46\\System.Data.SQLite.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\packages\\System.Data.SQLite.EF6.1.0.118.0\\lib\\net46\\System.Data.SQLite.EF6.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\packages\\System.Data.SQLite.Linq.1.0.118.0\\lib\\net46\\System.Data.SQLite.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\bin\\Debug\\compabetov2.exe","OutputItemRelativePath":"compabetov2.exe"},{"OutputItemFullPath":"C:\\Users\\carsu\\source\\repos\\compabetoOG\\bin\\Debug\\compabetov2.pdb","OutputItemRelativePath":"compabetov2.pdb"}],"CopyToOutputEntries":[]}
\ No newline at end of file
diff --git a/bin/Debug/data.db b/bin/Debug/data.db
index ce082d9..20455e2 100644
Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ
diff --git a/compabetov2.csproj b/compabetov2.csproj
index fbb5e8d..89da5a8 100644
--- a/compabetov2.csproj
+++ b/compabetov2.csproj
@@ -137,6 +137,8 @@
+
+
diff --git a/database/DAO.cs b/database/DAO.cs
index d9fa8b1..48660a3 100644
--- a/database/DAO.cs
+++ b/database/DAO.cs
@@ -905,6 +905,90 @@ namespace compabetov2.database
}
}
+ public static SQLiteDataReader conseguirCuentaDAO()
+ {
+ SQLiteDataReader reader = null;
+ var db_conexion = new Conexion();
+ try
+ {
+ SQLiteConnection conexion = db_conexion.get_connection();
+
+ conexion.Open();
+
+ string sql = "SELECT * FROM cuenta";
+ SQLiteCommand command = new SQLiteCommand(sql, conexion);
+ reader = command.ExecuteReader();
+
+ return reader;
+
+ }
+ catch (SQLiteException ex)
+ {
+ MessageBox.Show(ex.Message);
+ return reader;
+ }
+ }
+
+ public static bool crearCuentaDAO(Cuenta cuenta, List detalleCuentas)
+ {
+ var db_conexion = new Conexion();
+ try
+ {
+ using (SQLiteConnection conexion = db_conexion.get_connection())
+ {
+ conexion.Open();
+
+ using (var transaccion = conexion.BeginTransaction())
+ {
+ try
+ {
+ string sqlCuenta = "INSERT INTO cuenta (total, fecha, estado, descripcion) VALUES(@total, @fecha, 'ACTIVO', @descripcion);";
+ string sqlDetalle = "INSERT INTO detalle_cuenta (fk_cuenta, fk_producto, cantidad) VALUES(@fk_cuenta, @fk_producto, @cantidad);";
+ string sqlIdCuenta = "SELECT idCuenta FROM cuenta ORDER BY idCuenta DESC LIMIT 1";
+
+ SQLiteCommand commandCuenta = new SQLiteCommand(sqlCuenta, conexion);
+ commandCuenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
+ commandCuenta.Parameters.AddWithValue("@total", cuenta.total);
+ commandCuenta.Parameters.AddWithValue("@descripcion", cuenta.descripcion);
+ commandCuenta.ExecuteNonQuery();
+
+ SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdCuenta, conexion);
+ SQLiteDataReader reader = commandConsulta.ExecuteReader();
+
+ long idCuenta = -1;
+ while (reader.Read())
+ {
+ idCuenta = reader.GetInt64(0);
+ }
+
+ foreach (DetalleCuentaModel detalleCuenta in detalleCuentas)
+ {
+ SQLiteCommand commandDetalle = new SQLiteCommand(sqlDetalle, conexion);
+ commandDetalle.Parameters.AddWithValue("@fk_cuenta", idCuenta);
+ commandDetalle.Parameters.AddWithValue("@fk_producto", detalleCuenta.producto.idProducto);
+ commandDetalle.Parameters.AddWithValue("@cantidad", detalleCuenta.cantidad);
+ commandDetalle.ExecuteNonQuery();
+ }
+
+ transaccion.Commit();
+ return true;
+ }
+ catch (SQLiteException ex)
+ {
+ transaccion.Rollback();
+ MessageBox.Show(ex.Message);
+ return false;
+ }
+ }
+ }
+ }
+ catch (SQLiteException ex)
+ {
+ MessageBox.Show(ex.Message);
+ return false;
+ }
+ }
+
private static void crearDB()
{
@@ -923,6 +1007,8 @@ namespace compabetov2.database
"DROP TABLE IF EXISTS Cliente",
"DROP TABLE IF EXISTS Merma",
"DROP TABLE IF EXISTS venta",
+ "DROP TABLE IF EXISTS detalle_cuenta",
+ "DROP TABLE IF EXISTS cuenta",
"CREATE TABLE Login (idlogin INTEGER PRIMARY KEY AUTOINCREMENT, tipo TEXT NOT NULL, usuario TEXT NOT NULL, "+
"contra TEXT NOT NULL)",
@@ -949,6 +1035,11 @@ namespace compabetov2.database
"CREATE TABLE detalle_venta (fk_venta INTEGER, fk_producto INTEGER, PRIMARY KEY (fk_venta, fk_producto), " +
"FOREIGN KEY (fk_venta) REFERENCES venta(idVenta),FOREIGN KEY (fk_producto) REFERENCES producto(idproducto));",
+ "CREATE TABLE cuenta (idCuenta INTEGER PRIMARY KEY AUTOINCREMENT, total DECIMAL(10,2), fecha TEXT, estado TEXT DEFAULT 'ACTIVO', descripcion TEXT)",
+
+ "CREATE TABLE detalle_cuenta (fk_cuenta INTEGER, fk_producto INTEGER,cantidad INTEGER, PRIMARY KEY (fk_cuenta, fk_producto), " +
+ "FOREIGN KEY (fk_cuenta) REFERENCES Cuenta(idCuenta),FOREIGN KEY (fk_producto) REFERENCES producto(idproducto))",
+
"INSERT INTO Login ( tipo, usuario, contra) VALUES('admin', 'admin', '12345');",
"INSERT INTO Empleado ( nombre, apellidos, calle, fecha_contratacion,estado, colonia, cp, no_ext,no_int, referencia, fecha_nac, telefono,fk_idLogin) VALUES('jefe', '', '', '', '', '', '', '', '', '', '', '',1);",
diff --git a/database/modelos/Cuenta.cs b/database/modelos/Cuenta.cs
new file mode 100644
index 0000000..f227430
--- /dev/null
+++ b/database/modelos/Cuenta.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace compabetov2.database.modelos
+{
+ public class Cuenta
+ {
+ public int id;
+ public decimal total;
+ public string fecha;
+ public string estado;
+ public string descripcion;
+
+ public Cuenta(decimal total = 0, string fecha = "", string estado = "", string descripcion = "", int id = -1) {
+ this.id = id;
+ this.total = total;
+ this.fecha = fecha;
+ this.estado = estado;
+ this.descripcion = descripcion;
+ }
+ }
+}
diff --git a/database/modelos/DetalleCuentaModel.cs b/database/modelos/DetalleCuentaModel.cs
new file mode 100644
index 0000000..56ea834
--- /dev/null
+++ b/database/modelos/DetalleCuentaModel.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace compabetov2.database.modelos
+{
+ public class DetalleCuentaModel
+ {
+ public int idCuenta;
+ public Producto producto;
+ public int cantidad;
+
+
+ public DetalleCuentaModel(Producto producto, int cantidad, int idCuenta =-1)
+ {
+ this.idCuenta = idCuenta;
+ this.producto = producto;
+ this.cantidad = cantidad;
+ }
+ }
+}
diff --git a/database/service.cs b/database/service.cs
index eeaa496..e4f0f6b 100644
--- a/database/service.cs
+++ b/database/service.cs
@@ -222,5 +222,35 @@ namespace compabetov2.database
{
return DAO.actualizarMermaDAO(merma);
}
+
+ public static bool crearCuenta(Cuenta cuenta, List detalleCuentas)
+ {
+ return DAO.crearCuentaDAO(cuenta, detalleCuentas);
+ }
+
+ public static List conseguirCuentaDAO()
+ {
+ List cuentas = new List();
+ SQLiteDataReader reader = DAO.conseguirCuentaDAO();
+
+ while(reader.Read())
+ {
+ long idCuenta = reader.GetInt64(0);
+ long total = reader.GetInt64(1);
+ string fecha = reader["fecha"].ToString();
+ string estado = reader["estado"].ToString();
+ string descripcion = reader["descripcion"].ToString();
+
+ Cuenta cuenta = new Cuenta(
+ (int) total,
+ fecha,
+ estado,
+ descripcion,
+ (int)idCuenta
+ );
+ cuentas.Add(cuenta);
+ }
+ return cuentas;
+ }
}
}
diff --git a/inventario.cs b/inventario.cs
index bda4366..cbc0a7a 100644
--- a/inventario.cs
+++ b/inventario.cs
@@ -157,6 +157,7 @@ namespace compabetov2
// Cerrar el formulario de ventas
this.Close();
+
// Verificar si ya hay una instancia del formulario principal
MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault();
@@ -177,6 +178,7 @@ namespace compabetov2
menuprincipalForm.BringToFront();
}
+
}
private void button6_Click(object sender, EventArgs e)
diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache
index ed74861..5093a0c 100644
Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ
diff --git a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache
index 43969d6..65eac95 100644
--- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache
+++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-695db7c462a1bf4a0ef5990fcb38d3c5e4635ed46c5dd09022ca189de9b89e5b
+7e9c2d0de4eef50d120601b2201dac9006ebfce8743c5966fa432f0fa3a615be
diff --git a/vender.Designer.cs b/vender.Designer.cs
index 5848136..407a812 100644
--- a/vender.Designer.cs
+++ b/vender.Designer.cs
@@ -51,6 +51,7 @@
this.textBox2 = new System.Windows.Forms.TextBox();
this.bntImprimir = new System.Windows.Forms.Button();
this.responsablecb = new System.Windows.Forms.ComboBox();
+ this.btnFiar = new System.Windows.Forms.Button();
this.flowLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
@@ -69,9 +70,10 @@
this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy;
- this.lblfecha.Location = new System.Drawing.Point(493, 105);
+ this.lblfecha.Location = new System.Drawing.Point(370, 85);
+ this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblfecha.Name = "lblfecha";
- this.lblfecha.Size = new System.Drawing.Size(159, 58);
+ this.lblfecha.Size = new System.Drawing.Size(126, 46);
this.lblfecha.TabIndex = 13;
this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -82,9 +84,10 @@
this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue;
- this.lblhora.Location = new System.Drawing.Point(681, -14);
+ this.lblhora.Location = new System.Drawing.Point(511, -11);
+ this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhora.Name = "lblhora";
- this.lblhora.Size = new System.Drawing.Size(318, 113);
+ this.lblhora.Size = new System.Drawing.Size(249, 91);
this.lblhora.TabIndex = 12;
this.lblhora.Text = "label1";
this.lblhora.Click += new System.EventHandler(this.lblhora_Click);
@@ -95,10 +98,10 @@
this.flowLayoutPanel2.Controls.Add(this.panel1);
this.flowLayoutPanel2.Controls.Add(this.label1);
this.flowLayoutPanel2.Controls.Add(this.labeltotal);
- this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1);
- this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1);
+ this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
- this.flowLayoutPanel2.Size = new System.Drawing.Size(324, 1191);
+ this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968);
this.flowLayoutPanel2.TabIndex = 11;
this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint);
//
@@ -106,17 +109,17 @@
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.pictureBox9);
- this.panel1.Location = new System.Drawing.Point(3, 2);
- this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panel1.Location = new System.Drawing.Point(2, 2);
+ this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(312, 263);
+ this.panel1.Size = new System.Drawing.Size(234, 214);
this.panel1.TabIndex = 8;
//
// pictureBox9
//
this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu;
- this.pictureBox9.Location = new System.Drawing.Point(64, 34);
- this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.pictureBox9.Location = new System.Drawing.Point(48, 28);
+ this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -129,9 +132,10 @@
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.AliceBlue;
- this.label1.Location = new System.Drawing.Point(3, 267);
+ this.label1.Location = new System.Drawing.Point(2, 218);
+ this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(102, 39);
+ this.label1.Size = new System.Drawing.Size(83, 31);
this.label1.TabIndex = 17;
this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -142,9 +146,10 @@
this.labeltotal.BackColor = System.Drawing.Color.Transparent;
this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue;
- this.labeltotal.Location = new System.Drawing.Point(111, 267);
+ this.labeltotal.Location = new System.Drawing.Point(89, 218);
+ this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labeltotal.Name = "labeltotal";
- this.labeltotal.Size = new System.Drawing.Size(0, 39);
+ this.labeltotal.Size = new System.Drawing.Size(0, 31);
this.labeltotal.TabIndex = 18;
//
// flowLayoutPanel1
@@ -157,26 +162,26 @@
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 0);
- this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
- this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1199);
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
- this.panel2.Location = new System.Drawing.Point(3, 2);
- this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panel2.Location = new System.Drawing.Point(2, 2);
+ this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(312, 263);
+ this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8;
//
// pictureBox7
//
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
- this.pictureBox7.Location = new System.Drawing.Point(64, 34);
- this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.pictureBox7.Location = new System.Drawing.Point(48, 28);
+ this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -192,11 +197,11 @@
this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button1.Location = new System.Drawing.Point(3, 269);
- this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button1.Location = new System.Drawing.Point(2, 220);
+ this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1";
- this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button1.Size = new System.Drawing.Size(312, 114);
+ this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button1.Size = new System.Drawing.Size(234, 93);
this.button1.TabIndex = 8;
this.button1.Text = "Menú";
this.button1.UseVisualStyleBackColor = false;
@@ -211,11 +216,11 @@
this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button2.Location = new System.Drawing.Point(3, 387);
- this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button2.Location = new System.Drawing.Point(2, 317);
+ this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button2.Name = "button2";
- this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button2.Size = new System.Drawing.Size(312, 114);
+ this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button2.Size = new System.Drawing.Size(234, 93);
this.button2.TabIndex = 9;
this.button2.Text = "Estadisticas";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -230,11 +235,11 @@
this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button3.Location = new System.Drawing.Point(3, 505);
- this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button3.Location = new System.Drawing.Point(2, 414);
+ this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button3.Name = "button3";
- this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button3.Size = new System.Drawing.Size(312, 114);
+ this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button3.Size = new System.Drawing.Size(234, 93);
this.button3.TabIndex = 10;
this.button3.Text = "Productos";
this.button3.UseVisualStyleBackColor = false;
@@ -248,11 +253,11 @@
this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button4.Image = global::compabetov2.Properties.Resources.reportesi;
this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button4.Location = new System.Drawing.Point(3, 623);
- this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button4.Location = new System.Drawing.Point(2, 511);
+ this.button4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button4.Name = "button4";
- this.button4.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button4.Size = new System.Drawing.Size(312, 114);
+ this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button4.Size = new System.Drawing.Size(234, 93);
this.button4.TabIndex = 11;
this.button4.Text = "Reportes";
this.button4.UseVisualStyleBackColor = false;
@@ -266,48 +271,48 @@
this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.button5.Location = new System.Drawing.Point(3, 741);
- this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.button5.Location = new System.Drawing.Point(2, 608);
+ this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button5.Name = "button5";
- this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
- this.button5.Size = new System.Drawing.Size(312, 114);
+ this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
+ this.button5.Size = new System.Drawing.Size(234, 93);
this.button5.TabIndex = 12;
this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false;
//
// flowLayoutPanel3
//
- this.flowLayoutPanel3.Location = new System.Drawing.Point(325, 283);
- this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.flowLayoutPanel3.Location = new System.Drawing.Point(244, 230);
+ this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
- this.flowLayoutPanel3.Size = new System.Drawing.Size(1273, 946);
+ this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 769);
this.flowLayoutPanel3.TabIndex = 14;
this.flowLayoutPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint);
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
- this.textBox1.Location = new System.Drawing.Point(365, 229);
- this.textBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.textBox1.Location = new System.Drawing.Point(274, 186);
+ this.textBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(399, 36);
+ this.textBox1.Size = new System.Drawing.Size(300, 30);
this.textBox1.TabIndex = 15;
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
- this.textBox2.Location = new System.Drawing.Point(792, 229);
- this.textBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.textBox2.Location = new System.Drawing.Point(594, 186);
+ this.textBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(399, 36);
+ this.textBox2.Size = new System.Drawing.Size(300, 30);
this.textBox2.TabIndex = 16;
//
// bntImprimir
//
- this.bntImprimir.Location = new System.Drawing.Point(1347, 76);
- this.bntImprimir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.bntImprimir.Location = new System.Drawing.Point(1010, 62);
+ this.bntImprimir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.bntImprimir.Name = "bntImprimir";
- this.bntImprimir.Size = new System.Drawing.Size(75, 23);
+ this.bntImprimir.Size = new System.Drawing.Size(56, 19);
this.bntImprimir.TabIndex = 17;
this.bntImprimir.Text = "Vender";
this.bntImprimir.UseVisualStyleBackColor = true;
@@ -321,18 +326,30 @@
"Cristofer Perez ",
"Angel Alexander",
"Emilio Urenda"});
- this.responsablecb.Location = new System.Drawing.Point(1441, 76);
+ this.responsablecb.Location = new System.Drawing.Point(1081, 62);
+ this.responsablecb.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.responsablecb.Name = "responsablecb";
- this.responsablecb.Size = new System.Drawing.Size(121, 24);
+ this.responsablecb.Size = new System.Drawing.Size(92, 21);
this.responsablecb.TabIndex = 18;
this.responsablecb.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged);
//
+ // btnFiar
+ //
+ this.btnFiar.Location = new System.Drawing.Point(1022, 99);
+ this.btnFiar.Name = "btnFiar";
+ this.btnFiar.Size = new System.Drawing.Size(75, 23);
+ this.btnFiar.TabIndex = 19;
+ this.btnFiar.Text = "Fiar";
+ this.btnFiar.UseVisualStyleBackColor = true;
+ this.btnFiar.Click += new System.EventHandler(this.btnFiar_Click);
+ //
// vender
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
- this.ClientSize = new System.Drawing.Size(1783, 750);
+ this.ClientSize = new System.Drawing.Size(1370, 609);
+ this.Controls.Add(this.btnFiar);
this.Controls.Add(this.responsablecb);
this.Controls.Add(this.bntImprimir);
this.Controls.Add(this.textBox2);
@@ -342,7 +359,7 @@
this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1);
- this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "vender";
this.Text = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
@@ -385,5 +402,6 @@
private System.Windows.Forms.Label labeltotal;
private System.Windows.Forms.Button bntImprimir;
private System.Windows.Forms.ComboBox responsablecb;
+ private System.Windows.Forms.Button btnFiar;
}
}
\ No newline at end of file
diff --git a/vender.cs b/vender.cs
index 261b7bb..990b071 100644
--- a/vender.cs
+++ b/vender.cs
@@ -591,6 +591,66 @@ namespace compabetov2
}
+ private void btnFiar_Click(object sender, EventArgs e)
+ {
+ List detallesCuenta = listaProductosCuenta();
+
+ if (detallesCuenta.Count > 0)
+ {
+ Cuenta ventaModel = new Cuenta(total);
+
+ if (service.crearCuenta(ventaModel, detallesCuenta))
+ {
+ MessageBox.Show("Fiado");
+ }
+ }
+ else
+ {
+ MessageBox.Show("No hay ningun producto agregado");
+ }
+
+ }
+
+ private List listaProductosCuenta()
+ {
+ List detallesCuentas = new List();
+ 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]);
+
+ DetalleCuentaModel detalleCuenta = new DetalleCuentaModel(producto, cantidad);
+
+
+ detallesCuentas.Add(detalleCuenta);
+ }
+
+ return detallesCuentas;
+ }
+
private void responsablecb_SelectedIndexChanged(object sender, EventArgs e)
{
bntImprimir.Enabled = responsablecb.SelectedIndex != -1;