private decimal GetFinalCost(RecipeItem recipeItem) { var pci = PeriodicConsumptionItems.SingleOrDefault(x => x.InventoryItemId == recipeItem.InventoryItem.Id); if (pci != null && pci.GetPredictedConsumption() > 0) { var cost = recipeItem.Quantity * (pci.Cost / pci.UnitMultiplier); cost = (pci.GetConsumption() * cost) / pci.GetPredictedConsumption(); return(cost); } return(0); }
private decimal GetPredictedCost(RecipeItem recipeItem) { var pci = PeriodicConsumptionItems.Single(x => x.InventoryItemId == recipeItem.InventoryItem.Id); return(recipeItem.Quantity * (pci.Cost / pci.UnitMultiplier)); }
private void UpdateConsumption(RecipeItem recipeItem, decimal saleTotal) { var pci = PeriodicConsumptionItems.Single(x => x.InventoryItemId == recipeItem.InventoryItem.Id); pci.Consumption += (recipeItem.Quantity * saleTotal) / pci.UnitMultiplier; }