project QadFinancials > class BBudget > method AdditionalUpdValBudgetVersionFig

Description

This method will check the usage of the 2 types of VersionFigure records.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.AdditionalUpdates


program code (program4/bbudget.p)

/* ==================================================================== */
    /* Check on the VersionFigures;                                         */
    /*  - GL-budgets (no Prj, no CC) can only use table BudgetVersionGLFig  */
    /*  - Other-budgets (Prj or CC) can only use table BudgetVersionFigure  */
    /* ==================================================================== */
    for each tBudget where
             tBudget.tc_Status <> "D":U no-lock :
        if can-find (first tBudgetVersionGLFig where 
                           tBudgetVersionGLFig.tc_Status <> "D":U) and 
           ((tBudget.Project_ID <> 0 and tBudget.Project_ID <> ?) or
            (tBudget.CostCentre_ID <> 0 and tBudget.CostCentre_ID <> ?)) 
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-3'The budget figures for a project or cost center budget (&1) should not be stored in table &2. Note that this table is only for GL budgets.':255(605)T-3#,tBudget.BudgetCode,"BudgetVersionGLFig":U)).
            <M-1 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tBudget.BudgetCode':U (icFieldName),
                     input  tBudget.BudgetCode (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-1096':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
        end. /* if can-find (first tBudgetVersionGLFig where  */
        if can-find (first tBudgetVersionFig where 
                           tBudgetVersionFig.tc_Status <> "D":U) and 
           ((tBudget.Project_ID = 0 or tBudget.Project_ID = ?) and
            (tBudget.CostCentre_ID = 0 or tBudget.CostCentre_ID = ?)) 
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-4'The budget figures of a GL budget (&1) should not be stored in table &2. This table is only for project or cost center budgets.':255(606)t-4#,tBudget.BudgetCode,"BudgetVersionFigure":U)).
            <M-2 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tBudget.BudgetCode':U (icFieldName),
                     input  tBudget.BudgetCode (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-1097':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
        end. /* if can-find (first tBudgetVersionGLFig where  */
    end. /* for each tBudget where */