Esempio n. 1
0
        private void Filter()
        {
            Costs.Clear();
            var costs = _costs;

            if (costs == null)
            {
                costs = new List <InfoCost>();
            }

            if (SelectedCostItem != null && SelectedCostItem.Name != null)
            {
                costs = costs.Where(c => c.DirectoryCostItem.Name == SelectedCostItem.Name).ToList();
            }

            if (SelectedRC != null && SelectedRC.Name != null)
            {
                costs = costs.Where(c => c.DirectoryRC.Name == SelectedRC.Name).ToList();
            }

            if (SelectedInOut != null && SelectedInOut != "")
            {
                costs = costs.Where(c => SelectedInOut == "Приход" ? c.IsIncoming : !c.IsIncoming).ToList();
            }

            if (SelectedTransportCompany != null && SelectedTransportCompany.Name != null)
            {
                costs = costs.Where(c => c.DirectoryTransportCompany != null && c.DirectoryTransportCompany.Name == SelectedTransportCompany.Name).ToList();
            }

            if (SelectedNote != null && SelectedNote.Description != null)
            {
                costs = costs.Where(c => c.CurrentNotes.Any(n => n.DirectoryNote.Description == SelectedNote.Description)).ToList();
            }


            costs = costs.OrderByDescending(c => c.Date).ToList();

            foreach (var cost in costs)
            {
                Costs.Add(cost);
            }

            SummChange();
        }
Esempio n. 2
0
        public void EvaluateCostsAndProfits()
        {
            if (!Totals.Any()) // Totals need to be evaluated beforehand
            {
                EvaluateTotals();
            }

            Costs.Clear();
            Profits.Clear();

            for (var index = 0; index <= _diffMonths; index++)
            {
                var period        = _from.AddMonths(index);
                var ordersInMonth = _orders.Where(IsInMonth(period.Month));

                Costs.Add(ordersInMonth.Sum(order => order.OrderTotalCost));
                Profits.Add(Totals[index] - Costs[index]);
            }
        }
        public void UpdateData()
        {
            if (!OneDrive.IsAuthenticated)
            {
                return;
            }

            List <CategoryModel> categories = DbWorker.GetCategories();

            Categories.Clear();
            foreach (var category in categories)
            {
                Categories.Add(new CategoryViewModel(category));
            }

            Costs.Clear();
            foreach (var cost in DbWorker.GetCosts().Take(TOTAL_COUNT_COSTS))
            {
                Costs.Add(new CostViewModel(cost));
            }

            Accounts.UpdateData();
        }
Esempio n. 4
0
 public override void VisitRoster(RosterNode node)
 {
     Costs.Clear();
     Visit(node.Forces);
 }