cambios nachito a form factura
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Controladora;
|
||||
using Entidades;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Vista
|
||||
{
|
||||
@@ -9,6 +11,8 @@ namespace Vista
|
||||
{
|
||||
InitializeComponent();
|
||||
ActualizarGrilla();
|
||||
dataGridView1.CellClick += dataGridView1_CellClick;
|
||||
ConfigurarDataGridView2();
|
||||
}
|
||||
private void ActualizarGrilla()
|
||||
{
|
||||
@@ -26,5 +30,60 @@ namespace Vista
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void ConfigurarDataGridView2()
|
||||
{
|
||||
dataGridView2.AutoGenerateColumns = false;
|
||||
dataGridView2.Columns.Add(new DataGridViewTextBoxColumn
|
||||
{
|
||||
DataPropertyName = "Producto",
|
||||
HeaderText = "Producto"
|
||||
});
|
||||
dataGridView2.Columns.Add(new DataGridViewTextBoxColumn
|
||||
{
|
||||
DataPropertyName = "Cantidad",
|
||||
HeaderText = "Cantidad"
|
||||
});
|
||||
|
||||
dataGridView2.Columns.Add(new DataGridViewTextBoxColumn
|
||||
{
|
||||
DataPropertyName = "PrecioUnitario",
|
||||
HeaderText = "PrecioUnitariod"
|
||||
});
|
||||
dataGridView2.Columns.Add(new DataGridViewTextBoxColumn
|
||||
{
|
||||
DataPropertyName = "Subtotal",
|
||||
HeaderText = "Subtotal"
|
||||
});
|
||||
}
|
||||
private void ActualizarGrillaLotes(ReadOnlyCollection<Lote> lotes)
|
||||
{
|
||||
dataGridView2.DataSource = null;
|
||||
if (lotes.Any())
|
||||
{
|
||||
var loteDatos = lotes.Select(lote => new
|
||||
{
|
||||
Producto = lote.NombreProducto,
|
||||
Cantidad = lote.CantidadDeProductos,
|
||||
Subtotal = lote.Subtotal,
|
||||
PrecioUnitario = lote.PrecioUnitario,
|
||||
}).ToList();
|
||||
|
||||
dataGridView2.DataSource = loteDatos;
|
||||
}
|
||||
}
|
||||
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
var selectedFactura = (Factura)dataGridView1.Rows[e.RowIndex].DataBoundItem;
|
||||
var lotes = ControladoraLotes.Instance.ListarPorFacturaId(selectedFactura.Id);
|
||||
ActualizarGrillaLotes(lotes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user