Esempio n. 1
0
        public void BuildNewWeekWorldPlanningList()
        {
            _dictionStoreWorldStates.Clear();

            if (ListStoreWorlds != null)
            {
                List <EmployeePlanningWeek> lst   = null;
                StoreWorldWeekPlanningState state = null;

                foreach (StoreToWorld stw in ListStoreWorlds)
                {
                    lst = PlanningWeekProcessor.GetEmployeesByWorld(stw.ID, PlanningEmployees);

                    state          = new StoreWorldWeekPlanningState(stw.ID, BeginTime, EndTime);
                    state.IContext = this;
                    if (lst != null)
                    {
                        state.List.AddRange(lst);
                    }
                    _dictionStoreWorldStates[stw.WorldID] = state;

                    WorldPlanningInfo infoworld =
                        ClientEnvironment.StoreService.StoreToWorldService.GetStoreWorldPlanningInfo(true, CurrentStoreId, stw.WorldID, BeginTime);

                    state.StoreWorldInfo = infoworld;
                }
            }
        }
        public StoreWorldWeekPlanningState GetWorldPlanningState(long worldID)
        {
            StoreWorldWeekPlanningState result = new StoreWorldWeekPlanningState(worldID, StartDate, EndDate);

            result.IContext = this;

            List <EmployeePlanningWeek> worldEmployees = PlanningWeekProcessor.GetEmployeesByWorld(worldID, _storeEmployees);

            if (worldEmployees != null)
            {
                result.List.AddRange(worldEmployees);
            }

            return(result);
        }
Esempio n. 3
0
        private void LoadData()
        {
            // Worlds
            List <StoreToWorld> worldsDataSource;

            if (_storeToWorldIDs == null)
            {
                worldsDataSource = ClientEnvironment.StoreToWorldService.FindAllForStore(_storeID);
            }
            else
            {
                worldsDataSource = ClientEnvironment.StoreToWorldService.FindByIDList(new List <long>(_storeToWorldIDs));
            }

            _planningContext = new TimePlanningReportContext(_countryID, _storeID, _startDate, _endDate);
            List <long> spanIDs = new List <long>();

            foreach (StoreToWorld world in worldsDataSource)
            {
                StoreWorldWeekPlanningState state = _planningContext.GetWorldPlanningState(world.ID);
                if (state.List == null || state.List.Count == 0)
                {
                    spanIDs.Add(world.ID);
                }
                else
                {
                    _bindingHash[world] = state;
                }
            }

            worldsDataSource.RemoveAll(delegate(StoreToWorld stw) { return(spanIDs.Contains(stw.ID)); });
            worldsDataSource.Sort(new WorldComparer());
            DataSource = worldsDataSource;
            //
            // Planning Context
            //


            if (_viewType == ViewType.Weekly)
            {
                _weeklyReportPrintController                = new WeeklyPlanningPrintController(_planningContext);
                _weeklyReportPrintController.ManualFill     = _additionalManual;
                _weeklyReportPrintController.ManualFillOnly = _manualOnly;
                _weeklyReportPrintController.HideSums       = _hideSums;
            }
            field_WorldName.DataBindings.Add("Text", DataSource, "WorldName", Localizer.GetLocalized("World") + ": {0}");
        }
Esempio n. 4
0
        private void subreportDetails_BeforePrint(object sender, PrintEventArgs e)
        {
            StoreToWorld currentWorld = (StoreToWorld)GetCurrentRow();
            StoreWorldWeekPlanningState weekPlanningState = _bindingHash[currentWorld];

            if (weekPlanningState != null)
            {
                weekPlanningState.Calculate();
            }
            else
            {
                e.Cancel = true;
                return;
            }

            object dataSource;

            if (_viewType == ViewType.Weekly)
            {
                // acpro #125528
                dataSource = SortUtils <EmployeePlanningWeek> .Sort(weekPlanningState.List, _sortFields);

                BuildWeeklyReport(currentWorld.ID);
            }
            else
            {
                EmployeeDayViewList dayViewList = weekPlanningState.GetDailyListView(_viewDate);
                if (dayViewList == null)
                {
                    e.Cancel = true;
                    return;
                }

                // acpro #125528
                dataSource = SortUtils <EmployeePlanningWeek> .Sort(dayViewList.DayWeeklyList, _sortFields);

                BuildDailyReport(dayViewList);
            }


            subreportDetails.ReportSource.PaperKind = PaperKind;
            subreportDetails.ReportSource.Landscape = Landscape;

            subreportDetails.ReportSource.DataSource = dataSource;
        }