diff --git a/Cuentas/cuentas.cs b/Cuentas/cuentas.cs index 80b1e98..a8fbe52 100644 --- a/Cuentas/cuentas.cs +++ b/Cuentas/cuentas.cs @@ -55,10 +55,11 @@ namespace compabetov2 foreach (Cuenta cuenta in cuentas) { + TableLayoutPanel carta = new TableLayoutPanel(); carta.RowCount = 1; carta.ColumnCount = 2; - carta.Height = 80; + carta.Height = 100; carta.Width = 820; carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 55F)); carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 45F)); @@ -70,102 +71,146 @@ namespace compabetov2 Label cliente = new Label(); cliente.Text = $"Cliente: {cuenta.cliente}"; - cliente.Font = new Font(cliente.Font.FontFamily, 18); + cliente.Font = new Font(cliente.Font.FontFamily, 12); cliente.Width = 600; Label fecha = new Label(); fecha.Text = "Fecha: " + cuenta.fecha; - fecha.Font = new Font(fecha.Font.FontFamily, 18); + fecha.Font = new Font(fecha.Font.FontFamily, 12); fecha.Width = 600; Label total = new Label(); total.Text = "Total: $" + cuenta.total; - total.Font = new Font(total.Font.FontFamily, 18); + total.Font = new Font(total.Font.FontFamily, 12); total.Width = 600; + Label estado = new Label(); + estado.Text = $"Estado: {cuenta.estado}"; + estado.Font = new Font(total.Font.FontFamily, 12); + estado.Width = 600; + infoPanel.Controls.Add(fecha); infoPanel.Controls.Add(cliente); infoPanel.Controls.Add(total); + infoPanel.Controls.Add(estado); - TableLayoutPanel HUDPanel = new TableLayoutPanel(); - HUDPanel.Dock = DockStyle.Fill; - HUDPanel.RowCount = 1; - HUDPanel.ColumnCount = 3; - HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); - HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); - HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); - HUDPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - - Button btnVer = new Button(); - btnVer.Text = "Ver"; - btnVer.Dock = DockStyle.Fill; - btnVer.FlatStyle = FlatStyle.Flat; - btnVer.FlatAppearance.BorderSize = 0; - btnVer.BackColor = Color.FromArgb(33, 90, 255); - btnVer.Font = new Font(btnVer.Font.FontFamily, 16); - btnVer.ForeColor = Color.White; - btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) + if (cuenta.estado.Equals("ACTIVO")) { - List detalles = service.conseguirDetalleCuante(cuenta.id); - string mensaje = $"Cliente: {cuenta.cliente}\n"; - foreach (DetalleCuentaModel detalle in detalles) - { - mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; - } - MessageBox.Show(mensaje); - }); + TableLayoutPanel HUDPanel = new TableLayoutPanel(); + HUDPanel.Dock = DockStyle.Fill; + HUDPanel.RowCount = 1; + HUDPanel.ColumnCount = 3; + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - Button btnSaldar = new Button(); - btnSaldar.Text = "Saldar"; - btnSaldar.Dock = DockStyle.Fill; - btnSaldar.FlatStyle = FlatStyle.Flat; - btnSaldar.FlatAppearance.BorderSize = 0; - btnSaldar.BackColor = Color.FromArgb(33, 90, 255); - btnSaldar.Font = new Font(btnVer.Font.FontFamily, 16); - btnSaldar.ForeColor = Color.White; - btnSaldar.Click += new EventHandler(delegate (object sender, EventArgs e) - { - DialogResult result = MessageBox.Show("¿Está seguro de que desea saldar esta cuenta?", - "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (result == DialogResult.Yes) + Button btnVer = new Button(); + btnVer.Text = "Ver"; + btnVer.Dock = DockStyle.Fill; + btnVer.FlatStyle = FlatStyle.Flat; + btnVer.FlatAppearance.BorderSize = 0; + btnVer.BackColor = Color.FromArgb(33, 90, 255); + btnVer.Font = new Font(btnVer.Font.FontFamily, 16); + btnVer.ForeColor = Color.White; + btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) { List detalles = service.conseguirDetalleCuante(cuenta.id); - if (service.saldarCuenta(cuenta, detalles)) + string mensaje = $"Cliente: {cuenta.cliente}\n"; + foreach (DetalleCuentaModel detalle in detalles) { - llenarPanel(); + mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; } + MessageBox.Show(mensaje); + }); - } - }); - - Button btnEliminar = new Button(); - btnEliminar.Text = "Cancelar"; - btnEliminar.Dock = DockStyle.Fill; - btnEliminar.BackColor = Color.Red; - btnEliminar.FlatStyle = FlatStyle.Flat; - btnEliminar.FlatAppearance.BorderSize = 0; - btnEliminar.Font = new Font(btnVer.Font.FontFamily, 16); - btnEliminar.ForeColor = Color.White; - btnEliminar.Click += new EventHandler(delegate (object sender, EventArgs e) - { - DialogResult result = MessageBox.Show("¿Está seguro de que desea cancelar este registro?", - "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (result == DialogResult.Yes) + Button btnSaldar = new Button(); + btnSaldar.Text = "Saldar"; + btnSaldar.Dock = DockStyle.Fill; + btnSaldar.FlatStyle = FlatStyle.Flat; + btnSaldar.FlatAppearance.BorderSize = 0; + btnSaldar.BackColor = Color.FromArgb(33, 90, 255); + btnSaldar.Font = new Font(btnVer.Font.FontFamily, 16); + btnSaldar.ForeColor = Color.White; + btnSaldar.Click += new EventHandler(delegate (object sender, EventArgs e) { - if (service.cancelarCuenta(cuenta.id)) + DialogResult result = MessageBox.Show("¿Está seguro de que desea saldar esta cuenta?", + "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) { - llenarPanel(); + List detalles = service.conseguirDetalleCuante(cuenta.id); + if (service.saldarCuenta(cuenta, detalles)) + { + llenarPanel(); + } + } - } - }); + }); - HUDPanel.Controls.Add(btnVer); - HUDPanel.Controls.Add(btnSaldar); - HUDPanel.Controls.Add(btnEliminar); + Button btnEliminar = new Button(); + btnEliminar.Text = "Cancelar"; + btnEliminar.Dock = DockStyle.Fill; + btnEliminar.BackColor = Color.Red; + btnEliminar.FlatStyle = FlatStyle.Flat; + btnEliminar.FlatAppearance.BorderSize = 0; + btnEliminar.Font = new Font(btnVer.Font.FontFamily, 16); + btnEliminar.ForeColor = Color.White; + btnEliminar.Click += new EventHandler(delegate (object sender, EventArgs e) + { + DialogResult result = MessageBox.Show("¿Está seguro de que desea cancelar este registro?", + "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + if (service.cancelarCuenta(cuenta.id)) + { + llenarPanel(); + } + } + }); + HUDPanel.Controls.Add(btnVer); + HUDPanel.Controls.Add(btnSaldar); + HUDPanel.Controls.Add(btnEliminar); + + carta.Controls.Add(HUDPanel, 1, 0); + } + else + { + TableLayoutPanel HUDPanel = new TableLayoutPanel(); + HUDPanel.Dock = DockStyle.Fill; + HUDPanel.RowCount = 1; + HUDPanel.ColumnCount = 3; + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + HUDPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + + Button btnVer = new Button(); + btnVer.Text = "Ver"; + btnVer.Dock = DockStyle.Fill; + btnVer.FlatStyle = FlatStyle.Flat; + btnVer.FlatAppearance.BorderSize = 0; + btnVer.BackColor = Color.FromArgb(33, 90, 255); + btnVer.Font = new Font(btnVer.Font.FontFamily, 16); + btnVer.ForeColor = Color.White; + btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) + { + List detalles = service.conseguirDetalleCuante(cuenta.id); + string mensaje = $"Cliente: {cuenta.cliente}\n"; + foreach (DetalleCuentaModel detalle in detalles) + { + mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; + } + MessageBox.Show(mensaje); + }); + + HUDPanel.Controls.Add(btnVer,2,0); + + carta.Controls.Add(HUDPanel, 1, 0); + } carta.Controls.Add(infoPanel,0,0); - carta.Controls.Add(HUDPanel,1,0); + panelCuenta.Controls.Add(carta); diff --git a/Ventas/vender.Designer.cs b/Ventas/vender.Designer.cs index f8feb0e..d97a746 100644 --- a/Ventas/vender.Designer.cs +++ b/Ventas/vender.Designer.cs @@ -98,7 +98,7 @@ this.flowLayoutPanel2.Controls.Add(this.label1); this.flowLayoutPanel2.Controls.Add(this.labeltotal); this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968); this.flowLayoutPanel2.TabIndex = 11; @@ -109,7 +109,7 @@ this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.pictureBox9); this.panel1.Location = new System.Drawing.Point(2, 2); - this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.panel1.Margin = new System.Windows.Forms.Padding(2); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(234, 214); this.panel1.TabIndex = 8; @@ -118,7 +118,7 @@ // this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox9.Location = new System.Drawing.Point(48, 28); - this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.pictureBox9.Margin = new System.Windows.Forms.Padding(2); this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Size = new System.Drawing.Size(190, 197); this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -160,7 +160,7 @@ this.flowLayoutPanel1.Controls.Add(this.button3); this.flowLayoutPanel1.Controls.Add(this.button5); this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974); this.flowLayoutPanel1.TabIndex = 8; @@ -170,7 +170,7 @@ this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.pictureBox7); this.panel2.Location = new System.Drawing.Point(2, 2); - this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(2); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(234, 214); this.panel2.TabIndex = 8; @@ -179,7 +179,7 @@ // this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox7.Location = new System.Drawing.Point(48, 28); - this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.pictureBox7.Margin = new System.Windows.Forms.Padding(2); this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -196,7 +196,7 @@ this.button1.Image = global::compabetov2.Properties.Resources.Menui1; this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button1.Location = new System.Drawing.Point(2, 220); - this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button1.Margin = new System.Windows.Forms.Padding(2); this.button1.Name = "button1"; this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button1.Size = new System.Drawing.Size(234, 93); @@ -215,7 +215,7 @@ this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button2.Location = new System.Drawing.Point(2, 317); - this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button2.Margin = new System.Windows.Forms.Padding(2); this.button2.Name = "button2"; this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button2.Size = new System.Drawing.Size(234, 93); @@ -233,7 +233,7 @@ this.button3.Image = global::compabetov2.Properties.Resources.productoi; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button3.Location = new System.Drawing.Point(2, 414); - this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button3.Margin = new System.Windows.Forms.Padding(2); this.button3.Name = "button3"; this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button3.Size = new System.Drawing.Size(234, 93); @@ -251,7 +251,7 @@ this.button5.Image = global::compabetov2.Properties.Resources.sesionc; this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button5.Location = new System.Drawing.Point(2, 511); - this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button5.Margin = new System.Windows.Forms.Padding(2); this.button5.Name = "button5"; this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button5.Size = new System.Drawing.Size(234, 93); @@ -263,7 +263,7 @@ // this.flowLayoutPanel3.AutoScroll = true; this.flowLayoutPanel3.Location = new System.Drawing.Point(244, 230); - this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel3.Name = "flowLayoutPanel3"; this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 769); this.flowLayoutPanel3.TabIndex = 14; @@ -273,7 +273,7 @@ // this.txtbusqueda.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtbusqueda.Location = new System.Drawing.Point(247, 178); - this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2); this.txtbusqueda.Name = "txtbusqueda"; this.txtbusqueda.Size = new System.Drawing.Size(528, 30); this.txtbusqueda.TabIndex = 15; @@ -285,7 +285,7 @@ this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.bntImprimir.ForeColor = System.Drawing.Color.Transparent; this.bntImprimir.Location = new System.Drawing.Point(791, 171); - this.bntImprimir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.bntImprimir.Margin = new System.Windows.Forms.Padding(2); this.bntImprimir.Name = "bntImprimir"; this.bntImprimir.Size = new System.Drawing.Size(113, 44); this.bntImprimir.TabIndex = 17; @@ -297,13 +297,8 @@ // this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.responsablecb.FormattingEnabled = true; - this.responsablecb.Items.AddRange(new object[] { - "Fabian Herrera", - "Cristofer Perez ", - "Angel Alexander", - "Emilio Urenda"}); this.responsablecb.Location = new System.Drawing.Point(1028, 172); - this.responsablecb.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.responsablecb.Margin = new System.Windows.Forms.Padding(2); this.responsablecb.Name = "responsablecb"; this.responsablecb.Size = new System.Drawing.Size(171, 33); this.responsablecb.TabIndex = 18; @@ -340,7 +335,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1028, 627); + this.ClientSize = new System.Drawing.Size(1300, 627); this.ControlBox = false; this.Controls.Add(this.btnEnviar); this.Controls.Add(this.btnFiar); @@ -352,7 +347,7 @@ this.Controls.Add(this.lblhora); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "vender"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.vender_Load); diff --git a/Ventas/vender.cs b/Ventas/vender.cs index 875eac9..c37bc00 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -36,9 +36,19 @@ namespace compabetov2 InitializeComponent(); getData(); llenarLayout(); + llenarComBox(); this.loginPrincipal = loginPrincipal; } + private void llenarComBox() + { + List empleados = service.conseguirEmpleados(); + foreach(Empleado empleado in empleados) + { + responsablecb.Items.Add(empleado.nombre); + } + } + private void llenarLayout() { foreach (Producto producto in productos) diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 3badd95..6473321 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 cd5c7c5..d63474c 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 ae41a68..b390f1c 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 9457bd4..c3a4782 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -324,7 +324,7 @@ namespace compabetov2.database conexion.Open(); - string sql = "SELECT * FROM Empleado"; + string sql = "SELECT * FROM Empleado WHERE idempleado > 1"; SQLiteCommand command = new SQLiteCommand(sql, conexion); reader = command.ExecuteReader(); @@ -914,7 +914,7 @@ namespace compabetov2.database conexion.Open(); - string sql = "SELECT * FROM cuenta WHERE estado = 'ACTIVO'"; + string sql = "SELECT * FROM cuenta ORDER BY idCuenta DESC"; SQLiteCommand command = new SQLiteCommand(sql, conexion); reader = command.ExecuteReader(); @@ -1097,6 +1097,7 @@ namespace compabetov2.database SQLiteCommand commandCuenta = new SQLiteCommand(sqlCuenta, conexion); commandCuenta.Parameters.AddWithValue("@idCuenta", cuenta.id); + commandCuenta.ExecuteNonQuery(); SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion); SQLiteDataReader reader = commandConsulta.ExecuteReader(); @@ -1269,7 +1270,7 @@ namespace compabetov2.database conexion.Open(); - string sql = "SELECT * FROM envios"; + string sql = "SELECT * FROM envios ORDER BY idEnvios DESC"; SQLiteCommand command = new SQLiteCommand(sql, conexion); reader = command.ExecuteReader(); diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 7837b90..3c70188 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 34fd46b..9c4e14a 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 3badd95..6473321 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 cd5c7c5..d63474c 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ