cuenta a la mitad
This commit is contained in:
+104
-1
@@ -1,4 +1,5 @@
|
||||
using compabetov2.database.modelos;
|
||||
using compabetov2.database;
|
||||
using compabetov2.database.modelos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -18,6 +19,7 @@ namespace compabetov2
|
||||
{
|
||||
InitializeComponent();
|
||||
this.loginPrincipal = loginPrincipal;
|
||||
llenarPanel();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
@@ -45,5 +47,106 @@ namespace compabetov2
|
||||
menuprincipalForm.BringToFront();
|
||||
}
|
||||
}
|
||||
|
||||
private void llenarPanel()
|
||||
{
|
||||
List<Cuenta> cuentas = service.conseguirCuentaDAO();
|
||||
|
||||
foreach (Cuenta cuenta in cuentas)
|
||||
{
|
||||
TableLayoutPanel carta = new TableLayoutPanel();
|
||||
carta.RowCount = 1;
|
||||
carta.ColumnCount = 2;
|
||||
carta.Height = 100;
|
||||
carta.Width = 820;
|
||||
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70F));
|
||||
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30F));
|
||||
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
carta.BackColor = Color.Gray;
|
||||
|
||||
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
|
||||
infoPanel.Dock = DockStyle.Fill;
|
||||
infoPanel.FlowDirection = FlowDirection.TopDown;
|
||||
|
||||
Label cliente = new Label();
|
||||
cliente.Text = $"Cliente: {cuenta.cliente}";
|
||||
cliente.Font = new Font(cliente.Font.FontFamily, 18);
|
||||
cliente.Width = 600;
|
||||
|
||||
Label fecha = new Label();
|
||||
fecha.Text = "Fecha: " + cuenta.fecha;
|
||||
fecha.Font = new Font(fecha.Font.FontFamily, 18);
|
||||
fecha.Width = 600;
|
||||
|
||||
Label total = new Label();
|
||||
total.Text = "Total: $" + cuenta.total;
|
||||
total.Font = new Font(total.Font.FontFamily, 18);
|
||||
total.Width = 600;
|
||||
|
||||
infoPanel.Controls.Add(fecha);
|
||||
infoPanel.Controls.Add(cliente);
|
||||
infoPanel.Controls.Add(total);
|
||||
|
||||
TableLayoutPanel HUDPanel = new TableLayoutPanel();
|
||||
HUDPanel.Dock = DockStyle.Fill;
|
||||
HUDPanel.RowCount = 1;
|
||||
HUDPanel.ColumnCount = 2;
|
||||
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
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<DetalleCuentaModel> detalles = service.conseguirDetalleCuante(cuenta.id);
|
||||
string mensaje = "";
|
||||
foreach (DetalleCuentaModel detalle in detalles)
|
||||
{
|
||||
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 eliminar este registro?",
|
||||
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
HUDPanel.Controls.Add(btnVer);
|
||||
HUDPanel.Controls.Add(btnEliminar);
|
||||
|
||||
|
||||
carta.Controls.Add(infoPanel,0,0);
|
||||
carta.Controls.Add(HUDPanel,1,0);
|
||||
|
||||
panelCuenta.Controls.Add(carta);
|
||||
panelCuenta.BackColor = Color.Aqua;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void panelCuenta_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user