project QadFinancials > class BPeriod > method DataNewMultipleCreateManually

Description

method that is executed when you want to create an accounting year manually : default he will present calendar months


Parameters


iiPeriodYearinputintegerThe Accounting Year that you want to create
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-4'Enter the GL calendar year you want to create.':255(3085)T-4#)
               oiReturnStatus = -1.
        <M-3 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-210':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        return.
    end.
    
    /* ==================================== */
    /* create the year with calendar months */
    /* ==================================== */
    DO viCount = 1 to 12:
        /* ===================== */
        /* add new period record */
        /* ===================== */
        <M-2 run AddDetailLine (input  'Period':U (icTable), 
                                input  '':U (icParentRowid), 
                                output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        if viFcReturnSuper <> 0
        then do:
            assign oiReturnStatus = viFcReturnSuper.
            return.
        end.
        /* ======================== */
        /* assign the record values */
        /* ======================== */
        assign tPeriod.PeriodYear                   = iiPeriodYear
               tPeriod.PeriodPeriod                 = viCount
               tPeriod.PeriodStartDate              = date(string(viCount,"99":U) + 
                                                            "/01/":U + 
                                                            string(iiPeriodYear,"9999":U))
               tPeriod.PeriodEndDate                = if viCount = 12
                                                      then date (12, 31, iiPeriodYear)
                                                      else date(string(viCount + 1,"99":U) + 
                                                                "/01/":U + 
                                                                string(iiPeriodYear,"9999":U)) - 1
               tPeriod.PeriodStatus                 = {&PERIODSTATUS-OPEN}
               tPeriod.PeriodIsPostingGLAllowed     = true
               tPeriod.PeriodIsPostingPurchAllow    = true
               tPeriod.PeriodIsPostingSalesAllow    = true
               tPeriod.PeriodIsPostingInvAllowed    = true
               tPeriod.PeriodIsPostingOtherAllow    = true
               tPeriod.PeriodTypeCode               = {&PERIODTYPECODE-CORRECTION}
               tPeriod.tc_Status                    = "N":U.
    END.

    /* ============================================================ */
    /* validate data - perform external updates - save data         */
    /* you don't have to do it here because this method is executed */
    /* when they start the period form so when they press save      */
    /* the methods will automatically executed                      */
    /* ============================================================ */