project QadFinancials > class BFRWTreeView > method GetFRWTreeViewBalance

Description

Get FRWTreeView balance data for the FRWTreeViewDrillDown form.


Parameters


icTargetChartinputcharacter
icCubeNameinputcharacter
icTreeNodeCodeinputcharacter
icFilterAnCodeinputcharacter
icFromReportYearinputcharacter
icFromReportPeriodinputcharacter
icToReportYearinputcharacter
icToReportPeriodinputcharacter
icAmountInViewinputcharacter
tFRWTreeViewSrcTableoutputtemp-table
bcTempParamsinput-outputcharacter
ocAmountFormatoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bfrwtreeview.p)

assign oiReturnStatus = -98
       ocAmountFormat = ?.  /* #,##0.00 */

/* get AmountInViwe value base RowId */
<M-13 run DataLoad
   (input  icAmountInView (icRowids), 
    input  '':U (icPkeys), 
    input  '':U (icObjectIds), 
    input  '':U (icFreeform), 
    input  no (ilKeepPrevious), 
    output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
find first tFRWTreeView no-error.
if available tFRWTreeView
then do:

    /* FRWTREEVIEWAMOUNTSTYPE-SRCCURR */

    assign viNumOfDecimals = 0.

    if tFRWTreeView.FRWTreeViewAmountsIn = {&FRWTREEVIEWAMOUNTSTYPE-SRCCURR}
    then do:
        assign viNumOfDecimals = 2
               ocAmountFormat  = "#,##0.00":U.    
    end.
    else do:
        /* get cube currency code */
        <Q-41 run FRWCubeById (all) (Read) (NoCache)
           (input tFRWTreeView.FRWCube_ID, (CubeId)
            output dataset tqFRWCubeById) in BFRWCube>
        for first tqFRWCubeById:
            <Q-10 run CurrencyByCode (all) (Read) (NoCache)
               (input tqFRWCubeById.tcFRWCubeCurrencyCode, (CurrencyCode)
                output dataset tqCurrencyByCode) in BCurrency>
            /* get currency number of decimals */
            for first tqCurrencyByCode:
                assign viNumOfDecimals = tqCurrencyByCode.tiCurrencyNumberOfDecimals.
            end.
        end. 

        /* set the amount format base number of decimals */
        if viNumOfDecimals = 0
        then assign ocAmountFormat = "#,##0":U.
        else do:
            assign ocAmountFormat = "#,##0.":U
                   viIndex = 0. 
            do while viIndex < viNumOfDecimals:
                assign ocAmountFormat = ocAmountFormat + "0":U
                       viIndex = viIndex + 1. 
            end.
        end.
    end.

    assign icAmountInView = tFRWTreeView.FRWTreeViewAmountsIn.
end.

/* make sure the format is set */
if ocAmountFormat = ?
then assign ocAmountFormat = "#,##0.00":U.

<M-28 run GetFRWTreeNodeMainMethod
   (input  icTargetChart (icTargetChart), 
    input  icCubeName (icCubeName), 
    input  icTreeNodeCode (icTreeNodeCode), 
    input  icFilterAnCode (icFilterAnCode), 
    input  icFromReportPeriod (icFromReportPeriod), 
    input  icToReportPeriod (icToReportPeriod), 
    input  icFromReportYear (icFromReportYear), 
    input  icToReportYear (icToReportYear), 
    input  ? (icViewCurrency), 
    input  vcUserLogin (icViewForUser), 
    input  icAmountInView (icAmountInView), 
    input  ? (iiNodeID), 
    input  2 (iiNodeLevel), 
    output tFRWTreeViewSrcTable (tNewNode), 
    output tFRWTreeViewErrorTable (tErrorTable), 
    input  current-language (icCurrentLanguage), 
    input-output bcTempParams (bcTempParams), 
    input  viNumOfDecimals (iiNumOfDecimals), 
    output viFcReturnSuper (oiReturnStatus)) in TFRWTreeView>

if viFcReturnSuper < 0 or viFcReturnSuper <> 0 then
do:
    assign oiReturnStatus = viFcReturnSuper.
    for each tFRWTreeViewErrorTable no-lock:

         <M-21 run SetMessage
            (input  tFRWTreeViewErrorTable.tcErrorMessage (icMessage), 
             input  '':U (icArguments), 
             input  tFRWTreeViewErrorTable.tcFieldName (icFieldName), 
             input  tFRWTreeViewErrorTable.tcFieldValue (icFieldValue), 
             input  'E':U (icType), 
             input  3 (iiSeverity), 
             input  '':U (icRowid), 
             input  'qadfin-422745':U (icFcMsgNumber), 
             input  '':U (icFcExplanation), 
             input  '':U (icFcIdentification), 
             input  '':U (icFcContext), 
             output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
    end.
end.
else assign oiReturnStatus = 0.