project QadFinancials > class BPeriod > method DataLoadMultiple

Description

Give the period records for an accounting year


Parameters


iiPeriodYearinputintegerThe year from which you want all the period records
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bperiod.p)

/* ======================== */
    /* validate input parameter */
    /* ======================== */
    if iiPeriodYear = 0
    then do:
        assign vcMessage      = trim(#T-5'Enter the GL calendar year you want to create.':255(3085)T-5#)
               oiReturnStatus = -1.
        <M-1 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  'QADFIN-211':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        return.
    end.
    
    /* ====================================================================== */
    /* first clear the instance, otherwise problems when you execute it twice */
    /* ====================================================================== */
    <M-4 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BPeriod>
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.

    /* ========================================== */
    /* load the period records for the input year */
    /* ========================================== */
    <Q-2 run PeriodByYearPeriod (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input iiPeriodYear, (PeriodYear)
           input 0, (PeriodPeriod)
           input ?, (PeriodId)
           output dataset tqPeriodByYearPeriod) in BPeriod >
    
    assign vcList = "":U.
    
    for each tqPeriodByYearPeriod where
             tqPeriodByYearPeriod.tiCompany_ID = viCompanyId and
             tqPeriodByYearPeriod.tiPeriodYear = iiPeriodYear
             no-lock:
        find tPeriod where
             tPeriod.Period_ID = tqPeriodByYearPeriod.tiPeriod_ID
             no-error.
        if not available tPeriod
        then do:
            if vcList = "":U
            then vcList = string (tqPeriodByYearPeriod.tiPeriod_ID).
            else if lookup (string(tqPeriodByYearPeriod.tiPeriod_ID),vcList,chr(4)) = 0
                 then vcList = vcList + chr(4) + string (tqPeriodByYearPeriod.tiPeriod_ID).
        end.
    end.    
    
    if vcList <> "":U
    then do:
        <M-3 run DataLoad (input  '':U (icRowids), 
                   input  vcList (icPkeys), 
                   input  '':U (icObjectIds), 
                   input  '' (icFreeform), 
                   input  true (ilKeepPrevious), 
                   output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        if viFcReturnSuper <> 0
        then do:
            assign oiReturnStatus = viFcReturnSuper.
            return.
        end.
    end.