public float getTotalSalida() { float total = 0f; for (int i = 0; i < LotesSuministros.Count; i++) { total += LotesSuministros.ElementAt(i).getCantidadSalidasLote(); } return(total); }
public float getTotalIngreso() { float total = 0f; for (int i = 0; i < this.LotesSuministros.Count; i++) { total += LotesSuministros.ElementAt(i).getCantidadIngresosLote(); } return(total); }
/// <summary> /// Retorna el ultimo ingreso del suministro. /// </summary> /// <returns>Retorna null si no hay ingresos.</returns> public Ingreso getUltimoIngreso() { int index = 0; if (LotesSuministros.Count != 0) { for (int i = 0; i < this.LotesSuministros.Count; i++) { Ingreso ingreso = LotesSuministros.ElementAt(i).getUltimoIngreso(); if (ingreso != null) { DateTime max = ingreso.FechaIngreso.Value; int compare = LotesSuministros.ElementAt(i).getUltimoIngreso().FechaIngreso.Value.CompareTo(max); if (compare == -1) { max = this.LotesSuministros.ElementAt(i).getUltimoIngreso().FechaIngreso.Value; index = i; } } } return(this.LotesSuministros.ElementAt(index).getUltimoIngreso()); } return(null); }
/// <summary> /// Devuelve los lotes vencidos.Solo se devuelven los que existan en stock. /// </summary> /// <returns></returns> public List <Lote> getLotesVencidosEnStock() { List <Lote> lotes = new List <Lote>(); DateTime hoy = DateTime.Today; for (int i = 0; i < LotesSuministros.Count; i++) { Lote lote = LotesSuministros.ElementAt(i); if (lote.Perecedero && lote.getCantidadStock() > 0) { try { int compare = lote.VencimientoLote.Value.CompareTo(hoy); if (compare < 0) { lotes.Add(lote); } } catch (NullReferenceException ex) { Console.WriteLine("Error: " + ex.Message); } } } return(lotes); }