project QadFinancials > class BBudget > method BudgetWBSUpdateSub

Description

This method is the sub-method of BudgetWBSUpdate which will validate the linked Budget Group & Alternate COA Group Code and retrieve corresponding Alternate COA Group ID & Budget Group ID


Parameters


icBudgetWBSAltCOAGroupCodeinputcharacter
oiUpdRecordAltCOAGroupIDoutputinteger
icBudgetWBSBudgetGroupCodeinputcharacter
oiUpdRecordBudgetGroupIDoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.BudgetWBSUpdate


program code (program6/bbudget.p)

/* ================================================================================== */
/* Validation: if BudgetGroup is filled the it should contain a valid value           */
/* If this check is OK the also assign viBudgetGroupID                                */
/* ================================================================================== */
if icBudgetWBSBudgetGroupCode <> "":U
then do:
    <Q-6 run BudgetGroupPrim (all) (Read) (NoCache)
       (input ?, (BudgetGroupID)
        input icBudgetWBSBudgetGroupCode, (BudgetGroupCode)
        output dataset tqBudgetGroupPrim) in BBudgetGroup >
    find first tqBudgetGroupPrim where
               tqBudgetGroupPrim.tcBudgetGroupCode = icBudgetWBSBudgetGroupCode
               no-lock no-error.
    if not available tqBudgetGroupPrim
    then do:
        assign oiReturnStatus = -3
               vcMessage      = trim(substitute(#T-5'Invalid budget group: &1.':255(999890849)T-5#,icBudgetWBSBudgetGroupCode)).
        <M-7 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-9375':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BBudget>
    end. /* if not av tqBudgetGroupPrim */
    else assign oiUpdRecordBudgetGroupID = tqBudgetGroupPrim.tiBudgetGroup_ID.
end. /* if icBudgetWBSBudgetGroupCode <> "":U */
else assign oiUpdRecordBudgetGroupID = 0.

/* ================================================================================== */
/* Validation: if Alternate COA Group is filled the it should contain a valid value   */
/* If this check is OK the also assign vialtCOAGroupID                                */
/* ================================================================================== */
if icBudgetWBSAltCOAGroupCode <> "":U
then do:
    <Q-4 run AltCOAGroupPrim (all) (Read) (NoCache)
       (input ?, (AltCOAGroupId)
        input icBudgetWBSAltCOAGroupCode, (AltCOAGroupCode)
        output dataset tqAltCOAGroupPrim) in BAltCOAGroup >
    find first tqAltCOAGroupPrim where
               tqAltCOAGroupPrim.tcAltCOAGroupCode = icBudgetWBSAltCOAGroupCode
               no-lock no-error.
    if not available tqAltCOAGroupPrim
    then do :
        assign oiReturnStatus = -3
               vcMessage      = trim(substitute(#T-3'Invalid Alternate COA Group: &1.':255(999890850)T-3#,icBudgetWBSAltCOAGroupCode)).
        <M-2 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-9366':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BBudget>
    end. /* if not av tqAltCOAGroupPrim */
    else assign oiUpdRecordAltCOAGroupID = tqAltCOAGroupPrim.tiAltCOAGroup_ID.
end. /* if icBudgetWBSAltCOAGroupCode <> "":U */
else assign oiUpdRecordAltCOAGroupID = 0.