Esempio n. 1
0
        public virtual IEnumerable records()
        {
            ScheduleTransFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <DRScheduleTran> select = new PXSelectJoin <DRScheduleTran,
                                                                         InnerJoin <DRScheduleDetail, On <DRScheduleTran.scheduleID, Equal <DRScheduleDetail.scheduleID>,
                                                                                                          And <DRScheduleTran.componentID, Equal <DRScheduleDetail.componentID>,
                                                                                                               And <DRScheduleTran.detailLineNbr, Equal <DRScheduleDetail.detailLineNbr> > > >,
                                                                                    InnerJoin <DRDeferredCode, On <DRDeferredCode.deferredCodeID, Equal <DRScheduleDetail.defCode> >,
                                                                                               LeftJoin <InventoryItem, On <InventoryItem.inventoryID, Equal <DRScheduleDetail.componentID> > > > >,
                                                                         Where <DRDeferredCode.accountType, Equal <Current <ScheduleTransFilter.accountType> >,
                                                                                And <DRScheduleTran.status, Equal <DRScheduleTranStatus.PostedStatus> > > >(this);

                if (!string.IsNullOrEmpty(filter.DeferredCode))
                {
                    select.WhereAnd <Where <DRScheduleDetail.defCode, Equal <Current <ScheduleTransFilter.deferredCode> > > >();
                }

                if (filter.UseMasterCalendar == true)
                {
                    select.WhereAnd <Where <DRScheduleTran.tranPeriodID, Equal <Current <ScheduleTransFilter.finPeriodID> > > >();
                }
                else
                {
                    select.WhereAnd <Where <DRScheduleTran.finPeriodID, Equal <Current <ScheduleTransFilter.finPeriodID> > > >();
                }

                if (filter.OrgBAccountID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.branchID, Inside <Current <ScheduleTransFilter.orgBAccountID> > > >();              //MatchWithOrg
                }

                if (filter.AccountID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.accountID, Equal <Current <ScheduleTransFilter.accountID> > > >();
                }

                if (filter.SubID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.subID, Equal <Current <ScheduleTransFilter.subID> > > >();
                }

                if (filter.BAccountID != null)
                {
                    select.WhereAnd <Where <DRScheduleDetail.bAccountID, Equal <Current <ScheduleTransFilter.bAccountID> > > >();
                }

                foreach (object x in this.QuickSelect(select.View.BqlSelect))
                {
                    yield return(x);
                }
            }
            else
            {
                yield break;
            }
        }
        public virtual IEnumerable records()
        {
            ScheduleTransFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <DRScheduleTran> select = new PXSelectJoin <DRScheduleTran,
                                                                         InnerJoin <DRScheduleDetail, On <DRScheduleTran.scheduleID, Equal <DRScheduleDetail.scheduleID>,
                                                                                                          And <DRScheduleTran.componentID, Equal <DRScheduleDetail.componentID> > >,
                                                                                    InnerJoin <DRDeferredCode, On <DRDeferredCode.deferredCodeID, Equal <DRScheduleDetail.defCode> >,
                                                                                               LeftJoin <InventoryItem, On <InventoryItem.inventoryID, Equal <DRScheduleDetail.componentID> > > > >,
                                                                         Where <DRDeferredCode.accountType, Equal <Current <ScheduleTransFilter.accountType> >,
                                                                                And <DRScheduleTran.status, Equal <DRScheduleTranStatus.PostedStatus>,
                                                                                     And <DRScheduleTran.finPeriodID, Equal <Current <ScheduleTransFilter.finPeriodID> > > > > >(this);

                if (!string.IsNullOrEmpty(filter.DeferredCode))
                {
                    select.WhereAnd <Where <DRScheduleDetail.defCode, Equal <Current <ScheduleTransFilter.deferredCode> > > >();
                }

                int[] branchIDs = null;

                if (filter.BranchID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.branchID, Equal <Current <ScheduleTransFilter.branchID> > > >();
                }
                else if (filter.OrganizationID != null)
                {
                    branchIDs = PXAccess.GetChildBranchIDs(filter.OrganizationID);

                    select.WhereAnd <Where <DRScheduleTran.branchID, In <Required <ScheduleTransFilter.branchID> > > >();
                }

                if (filter.AccountID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.accountID, Equal <Current <ScheduleTransFilter.accountID> > > >();
                }

                if (filter.SubID != null)
                {
                    select.WhereAnd <Where <DRScheduleTran.subID, Equal <Current <ScheduleTransFilter.subID> > > >();
                }

                if (filter.BAccountID != null)
                {
                    select.WhereAnd <Where <DRScheduleDetail.bAccountID, Equal <Current <ScheduleTransFilter.bAccountID> > > >();
                }

                foreach (object x in select.Select(branchIDs))
                {
                    yield return(x);
                }
            }
            else
            {
                yield break;
            }
        }
Esempio n. 3
0
        public virtual IEnumerable NextPeriod(PXAdapter adapter)
        {
            ScheduleTransFilter filter = Filter.Current as ScheduleTransFilter;

            int?      calendarOrganizationID = FinPeriodRepository.GetCalendarOrganizationID(filter.OrganizationID, filter.BranchID, filter.UseMasterCalendar);
            FinPeriod nextPeriod             = FinPeriodRepository.FindNextPeriod(calendarOrganizationID, filter.FinPeriodID, looped: true);

            filter.FinPeriodID = nextPeriod != null ? nextPeriod.FinPeriodID : null;

            return(adapter.Get());
        }
        public virtual IEnumerable NextPeriod(PXAdapter adapter)
        {
            ScheduleTransFilter filter     = Filter.Current as ScheduleTransFilter;
            FinPeriod           nextperiod = FiscalPeriodUtils.FindNextPeriod(this, filter.FinPeriodID, true);

            if (nextperiod != null)
            {
                filter.FinPeriodID = nextperiod.FinPeriodID;
            }
            return(adapter.Get());
        }
Esempio n. 5
0
        protected virtual void ScheduleTransFilter_AccountType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            ScheduleTransFilter row = e.Row as ScheduleTransFilter;

            if (row != null)
            {
                row.BAccountID   = null;
                row.DeferredCode = null;
                row.AccountID    = null;
                row.SubID        = null;
            }
        }