Exemple #1
0
        protected virtual IEnumerable filter()
        {
            PXCache cache = this.Caches[typeof(SchedulesFilter)];

            if (cache != null)
            {
                SchedulesFilter filter = cache.Current as SchedulesFilter;
                if (filter != null)
                {
                    int startRow  = 0;
                    int totalRows = 0;

                    filter.TotalDeferred  = 0;
                    filter.TotalScheduled = 0;

                    BqlCommand cmd = ComposeBQLCommandForRecords(filter);
                    if (cmd == null)
                    {
                        yield return(cache.Current);
                    }

                    cmd = cmd.AggregateNew <Aggregate <
                                                Sum <SchedulesInqResult.signTotalAmt,
                                                     Sum <SchedulesInqResult.signDefAmt> > > >();

                    PXView view = new PXView(this, true, cmd);

                    List <object> record = view.Select(new[] { filter },
                                                       null,
                                                       null,
                                                       null,
                                                       null,
                                                       Records.View.GetExternalFilters(),
                                                       ref startRow,
                                                       0,
                                                       ref totalRows);

                    if (record.Count > 0)
                    {
                        PXResult <SchedulesInqResult, DRSchedule, DRDeferredCode, InventoryItem> rec =
                            (PXResult <SchedulesInqResult, DRSchedule, DRDeferredCode, InventoryItem>)record[0];
                        filter.TotalScheduled = ((SchedulesInqResult)rec).SignTotalAmt;
                        filter.TotalDeferred  = ((SchedulesInqResult)rec).SignDefAmt;
                    }
                }
            }
            yield return(cache.Current);

            cache.IsDirty = false;
        }