project QadFinancials > class BPeriod > method GetPeriodsOfRange
Description
This method returns the periods which covers the input criteria. Input can be from/till date or from/till period.
Parameters
itFromDate | input | date | From Date |
itTillDate | input | date | Till Date |
iiFromYearPeriod | input | integer | From Year Period |
iiTillYearPeriod | input | integer | Till Year Period |
iiCompany_ID | input | integer | Company_ID |
tSelectedPeriods | output | temp-table | Temptable like period, used to store all selected period. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bperiod.p)
/* ===================================================================================== */
/* This method returns all the periods covering the YearPeriodFrom/Till or DateFrom/Till */
/* - in case a YearPeriodFrom/Till is supplied all periods in this range are returned */
/* - in case a DateFrom/Till is supplied, the sytem returns all periods */
/* - the period covering the DateFrom */
/* - the period covering the DateTill */
/* - the periods in between */
/* ===================================================================================== */
if oiReturnStatus = 0
then assign oiReturnStatus = -98.
empty temp-table tSelectedPeriods.
/* Check the input parameters */
if iiFromYearPeriod = ? then assign iiFromYearPeriod = 0.
if iiTillYearPeriod = ? then assign iiTillYearPeriod = 0.
if iiCompany_ID = ? then assign iiCompany_ID = 0.
if iiCompany_ID <> 0 and
(iiFromYearPeriod <> 0 or iiTillYearPeriod <> 0 or itFromDate <> ? or itTillDate <> ?)
then do :
/* ============================================ */
/* Get the periods based on YearPeriodFrom/Till */
/* ============================================ */
if iiFromYearPeriod <> 0 or iiTillYearPeriod <> 0
then do :
if iiFromYearPeriod <= iiTillYearPeriod
then do :
<Q-1 run GetPeriodsOfPeriodRange (all) (Read) (NoCache)
(input iiCompany_ID, (CompanyId)
input iiFromYearPeriod, (YearPeriodFrom)
input iiTillYearPeriod, (YearPeriodTill)
output dataset tqGetPeriodsOfPeriodRange) in BPeriod >
for each tqGetPeriodsOfPeriodRange :
create tSelectedPeriods.
buffer-copy tqGetPeriodsOfPeriodRange to tSelectedPeriods.
end. /* for each */
end.
end.
else
/* ====================================== */
/* Get the periods based on DateFrom/Till */
/* ====================================== */
if itFromDate <> ? or itTillDate <> ?
then do :
if itFromDate <= itTillDate
then do :
<Q-2 run GetPeriodsOfDateRange (all) (Read) (NoCache)
(input iiCompany_ID, (CompanyId)
input itTillDate, (ToDate)
input itFromDate, (FromDate)
output dataset tqGetPeriodsOfDateRange) in BPeriod >
for each tqGetPeriodsOfDateRange:
create tSelectedPeriods.
buffer-copy tqGetPeriodsOfDateRange to tSelectedPeriods.
end. /* for each */
end. /* if itFromDate <= itTillDate */
end.
end.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.