public object GetBucketNumberForAgedReport( DateTime?reportDate, DateTime?dateToAge, int?dayBucketBoundary0, int?dayBucketBoundary1, int?dayBucketBoundary2, int?dayBucketBoundary3, bool?isByFinancialPeriod, bool?isForwardAging, int organizationID) { if (reportDate == null || dayBucketBoundary0 == null || dayBucketBoundary1 == null || dayBucketBoundary2 == null || dayBucketBoundary3 == null) { return(null); } AgingDirection agingDirection = isForwardAging == true ? AgingDirection.Forward : AgingDirection.Backwards; PXGraph graph = new PXGraph(); return(isByFinancialPeriod == true ? AgingEngine.AgeByPeriods( reportDate.Value, dateToAge.Value, graph.GetService <IFinPeriodRepository>(), agingDirection, NUMBER_OF_AGING_BUCKETS, organizationID) : AgingEngine.AgeByDays( reportDate.Value, dateToAge.Value, agingDirection, dayBucketBoundary0 ?? 0, dayBucketBoundary1 ?? 0, dayBucketBoundary2 ?? 0, dayBucketBoundary3 ?? 0)); }
private static void FillBucketDescriptions(PXCache cache, ARStatementCycle statementCycle) { string[] bucketDescriptions = AgingEngine.GetDayAgingBucketDescriptions( AgingDirection.Backwards, new int[] { 0, statementCycle.AgeDays00.Value, statementCycle.AgeDays01.Value, statementCycle.AgeDays02.Value, }, false) .ToArray(); cache.SetValueExt <ARStatementCycle.ageMsgCurrent>(statementCycle, bucketDescriptions[0]); cache.SetValueExt <ARStatementCycle.ageMsg00>(statementCycle, bucketDescriptions[1]); cache.SetValueExt <ARStatementCycle.ageMsg01>(statementCycle, bucketDescriptions[2]); cache.SetValueExt <ARStatementCycle.ageMsg02>(statementCycle, bucketDescriptions[3]); cache.SetValueExt <ARStatementCycle.ageMsg03>(statementCycle, bucketDescriptions[4]); }
public object GetBucketNumberForAgedReport( DateTime?reportDate, DateTime?dateToAge, int?dayBucketBoundary0, int?dayBucketBoundary1, int?dayBucketBoundary2, int?dayBucketBoundary3, bool?isByFinancialPeriod, bool?isForwardAging) { if (reportDate == null || dayBucketBoundary0 == null || dayBucketBoundary1 == null || dayBucketBoundary2 == null || dayBucketBoundary3 == null) { return(null); } AgingDirection agingDirection = isForwardAging == true ? AgingDirection.Forward : AgingDirection.Backwards; return(isByFinancialPeriod == true ? AgingEngine.AgeByPeriods( new PXGraph(), reportDate.Value, dateToAge.Value, FinancialPeriodProvider.Default, agingDirection, NUMBER_OF_AGING_BUCKETS) : AgingEngine.AgeByDays( reportDate.Value, dateToAge.Value, agingDirection, dayBucketBoundary0 ?? 0, dayBucketBoundary1 ?? 0, dayBucketBoundary2 ?? 0, dayBucketBoundary3 ?? 0)); }
public string GetBucketDescriptionForAgedReport( DateTime?reportDate, int?dayBucketBoundary0, int?dayBucketBoundary1, int?dayBucketBoundary2, int?dayBucketBoundary3, bool?isByFinancialPeriod, bool?isForwardAging, int?bucketIndex) { if (reportDate == null || dayBucketBoundary0 == null || dayBucketBoundary1 == null || dayBucketBoundary2 == null || dayBucketBoundary3 == null || bucketIndex == null) { return(null); } AgingDirection agingDirection = isForwardAging == true ? AgingDirection.Forward : AgingDirection.Backwards; if (isByFinancialPeriod == true) { try { IFinancialPeriodProvider periodProvider = FinancialPeriodProvider.Default; IEnumerable <string> bucketDescriptions = AgingEngine.GetPeriodAgingBucketDescriptions( FinancialPeriodProvider.Default, reportDate.Value, agingDirection, NUMBER_OF_AGING_BUCKETS); return(bucketDescriptions.ElementAtOrDefault(bucketIndex.Value)); } catch (PXFinPeriodException) { throw new PXFinPeriodException( isForwardAging == true ? AR.Messages.UnableToCalculateBucketNamesPeriodsAfterwardsNotDefined : AR.Messages.UnableToCalculateBucketNamesPeriodsPrecedingNotDefined); } } else { IEnumerable <string> bucketDescriptions = AgingEngine.GetDayAgingBucketDescriptions( agingDirection, new int[] { dayBucketBoundary0 ?? 0, dayBucketBoundary1 ?? 0, dayBucketBoundary2 ?? 0, dayBucketBoundary3 ?? 0 }, true); return(bucketDescriptions.ElementAtOrDefault(bucketIndex.Value)); } }