project QadFinancials > class BBudget > method BudgetCheckInfoResolveSaf

Description

This method is just a submethod of the instanceless method BudgetCheckInfoResolve that will resolve the saf-structure and the saf-concepts.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.BudgetCheckInfoResolve


program code (program8/bbudget.p)

/* ========================= */
    /* Set default Return Status */
    /* ========================= */
    assign oiReturnStatus = -98.
    
    /* ================================================================================= */
    /* Make sure field tBudgetCheckInfo.tiBudgetCheckInfoID is unique in the temp-table  */
    /* ================================================================================= */
    if can-find (first btBudgetCheckInfo where 
                       btBudgetCheckInfo.tiBudgetCheckInfoID  = tBudgetCheckInfo.tiBudgetCheckInfoID and 
                       rowid(btBudgetCheckInfo)              <> rowid(tBudgetCheckInfo))
    then do :
        assign oiReturnStatus = -1
               vcMessage      = trim(substitute(#T-31'The information in the input table for the budget check should be unique by the field &1.':200(711)T-31#,"tiBudgetCheckInfoID":U)).
        <M-16 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-2057':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
        return.
    end. /* if can-find */
    
    /* ======================================================================================== */
    /* Prerequisites;                                                                           */
    /* - This method should be in the same segment as the caller                                */
    /* - Following records should be available: tBudgetCheckInfo                                */
    /* ======================================================================================== */
    if tBudgetCheckInfo.tcSafStructureCode <> "":U and 
       tBudgetCheckInfo.tcSafStructureCode <> ?    and 
       (tBudgetCheckInfo.tiSafStructureID = 0 or 
        tBudgetCheckInfo.tiSafStructureID = ?)
    then do :
        if vlResolveStartedSafStructPrim = false
        then do :
            assign vlResolveStartedSafStructPrim = true.
            <Q-38 run SafStructurePrim  (Start) in BSafStructure >
        end.
        <Q-1 run SafStructurePrim (all) (Read) (Cache)
          (input ?, (SafStructureID)
           input tBudgetCheckInfo.tcSafStructureCode, (SafStructureCode)
           output dataset tqSafStructurePrim) in BSafStructure >
        find first tqSafStructurePrim no-lock no-error.
        if not available tqSafStructurePrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-32'Cannot find the SAF structure based on its code (&1).':255(712)t-32#,tBudgetCheckInfo.tcSafStructureCode)).
            <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-1751':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafStructurePrim */
        assign tBudgetCheckInfo.tiSafStructureID = tqSafStructurePrim.tiSafStructure_ID.
    end. /* if tBudgetCheckInfo.tcSafStructureCode <> "":U and */
    if tBudgetCheckInfo.tcSafConcept1Code <> "":U and 
       tBudgetCheckInfo.tcSafConcept1Code <> ?    and 
       (tBudgetCheckInfo.tiSafConcept1ID = 0 or 
        tBudgetCheckInfo.tiSafConcept1ID = ?)
    then do :
        if vlResolveStartedSafConceptPrim = false
        then do :
            assign vlResolveStartedSafConceptPrim = true.
            <Q-39 run SafConceptPrim  (Start) in BSafConcept >
        end.
        <Q-5 run SafConceptPrim (all) (Read) (Cache)
          (input ?, (SafConceptID)
           input tBudgetCheckInfo.tcSafConcept1Code, (SafConceptCode)
           output dataset tqSafConceptPrim) in BSafConcept >
        find first tqSafConceptPrim no-lock no-error.
        if not available tqSafConceptPrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-33'Cannot find the SAF concept based on its code (&1).':255(713)t-33#,tqSafConceptPrim.tcSafConceptCode)).
            <M-4 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-1752':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafConceptPrim */
        assign tBudgetCheckInfo.tiSafConcept1ID = tqSafConceptPrim.tiSafConcept_ID.
    end. /* if tBudgetCheckInfo.tcSafConcept1Code <> "":U and */
    if tBudgetCheckInfo.tcSafConcept2Code <> "":U and 
       tBudgetCheckInfo.tcSafConcept2Code <> ?    and 
       (tBudgetCheckInfo.tiSafConcept2ID = 0 or 
        tBudgetCheckInfo.tiSafConcept2ID = ?)
    then do :
        if vlResolveStartedSafConceptPrim = false
        then do :
            assign vlResolveStartedSafConceptPrim = true.
            <Q-40 run SafConceptPrim  (Start) in BSafConcept >
        end.
        <Q-6 run SafConceptPrim (all) (Read) (Cache)
          (input ?, (SafConceptID)
           input tBudgetCheckInfo.tcSafConcept2Code, (SafConceptCode)
           output dataset tqSafConceptPrim) in BSafConcept >
        find first tqSafConceptPrim no-lock no-error.
        if not available tqSafConceptPrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-34'Cannot find the SAF concept based on its code (&1).':255(713)t-34#,tqSafConceptPrim.tcSafConceptCode)).
            <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-1753':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafConceptPrim */
        assign tBudgetCheckInfo.tiSafConcept2ID = tqSafConceptPrim.tiSafConcept_ID.
    end. /* if tBudgetCheckInfo.tcSafConcept2Code <> "":U and */
    if tBudgetCheckInfo.tcSafConcept3Code <> "":U and 
       tBudgetCheckInfo.tcSafConcept3Code <> ?    and 
       (tBudgetCheckInfo.tiSafConcept3ID = 0 or 
        tBudgetCheckInfo.tiSafConcept3ID = ?)
    then do :
        if vlResolveStartedSafConceptPrim = false
        then do :
            assign vlResolveStartedSafConceptPrim = true.
            <Q-41 run SafConceptPrim  (Start) in BSafConcept >
        end.
        <Q-8 run SafConceptPrim (all) (Read) (Cache)
          (input ?, (SafConceptID)
           input tBudgetCheckInfo.tcSafConcept3Code, (SafConceptCode)
           output dataset tqSafConceptPrim) in BSafConcept >
        find first tqSafConceptPrim no-lock no-error.
        if not available tqSafConceptPrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-35'Cannot find the SAF concept based on its code (&1).':255(713)t-35#,tqSafConceptPrim.tcSafConceptCode)).
            <M-9 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-1754':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafConceptPrim */
        assign tBudgetCheckInfo.tiSafConcept3ID = tqSafConceptPrim.tiSafConcept_ID.
    end. /* if tBudgetCheckInfo.tcSafConcept3Code <> "":U and */
    if tBudgetCheckInfo.tcSafConcept4Code <> "":U and 
       tBudgetCheckInfo.tcSafConcept4Code <> ?    and 
       (tBudgetCheckInfo.tiSafConcept4ID = 0 or 
        tBudgetCheckInfo.tiSafConcept4ID = ?)
    then do :
        if vlResolveStartedSafConceptPrim = false
        then do :
            assign vlResolveStartedSafConceptPrim = true.
            <Q-42 run SafConceptPrim  (Start) in BSafConcept >
        end.
        <Q-10 run SafConceptPrim (all) (Read) (Cache)
          (input ?, (SafConceptID)
           input tBudgetCheckInfo.tcSafConcept4Code, (SafConceptCode)
           output dataset tqSafConceptPrim) in BSafConcept >
        find first tqSafConceptPrim no-lock no-error.
        if not available tqSafConceptPrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-36'Cannot find the SAF concept based on its code (&1).':255(713)t-36#,tqSafConceptPrim.tcSafConceptCode)).
            <M-11 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-1749':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafConceptPrim */
        assign tBudgetCheckInfo.tiSafConcept4ID = tqSafConceptPrim.tiSafConcept_ID.
    end. /* if tBudgetCheckInfo.tcSafConcept4Code <> "":U and */
    if tBudgetCheckInfo.tcSafConcept5Code <> "":U and 
       tBudgetCheckInfo.tcSafConcept5Code <> ?    and 
       (tBudgetCheckInfo.tiSafConcept5ID = 0 or 
        tBudgetCheckInfo.tiSafConcept5ID = ?)
    then do :
        if vlResolveStartedSafConceptPrim = false
        then do :
            assign vlResolveStartedSafConceptPrim = true.
            <Q-43 run SafConceptPrim  (Start) in BSafConcept >
        end.
        <Q-12 run SafConceptPrim (all) (Read) (Cache)
          (input ?, (SafConceptID)
           input tBudgetCheckInfo.tcSafConcept5Code, (SafConceptCode)
           output dataset tqSafConceptPrim) in BSafConcept >
        find first tqSafConceptPrim no-lock no-error.
        if not available tqSafConceptPrim
        then do :
            assign oiReturnStatus = -1
                   vcMessage      = trim(substitute(#T-37'Cannot find the SAF concept based on its code (&1).':255(713)t-37#,tqSafConceptPrim.tcSafConceptCode)).
            <M-13 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-1750':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBudget>
            return.
        end. /* if not available tqSafConceptPrim */
        assign tBudgetCheckInfo.tiSafConcept5ID = tqSafConceptPrim.tiSafConcept_ID.
    end. /* if tBudgetCheckInfo.tcSafConcept5Code <> "":U and */
    
    /* =========================== */
    /* Reset default Return Status */
    /* =========================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.