public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     ServiceZipList.Clear();
     StoresWithCheckList.Clear();
     IsServiceBusy = true;
     _worker.RunWorkerAsync();
 }
Пример #2
0
 private void LoadReportData(object sender, DoWorkEventArgs e)
 {
     ServiceZipList = new ObservableCollection <ServiceZipDetailsSet>(_serviceZipService.GetAllWithZips());
     foreach (var store in _storeService.GetStores())
     {
         if (store.StoreNumber > 10000)
         {
             StoresWithCheckList.Add(new StoresWithCheck {
                 Store = store
             });
         }
     }
 }
 private void LoadReport()
 {
     StackedStoreList.Clear();
     StoreZipList.Clear();
     foreach (var store in StoresWithCheckList.Where(s => s.Check))
     {
         var stackedStore = new StackedStoreInfo();
         stackedStore.Store          = store.Store;
         stackedStore.EquipmentSum   = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)) && se.ZipName != "Ремонт").Sum(se => se.ZipQuantity == 0 ? se.ZipPrice : se.ZipPrice * se.ZipQuantity.Value);
         stackedStore.RepairSum      = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)) && se.ZipName == "Ремонт").Sum(se => se.ZipPrice);
         stackedStore.ServiceZipList = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)));
         StackedStoreList.Add(stackedStore);
     }
 }
Пример #4
0
        private void LoadReport()
        {
            var query = from s in ServiceZipList
                        where StoresWithCheckList.Where(st => st.Check).Any(st => st.Store.StoreNumber == s.StoreNumber) &&
                        ReturnNumberMonth(s.ServiceMonth) >= ReturnNumberMonth(StartMonth) &&
                        ReturnNumberMonth(s.ServiceMonth) <= ReturnNumberMonth(EndMonth) &&
                        s.ServiceYear >= StartYear &&
                        s.ServiceYear <= EndYear
                        select s;

            ReportStoresCount = StoresWithCheckList.Where(st => st.Check).Count();
            WorkICL           = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName == "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            EquipmentICL      = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName != "Транспортные услуги" && q.ZipName != "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TrICL             = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName == "Транспортные услуги").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TotalICL          = WorkICL + EquipmentICL + TrICL;
            AvICL             = TotalICL / StoresWithCheckList.Where(st => st.Check).Count();
            WorkKKS           = query.Where(q => q.Company == "ККС").Where(q => q.ZipName == "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            EquipmentKKS      = query.Where(q => q.Company == "ККС").Where(q => q.ZipName != "Транспортные услуги" && q.ZipName != "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TrKKS             = query.Where(q => q.Company == "ККС").Where(q => q.ZipName == "Транспортные услуги").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TotalKKS          = WorkKKS + EquipmentKKS + TrKKS;
            AvKKS             = TotalKKS / StoresWithCheckList.Where(st => st.Check).Count();
            var list = (from s in query
                        where s.Company == "ККС"
                        group s by new { s.ServiceMonth, s.ServiceYear }
                        into ym
                        select new MonthExp {
                MonthYear = new DateTime(ym.Key.ServiceYear.Value, ReturnNumberMonth(ym.Key.ServiceMonth), 1), Expense = (ym.Where(s => s.ZipQuantity.Value == 0).Sum(s => s.ZipPrice) + ym.Where(s => s.ZipQuantity.Value != 0).Sum(s => s.ZipPrice * s.ZipQuantity.Value))
            }).ToList();

            KKSExpList = new ObservableCollection <MonthExp>(list);
            list       = (from s in query
                          where s.Company == "АйСиЭл"
                          group s by new { s.ServiceMonth, s.ServiceYear }
                          into ym
                          select new MonthExp {
                MonthYear = new DateTime(ym.Key.ServiceYear.Value, ReturnNumberMonth(ym.Key.ServiceMonth), 1), Expense = (ym.Where(s => s.ZipQuantity.Value == 0).Sum(s => s.ZipPrice) + ym.Where(s => s.ZipQuantity.Value != 0).Sum(s => s.ZipPrice * s.ZipQuantity.Value))
            }).ToList();
            ICLExpList = new ObservableCollection <MonthExp>(list);
            var minKKS = KKSExpList.Count > 0 ? KKSExpList.Min(k => k.Expense) - 3000 : 0;
            var maxKKS = KKSExpList.Count > 0 ? KKSExpList.Max(k => k.Expense) + 10000 : 100000;
            var minICL = ICLExpList.Count > 0 ? ICLExpList.Min(i => i.Expense) - 3000 : 0;
            var maxICL = ICLExpList.Count > 0 ? ICLExpList.Max(i => i.Expense) + 10000 : 100000;

            MinimumAmount = minKKS > minICL ? minICL : minKKS;
            MaximumAmount = maxKKS > maxICL ? maxKKS : maxICL;
        }
Пример #5
0
 public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     StoresWithCheckList.Clear();
     IsLoading = true;
     _worker.RunWorkerAsync();
 }