Description
This is a remoting-enabled method that returns the year and period based upon a certain date
Parameters
| btDate | input-output | date | |
| oiYear | output | integer | |
| oiPeriod | output | integer | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bapmatching.p)
assign oiReturnStatus = -98.
<Q-2 run PeriodByStartEndDateStatus (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input btDate, (Date)
input {&PERIODSTATUS-OPEN}, (PeriodStatus)
input ?, (PeriodId)
input true, (PeriodIsPostingGLAllowed)
output dataset tqPeriodByStartEndDateStatus) in BPeriod>
find first tqPeriodByStartEndDateStatus where
tqPeriodByStartEndDateStatus.tcPeriodStatus = {&PERIODSTATUS-OPEN} and
tqPeriodByStartEndDateStatus.tlPeriodIsPostingGLAllowed = true and
tqPeriodByStartEndDateStatus.ttPeriodStartDate <= btDate and
tqPeriodByStartEndDateStatus.ttPeriodEndDate >= btDate
no-error.
if available tqPeriodByStartEndDateStatus
then assign oiYear = tqPeriodByStartEndDateStatus.tiPeriodYear
oiPeriod = tqPeriodByStartEndDateStatus.tiPeriodPeriod.
else do:
<Q-28 run PeriodByStartEndDate (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input today, (Date)
output dataset tqPeriodByStartEndDate) in BPeriod>
find first tqPeriodByStartEndDate where
tqPeriodByStartEndDate.tcPeriodStatus = {&PERIODSTATUS-OPEN} and
tqPeriodByStartEndDate.tlPeriodIsPostingGLAllowed = true and
tqPeriodByStartEndDate.ttPeriodStartDate <= today and
tqPeriodByStartEndDate.ttPeriodEndDate >= today
no-error.
if available tqPeriodByStartEndDate
then do:
assign oiYear = tqPeriodByStartEndDate.tiPeriodYear
oiPeriod = tqPeriodByStartEndDate.tiPeriodPeriod
btDate = Today.
end. /* if available tqPeriodByStartEndDate */
end. /* else do */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.