Description
Returns some default values depending on the supplied year.
Parameters
iiYear | input | integer | The year you want default values for. You can supply 0 or ? if you don't know it. |
oiYear | output | integer | The default year |
oiPeriod | output | integer | The default period |
otStartDate | output | date | The default Start Date |
otEndDate | output | date | The default end date |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bvatperiod.p)
<Q-3 run VATPeriodByStartDate (Start) in BVATPeriod >
if iiYear = 0 or
iiYear = ?
then do:
<Q-1 run VATPeriodByStartDate (last) (Read) (Cache)
(input viCompanyId, (CompanyId)
input ?, (Year)
input ?, (StartDate)
output dataset tqVATPeriodByStartDate) in BVATPeriod >
find first tqVATPeriodByStartDate
no-error.
assign iiYear = if available tqVATPeriodByStartDate
then tqVATPeriodByStartDate.tiVatPeriodYear
else year(today).
end.
assign oiYear = iiYear.
for each bVATPeriod where
bVATPeriod.Company_ID = viCompanyId and
bVATPeriod.VATPeriodYear = iiYear
by bVATPeriod.VATPeriodPeriod desc:
assign oiPeriod = bVATPeriod.VATPeriodPeriod + 1
otStartDate = bVATPeriod.VATPeriodEndDate + 1.
leave.
end.
<Q-2 run VATPeriodByStartDate (last) (Read) (Cache)
(input viCompanyId, (CompanyId)
input iiYear, (Year)
input ?, (StartDate)
output dataset tqVATPeriodByStartDate) in BVATPeriod >
find first tqVATPeriodByStartDate
no-error.
if available tqVATPeriodByStartDate
then do:
if tqVATPeriodByStartDate.tiVATPeriodPeriod >= oiPeriod
then assign oiPeriod = tqVATPeriodByStartDate.tiVATPeriodPeriod + 1
otStartDate = tqVATPeriodByStartDate.ttVATPeriodEndDate + 1.
end.
else
if oiPeriod = 0
then assign oiPeriod = 1
otStartDate = date(1, 1, oiYear).
assign otEndDate = if month(otStartDate) = 12
then date(12, 31, year(otStartDate))
else date(month(otStartDate) + 1, 1, year(otStartDate)) - 1.
<Q-4 run VATPeriodByStartDate (Stop) in BVATPeriod >