project QadFinancials > class BPeriod > method CheckPeriodExistence
Description
Check if the combination of year and period does exist in the instance
Parameters
iiCompanyId | input | integer | Company id |
iiPeriodYear | input | integer | Year of the period |
iiPeriodPeriod | input | integer | Period of the Period |
olDoesExist | output | logical | The period does exist or not in the instance |
oiPeriod_ID | output | integer | Period_ID |
oiPeriodMark_ID | output | integer | PeriodMark_ID |
otStartDate | output | date | Start Date. |
otEndDate | output | date | End Date. |
ocPeriodTypeCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bperiod.p)
/* ====================== */
/* replace unknown values */
/* ====================== */
if iiCompanyId = ? then assign iiCompanyId = 0.
if iiPeriodYear = ? then assign iiPeriodYear = 0.
if iiPeriodPeriod = ? then assign iiPeriodPeriod = 0.
/* ============================================ */
/* if the year is zero, no record will be found */
/* ============================================ */
if iiPeriodYear = 0
then do:
assign olDoesExist = false.
return.
end.
/* ================================================== */
/* search the combination of year, period and company */
/* ================================================== */
find first tPeriod where
tPeriod.Company_ID = iiCompanyId and
tPeriod.PeriodYear = iiPeriodYear and
tPeriod.PeriodPeriod = iiPeriodPeriod and
tPeriod.tc_status <> "D":U
no-error.
assign olDoesExist = if available tPeriod
then true
else false
oiPeriod_ID = if available tPeriod
then tPeriod.Period_ID
else ?
oiPeriodMark_ID = if available tPeriod
then tPeriod.PeriodMark_ID
else ?
otStartDate = if available tPeriod
then tPeriod.PeriodStartDate
else ?
otEndDate = if available tPeriod
then tPeriod.PeriodEndDate
else ?
ocPeriodTypeCode = if available tPeriod
then tPeriod.PeriodTypeCode
else "":U
.