primer form de informe listo

This commit is contained in:
fedpo
2024-12-02 20:36:33 +00:00
parent c17323ebe4
commit aeeae3c9b8
8 changed files with 118 additions and 32 deletions

View File

@@ -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();
}
}
}