project QadFinancials > class BGLCalendar > method DataNewMultipleCopyPeriodYear
Description
Method that allows the creation of a new calendar year based on another existing calendar year
Parameters
iiPeriodYear | input | integer | the calendar year to be created |
iiCopyPeriodYear | input | integer | The calendar year to copy from |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bglcalendar.p)
/*
* Validate input parameters
*/
if iiPeriodYear = ? or iiPeriodYear = 0 then do:
assign
vcMessage = trim(#T-1'You must specify the GL calendar year to create.':100(2247)t-1#)
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input '-121':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>
return.
end.
if iiCopyPeriodYear = ? or iiCopyPeriodYear = 0 then do:
assign
vcMessage = trim(#T-3'You must supply a GL calendar year to copy.':100(2246)t-3#)
oiReturnStatus = -1.
<M-11 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input '-123':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>
return.
end.
<Q-4 assign vlFcQueryRecordsAvailable = GLCalendarByYearPeriod (NoCache) (input viDomainID, (DomainId)
input iiCopyPeriodYear, (CalendarYear)
input ?, (CalendarPeriod)
input ?, (GLCalendarId)) in BGLCalendar >
if not vlFcQueryRecordsAvailable then do:
assign
vcMessage = trim(#T-5'The GL calendar year you want to copy does not exist.':100(2248)t-5#)
oiReturnStatus = -1.
<M-6 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input '-122':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>
return.
end.
/* Clear the instance */
<M-7 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>
if viFcReturnSuper <> 0 then do:
assign
oiReturnStatus = viFcReturnSuper.
return.
end.
/* Read the Accounting Year to copy */
<Q-8 run GLCalendarByYearPeriod (all) (Read) (NoCache)
(input viDomainID, (DomainId)
input iiCopyPeriodYear, (CalendarYear)
input ?, (CalendarPeriod)
input ?, (GLCalendarId)
output dataset tqGLCalendarByYearPeriod) in BGLCalendar >
for each tqGLCalendarByYearPeriod where
tqGLCalendarByYearPeriod.tiDomain_ID = viDomainID and
tqGLCalendarByYearPeriod.tiGLCalendarYear = iiCopyPeriodYear:
<M-9 run AddDetailLine (input 'GLCalendar':U (icTable),
input '':U (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>
if viFcReturnSuper <> 0 then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
assign
tGLCalendar.GLCalendarYear = iiPeriodYear
tGLCalendar.GLCalendarPeriod = tqGLCalendarByYearPeriod.tiGLCalendarPeriod
tGLCalendar.GLCalendarStartDate = <M-10 GetDate (input tqGLCalendarByYearPeriod.ttGLCalendarStartDate (itDate),
input iiCopyPeriodYear (iiOldYear),
input iiPeriodYear (iiNewYear)) in BGLCalendar>
tGLCalendar.GLCalendarEndDate = <M-12 GetDate (input tqGLCalendarByYearPeriod.ttGLCalendarEndDate (itDate),
input iiCopyPeriodYear (iiOldYear),
input iiPeriodYear (iiNewYear)) in BGLCalendar>
tGLCalendar.GLCalendarTypeCode = tqGLCalendarByYearPeriod.tcGLCalendarTypeCode.
end.
/*Sort the table in ASC*/
for each tGLCalendar where
tGLCalendar.tc_Status = "N":U use-index i_parent :
assign tGLCalendar.tc_Rowid = '-' + string(int(substring(tGLCalendar.tc_Rowid,2,length(tGLCalendar.tc_Rowid,"CHARACTER":U),"CHARACTER":U)),'9999').
end.