protected virtual void CalendarWeekCodeGeneration_StartDate_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { if (e.Row == null) { return; } FSWeekCodeDate fsWeekCodeDateRow = PXSelectOrderBy <FSWeekCodeDate, OrderBy <Desc <FSWeekCodeDate.weekCodeDate> > > .SelectWindowed(this, 0, 1); if (fsWeekCodeDateRow != null) { e.NewValue = fsWeekCodeDateRow.WeekCodeDate.Value.AddDays(1); } else { e.NewValue = new DateTime(2008, 12, 29); } CalendarWeekCodeGeneration calendarWeekCodeGenrationRow = (CalendarWeekCodeGeneration)e.Row; if (calendarWeekCodeGenrationRow.StartDate != null) { DateTime?newValue = SharedFunctions.TryParseHandlingDateTime(cache, e); if (newValue.HasValue == true) { calendarWeekCodeGenrationRow.EndDate = newValue.Value.AddYears(1); } } }
public virtual IEnumerable previousperiod(PXAdapter adapter) { GLHistoryEnqFilter filter = Filter.Current as GLHistoryEnqFilter; FinPeriod nextperiod = PXSelect <FinPeriod, Where <FinPeriod.finPeriodID, Less <Current <GLHistoryEnqFilter.finPeriodID> > >, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { nextperiod = PXSelectOrderBy <FinPeriod, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { yield return(filter); } } filter.FinPeriodID = nextperiod != null ? nextperiod.FinPeriodID : null; yield return(filter); }
public static FinPeriod FindLastPeriod(PXGraph graph, bool aClosedOrActive) { return(aClosedOrActive ? (PXSelect <FinPeriod, Where <FinPeriod.closed, Equal <True>, Or <FinPeriod.active, Equal <True> > >, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(graph, 0, 1)) : ( PXSelectOrderBy <FinPeriod, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(graph, 0, 1))); }
protected virtual void RUTROTWorkType_Position_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { RUTROTWorkType row = (RUTROTWorkType)e.Row; if (row == null) { return; } RUTROTWorkType latest = PXSelectOrderBy<RUTROTWorkType, OrderBy<Desc<RUTROTWorkType.position>>>.SelectWindowed(this, 0, 1); e.NewValue = latest.Position + 1; }
public virtual IEnumerable nextperiod(PXAdapter adapter) { GLHistoryEnqFilter filter = CurrentFilter; FinPeriod nextperiod = PXSelect <FinPeriod, Where <FinPeriod.finPeriodID, Greater <Current <GLHistoryEnqFilter.finPeriodID> > >, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1) ?? PXSelectOrderBy <FinPeriod, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); filter.FinPeriodID = nextperiod?.FinPeriodID; return(adapter.Get()); }
public virtual IEnumerable nextperiod(PXAdapter adapter) { AccountByYearFilter filter = CurrentFilter; FinYear nextperiod = PXSelect <FinYear, Where <FinYear.year, Greater <Current <AccountByYearFilter.finYear> > >, OrderBy <Asc <FinYear.year> > > .SelectWindowed(this, 0, 1) ?? PXSelectOrderBy <FinYear, OrderBy <Asc <FinYear.year> > > .SelectWindowed(this, 0, 1); filter.FinYear = nextperiod?.Year; return(adapter.Get()); }
protected virtual void EPSetup_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { var row = e.Row as EPSetup; if (row == null || e.Operation == PXDBOperation.Delete) { return; } if (row.PostingOption == EPPostOptions.PostToOffBalance && row.OffBalanceAccountGroupID == null) { if (cache.RaiseExceptionHandling <EPSetup.offBalanceAccountGroupID>(e.Row, row.OffBalanceAccountGroupID, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXUIFieldAttribute.GetDisplayName <EPSetup.offBalanceAccountGroupID>(cache)))) { throw new PXRowPersistingException(typeof(EPSetup.offBalanceAccountGroupID).Name, row.OffBalanceAccountGroupID, ErrorMessages.FieldIsEmpty, PXUIFieldAttribute.GetDisplayName <EPSetup.offBalanceAccountGroupID>(cache)); } } if (row.CustomWeek == true) { DateTime?firstUsing = GetFirstActivityDate(); DateTime?lastUsing = GetLasttUsingWeek(); if (firstUsing != null && lastUsing != null) { EPCustomWeek firstWeek = PXSelectOrderBy <EPCustomWeek, OrderBy <Asc <EPCustomWeek.weekID> > > .SelectWindowed(this, 0, 1); EPCustomWeek lastWeek = PXSelectOrderBy <EPCustomWeek, OrderBy <Desc <EPCustomWeek.weekID> > > .SelectWindowed(this, 0, 1); foreach (EPCustomWeek week in CustomWeek.Cache.Inserted) { if (lastWeek == null) { lastWeek = week; } if (week.WeekID > lastWeek.WeekID) { lastWeek = week; } } if (firstWeek == null || firstUsing < firstWeek.StartDate || lastWeek == null || lastWeek.EndDate < lastUsing) { throw new PXRowPersistingException(typeof(EPSetup.customWeek).Name, row.CustomWeek, Messages.CustomWeekNotCreated, firstUsing, lastUsing); } } } }
public virtual IEnumerable nextperiod(PXAdapter adapter) { InventoryTranSumEnqFilter filter = Filter.Current as InventoryTranSumEnqFilter; FinPeriod nextperiod = PXSelect <FinPeriod, Where <FinPeriod.finPeriodID, Greater <Current <InventoryTranSumEnqFilter.finPeriodID> > >, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { nextperiod = PXSelectOrderBy <FinPeriod, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); } filter.FinPeriodID = nextperiod.FinPeriodID; return(adapter.Get()); }
public virtual IEnumerable previousperiod(PXAdapter adapter) { InventoryTranByAcctEnqFilter filter = Filter.Current as InventoryTranByAcctEnqFilter; FinPeriod nextperiod = PXSelect <FinPeriod, Where <FinPeriod.finPeriodID, Less <Current <InventoryTranByAcctEnqFilter.finPeriodID> > >, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { nextperiod = PXSelectOrderBy <FinPeriod, OrderBy <Desc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); } filter.FinPeriodID = nextperiod.FinPeriodID; ResetFilterDates(filter); return(adapter.Get()); }
public virtual IEnumerable previousperiod(PXAdapter adapter) { AccountByYearFilter filter = this.CurrentFilter; FinYear nextperiod = PXSelect <FinYear, Where <FinYear.year, Less <Current <AccountByYearFilter.finYear> > >, OrderBy <Desc <FinYear.year> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { nextperiod = PXSelectOrderBy <FinYear, OrderBy <Desc <FinYear.year> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { yield return(filter); } } filter.FinYear = nextperiod != null ? nextperiod.Year : null; yield return(filter); }
public virtual IEnumerable nextperiod(PXAdapter adapter) { InventoryTranByAcctEnqFilter filter = Filter.Current as InventoryTranByAcctEnqFilter; FinPeriod nextperiod = PXSelect <FinPeriod, Where <FinPeriod.finPeriodID, Greater <Current <InventoryTranByAcctEnqFilter.finPeriodID> > >, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { nextperiod = PXSelectOrderBy <FinPeriod, OrderBy <Asc <FinPeriod.finPeriodID> > > .SelectWindowed(this, 0, 1); if (nextperiod == null) { yield return(filter); } } filter.FinPeriodID = nextperiod.FinPeriodID; ResetFilterDates(filter); yield return(filter); }