Esempio n. 1
0
        public decimal GetInventory(InventoryItem inventoryItem, Warehouse warehouse)
        {
            var previousInventory = 0m;
            if (_applicationState.PreviousWorkPeriod != null)
            {
                var ppci = _inventoryDao.GetPeriodConsumptionItem(_applicationState.PreviousWorkPeriod.Id, inventoryItem.Id, warehouse.Id);
                previousInventory = ppci.GetPhysicalInventory();
            }
            var transactions = GetTransactionItems(inventoryItem, warehouse).ToList();
            var positiveSum = transactions.Where(x => x.TargetWarehouseId == warehouse.Id).Sum(y => (y.Quantity * y.Multiplier) / inventoryItem.Multiplier);
            var negativeSum = transactions.Where(x => x.SourceWarehouseId == warehouse.Id).Sum(y => (y.Quantity * y.Multiplier) / inventoryItem.Multiplier);

            var currentConsumption = (
                from sale in GetSales(_applicationState.CurrentWorkPeriod, inventoryItem.Id, warehouse.Id)
                let recipe = _inventoryDao.GetRecipe(sale.PortionName, sale.MenuItemId)
                let rip = recipe.RecipeItems.Where(x => x.InventoryItem.Id == inventoryItem.Id)
                select (rip.Sum(x => x.Quantity) * sale.Total) / (inventoryItem.Multiplier)).Sum();

            return previousInventory + (positiveSum - negativeSum) - currentConsumption;
        }
 public WarehouseButton(Warehouse model, WarehouseInventoryViewModel baseViewModel)
 {
     _baseViewModel = baseViewModel;
     Model = model;
 }
 private void OnWarehouseSelected(Warehouse obj)
 {
     UpdateSelectedWarehouse(obj.Id);
     WarehouseButtons.ToList().ForEach(x => x.Refresh());
 }
Esempio n. 4
0
 private IEnumerable<InventoryTransaction> GetTransactionItems(InventoryItem inventoryItem, Warehouse warehouse)
 {
     return _inventoryDao.GetTransactionItems(_applicationState.CurrentWorkPeriod.StartDate, inventoryItem.Id, warehouse.Id);
 }
Esempio n. 5
0
 private bool ShouldKeep(PeriodicConsumptionItem periodicConsumptionItem, IEnumerable<InventoryItem> inventoryItems, Warehouse warehouse)
 {
     var wname = warehouse.Name;
     var inventoryItem = inventoryItems.Single(y => y.Id == periodicConsumptionItem.InventoryItemId);
     return inventoryItem.IsMappedToWarehouse(wname);
 }