primer form de informe listo
This commit is contained in:
@@ -89,7 +89,7 @@ namespace Modelo
|
||||
|
||||
public List<DtoProductoInforme> ObtenerInformeProductoMasUsados()
|
||||
{
|
||||
List<DtoProductoInforme> list
|
||||
var list
|
||||
= context.DetalleFacturas
|
||||
.GroupBy(df => df.Producto)
|
||||
.Select(g => new DtoProductoInforme
|
||||
@@ -97,10 +97,17 @@ namespace Modelo
|
||||
g.Key.Id,
|
||||
g.Key.Nombre,
|
||||
g.Sum(df => df.Cantidad),
|
||||
context.Lotes.Include(x => x.Producto).Where(x=>x.Id == g.Key.Id).Sum(x => x.Cantidad)
|
||||
0
|
||||
))
|
||||
.ToList();
|
||||
return list;
|
||||
.ToList()
|
||||
.OrderByDescending(x => x.CantidadVendida);
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.StockRemanente = context.Lotes.Where(x => x.Producto.Id == item.Id).Sum(x => x.Cantidad);
|
||||
}
|
||||
|
||||
|
||||
return list.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user