project QadFinancials > class BReportPeriod > method DataNewMultipleCreateManually

Description

This method is executed when you want to create an accounting year manually. By default it will create the year with calendar months.


Parameters


iiReportPeriodYearinputintegerThe Report-Year that you want to create
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/breportperiod.p)

/* ======================== */
    /* Validate input parameter */
    /* ======================== */
    if iiReportPeriodYear = 0
    then do:
        assign vcMsgRepPd      = trim(#T-4'Enter the reporting year you want to create.':255(3543)T-4#)
               oiReturnStatus = -1.
        <M-2 run SetMessage (input  vcMsgRepPd (icMessage),
                     input  '':U (icArguments),
                     input  '':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-992':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BReportPeriod>
        return.
    end. /* if iiReportPeriodYear = 0 */
    
    /* ==================================== */
    /* Create the year with calendar months */
    /* ==================================== */
    DO viCount = 1 to 12 :
        
        /* ===================== */
        /* add new period record */
        /* ===================== */
        <M-3 run AddDetailLine (input  'ReportPeriod':U (icTable), 
                        input  '':U (icParentRowid), 
                        output viFcReturnSuper (oiReturnStatus)) in BReportPeriod>
        if viFcReturnSuper <> 0
        then do:
            assign oiReturnStatus = viFcReturnSuper.
            return.
        end. /* if viFcReturnSuper <> 0 */
        
        /* ======================== */
        /* assign the record values */
        /* ======================== */
        assign tReportPeriod.ReportPeriodYear      = iiReportPeriodYear
               tReportPeriod.ReportPeriodPeriod    = viCount
               tReportPeriod.ReportPeriodStartDate = date(string(viCount,"99":U) + 
                                                          "/01/":U + 
                                                          string(iiReportPeriodYear,"9999":U))
               tReportPeriod.ReportPeriodEndDate   = if viCount = 12
                                                     then date (12, 31, iiReportPeriodYear)
                                                     else date(string(viCount + 1,"99":U) + 
                                                               "/01/":U + 
                                                               string(iiReportPeriodYear,"9999":U)) - 1
               tReportPeriod.ReportPeriodIsReported = false.
        
    END. /*  DO viCount = 1 to 12  */

    /* ============================================================ */
    /* 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                      */
    /* ============================================================ */