예제 #1
0
        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);
        }
예제 #2
0
        private decimal GetPredictedCost(RecipeItem recipeItem)
        {
            var pci = PeriodicConsumptionItems.Single(x => x.InventoryItemId == recipeItem.InventoryItem.Id);

            return(recipeItem.Quantity * (pci.Cost / pci.UnitMultiplier));
        }
예제 #3
0
        private void UpdateConsumption(RecipeItem recipeItem, decimal saleTotal)
        {
            var pci = PeriodicConsumptionItems.Single(x => x.InventoryItemId == recipeItem.InventoryItem.Id);

            pci.Consumption += (recipeItem.Quantity * saleTotal) / pci.UnitMultiplier;
        }