estadisticas terminadas con detalle del mejor vendedor
This commit is contained in:
+76
-17
@@ -14,27 +14,39 @@ namespace compabetov2
|
||||
{
|
||||
public partial class RegistroVentas : Form
|
||||
{
|
||||
List<VentaModel> ventas;
|
||||
List<Dictionary<string, dynamic>> ventasYDetalles;
|
||||
Estadiscticas ventanaPadre;
|
||||
public RegistroVentas(List<VentaModel> ventas,Estadiscticas ventanaPadre)
|
||||
int cantidadVentas;
|
||||
int cotaInferior = 0;
|
||||
int cotaSuperior;
|
||||
public RegistroVentas(List<Dictionary<string, dynamic>> ventasYDetalles, Estadiscticas ventanaPadre)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.ventanaPadre = ventanaPadre;
|
||||
this.ventas = ventas;
|
||||
this.ventasYDetalles = ventasYDetalles;
|
||||
cantidadVentas = ventasYDetalles.Count;
|
||||
lbContador.Text = $"0 - {cantidadVentas}";
|
||||
cotaSuperior = cantidadVentas > 20 ? 20 : cantidadVentas;
|
||||
llenarPanel();
|
||||
}
|
||||
|
||||
private void llenarPanel()
|
||||
{
|
||||
foreach(VentaModel venta in ventas)
|
||||
panelVentas.Controls.Clear();
|
||||
|
||||
for(int i = cotaInferior; i < cotaSuperior; i++)
|
||||
{
|
||||
Dictionary<string, dynamic> ventaYDetalles = ventasYDetalles[i];
|
||||
VentaModel venta = ventaYDetalles["venta"];
|
||||
|
||||
TableLayoutPanel carta = new TableLayoutPanel();
|
||||
carta.ColumnCount = 1;
|
||||
carta.RowCount = 2;
|
||||
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 75F));
|
||||
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||
carta.Width = 700;
|
||||
carta.Height = 170;
|
||||
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 70F));
|
||||
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 30F));
|
||||
carta.Width = 385;
|
||||
carta.Height = 150;
|
||||
carta.BackColor = Color.FromArgb(200, 200, 200);
|
||||
|
||||
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
|
||||
infoPanel.FlowDirection = FlowDirection.TopDown;
|
||||
@@ -42,27 +54,25 @@ namespace compabetov2
|
||||
|
||||
Label lbFecha = new Label();
|
||||
lbFecha.Text = $"Fecha: {venta.fecha}";
|
||||
lbFecha.Font = new Font(lbFecha.Font.FontFamily, 12);
|
||||
lbFecha.Font = new Font(lbFecha.Font.FontFamily, 16);
|
||||
lbFecha.Width = 700;
|
||||
|
||||
Label lbResponzable = new Label();
|
||||
lbResponzable.Text = $"Responzable: {venta.responzable}";
|
||||
lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 12);
|
||||
lbResponzable.Text = $"Responsable: {venta.responzable}";
|
||||
lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 16);
|
||||
lbResponzable.Width = 700;
|
||||
|
||||
Label lbTotal = new Label();
|
||||
lbTotal.Text = $"Total: {venta.total}";
|
||||
lbTotal.Font = new Font(lbTotal.Font.FontFamily, 12);
|
||||
lbTotal.Font = new Font(lbTotal.Font.FontFamily, 16);
|
||||
lbTotal.Width = 700;
|
||||
|
||||
TableLayoutPanel botonesPanel = new TableLayoutPanel();
|
||||
botonesPanel.RowCount = 1;
|
||||
botonesPanel.ColumnCount = 4;
|
||||
botonesPanel.ColumnCount = 2;
|
||||
botonesPanel.Dock = DockStyle.Fill;
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
|
||||
Button btnDetalles = new Button();
|
||||
@@ -74,6 +84,26 @@ namespace compabetov2
|
||||
btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16);
|
||||
btnDetalles.ForeColor = Color.White;
|
||||
btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
List<DetalleVentaModel> detalles = ventaYDetalles["detalles"];
|
||||
string mensaje = "";
|
||||
foreach (DetalleVentaModel detalle in detalles)
|
||||
{
|
||||
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
|
||||
}
|
||||
mensaje += $"Total: {venta.total}";
|
||||
MessageBox.Show(mensaje);
|
||||
});
|
||||
|
||||
Button btnImprimir = new Button();
|
||||
btnImprimir.Text = "Ticket";
|
||||
btnImprimir.Dock = DockStyle.Fill;
|
||||
btnImprimir.FlatStyle = FlatStyle.Flat;
|
||||
btnImprimir.FlatAppearance.BorderSize = 0;
|
||||
btnImprimir.BackColor = Color.Yellow;
|
||||
btnImprimir.Font = new Font(btnImprimir.Font.FontFamily, 16);
|
||||
btnImprimir.ForeColor = Color.Black;
|
||||
btnImprimir.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
});
|
||||
|
||||
@@ -82,20 +112,49 @@ namespace compabetov2
|
||||
infoPanel.Controls.Add(lbResponzable);
|
||||
|
||||
botonesPanel.Controls.Add(btnDetalles, 0, 0);
|
||||
botonesPanel.Controls.Add(btnImprimir, 1, 0);
|
||||
|
||||
carta.Controls.Add(infoPanel, 0, 0);
|
||||
carta.Controls.Add(botonesPanel, 0, 1);
|
||||
|
||||
panelVentas.Controls.Add(carta);
|
||||
}
|
||||
|
||||
foreach (Dictionary<string,dynamic> ventaYDetalles in ventasYDetalles)
|
||||
{
|
||||
VentaModel venta = ventaYDetalles["venta"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMenos_Click(object sender, EventArgs e)
|
||||
{
|
||||
cotaInferior -= 20;
|
||||
cotaInferior = cotaInferior > 0 ? cotaInferior : 0;
|
||||
|
||||
cotaSuperior -= 20;
|
||||
cotaSuperior = cotaInferior == 0 ? 20 : cotaSuperior;
|
||||
|
||||
llenarPanel();
|
||||
lbContador.Text = $"{cotaInferior} - {cantidadVentas}";
|
||||
|
||||
}
|
||||
|
||||
private void btnMas_Click(object sender, EventArgs e)
|
||||
{
|
||||
cotaSuperior += 20;
|
||||
cotaSuperior = cotaSuperior > cantidadVentas ? cantidadVentas : cotaSuperior;
|
||||
|
||||
cotaInferior += 20;
|
||||
cotaInferior = cotaSuperior == cantidadVentas ? cotaSuperior - 20 : cotaInferior;
|
||||
|
||||
llenarPanel();
|
||||
lbContador.Text = $"{cotaInferior} - {cantidadVentas}";
|
||||
|
||||
}
|
||||
|
||||
private void RegistroVentas_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user