protected override void UpdateTotals()
        {
            var rootCategories = ItemsShowing.Where(x => x.Category == null || x.Category.ParentCategory == null);

            //sum only root categories
            TotalSales = rootCategories.Sum(x => x.Amount);
            TotalCost  = rootCategories.Sum(x => x.Cost);

            TotalProfit        = totalSales - totalCost;
            AverageCostPercent = totalSales == 0 ? 0 : totalCost / totalSales;
        }
        protected override List <ChartItemViewModel> GetGraphData()
        {
            List <ChartItemViewModel> result = new List <ChartItemViewModel>();

            foreach (var item in
                     ItemsShowing.Where(x => x.ChildrenProductsTotalSale > 0).OrderBy(x => - x.ChildrenProductsTotalSale))
            {
                ChartItemViewModel scc = new ChartItemViewModel();

                scc.X = item.CategoryName;

                scc.TotalSale = Math.Round(item.ChildrenProductsTotalSale);

                result.Add(scc);
            }

            return(result);
        }