project QadFinancials > class BBankEntry > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BBankEntry.ApiCreateBankEntryFromImport
method BBankEntry.ApiStdMaintainTT
method BBankEntry.ValidateBCAndAdditionalUpdates

QadFitnesse
method BBankEntry.ApiBankingEntryCreate


program code (program/bbankentry.p)

    /* ============================================================================== */
    /* Set the status of the BE and the BE-lines based on the data of the allocations */
    /* ============================================================================== */
    <M-62 run AdditionalUpdatesAssignments (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then return.
    
    /* ==================================================== */
    /* Stop all external instances except the journal entry */
    /* Only do it here because you only have to set the     */
    /* posting id on zero when bankstateline is unalloacted */
    /* ==================================================== */
    <M-67 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then return.
    
    /* ======================== */
    /* Perform some validations */
    /* ======================== */
    <M-64 run AdditionalUpdatesValidations (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then return.
    
    /* ======================================================================== */
    /* If needed: call a submethod that will perform all actions related to the */ 
    /* CI, DI, C-Doc, D-Doc and the linked variance postings. It also contains  */
    /* the optimistic-lcok checks for the involved instances                    */
    /* So when you modify a partial alloc bankstate, and delete an unallocated  */
    /* line, then the  method is not executed.                                  */
    /* ======================================================================== */
    assign vlAddUpdInv = false.
    for each tBankState where
             tBankState.tc_Status <> "D":U and
            (tBankState.BankStateStatus = {&BANKSTATESTATUS-PARTALLOC} or
             tBankState.BankStateStatus = {&BANKSTATESTATUS-ALLOC}) :
        assign vlAddUpdInv = if can-find (first tbankstateline where
                                                tBankStateLine.tc_ParentRowid = tBankState.tc_Rowid and
                                                tBankStateLine.tc_Status <> "D":U and
                                                (tBankStateLine.BankStateLineStatus = {&BANKSTATELINESTATUS-ALLOC} or
                                                 tBankStateLine.BankStateLineStatus = {&BANKSTATELINESTATUS-PARTALLOC}))
                             then true
                             else false.
        if vlAddUpdInv
        then leave.
    end. /* for each tBankState where */
    if vlAddUpdInv = true
    then do:
        <M-26 run AdditionalUpdatesInv (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 
        then do:
            <M-68 run StopExternalInstances
               (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
            return.
        end. /* if viFcReturnSuper < 0 */
    end. /* if vlAddUpdInv */
    
    if vhBJournalEntryBEInst               = ? or
       valid-handle(vhBJournalEntryBEInst) <> true
    then do :
        <I-27 {bFcOpenInstance
             &CLASS           = "BJournalEntry"}>
    end.
    for each tBankState where
             tBankState.tc_Status <> "D":U and
            (tBankState.BankStateStatus = {&BANKSTATESTATUS-PARTALLOC} or
             tBankState.BankStateStatus = {&BANKSTATESTATUS-ALLOC}),
        each tBankStateLine where
             tBankStateLine.tc_ParentRowid      = tBankState.tc_Rowid              and
             tBankStateLine.BankStateLineStatus = {&BANKSTATELINESTATUS-ALLOCPOST} and 
            (tBankStateLine.tc_status = "N":U or
             tBankStateLine.tc_status = "C":U):
             
         <M-48 run CreateRoundingPosting
            (input  tBankStateLine.tcPostingRowId (icPostingRowID), 
             output viRoundingPostingLineID (oiPostingLineID), 
             output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>

         assign vcBankPostingLineId = if vcBankPostingLineId = "":U
             then string(viRoundingPostingLineID )
             else vcBankPostingLineId + ",":U + string(viRoundingPostingLineID).
    
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then do:
            <I-63 {bFcCloseInstance
                 &CLASS           = "BJournalEntry"}>
            return.
        end.        

    end.     
    
    /* ========================================================================================================= */
    /* Normally we would here close BJournalEntry but we will not do it for performance                          */
    /* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it.     */
    /* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the  */
    /* appserver that is executed after each call to the appserver                                               */
    /* ========================================================================================================= */
    
    
    /* ========================================== */
    /* Perform some validations on the LC-amounts */
    /* ========================================== */
    <M-6 run AdditionalUpdatesValidationsLC  (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then  return.   
    
    /* ======================================================================= */
    /* When on first save of Banking entry errors or warnings occur and second */
    /* save is required with allocations removed then */
    /* Journal entries , History and Budget data has to be validated again if */
    /* JE is started from Banking entry */
    /* ======================================================================= */
    if vlBJEIsStartedFromBE = true and
       viBJournalEntryBEID <> 0 and
       viBJournalEntryBEID <> ?
    then do :
        if vhBJournalEntryBEInst               = ? or
           valid-handle(vhBJournalEntryBEInst) <> true
        then do :
            <I-12 {bFcOpenInstance
            &CLASS           = "BJournalEntry"}>
        end. /* if */
        <M-13 run SetPublicData
           (input  'vlPostingMustBeBalanced':U (icDataList), 
            input  'true':U (icValueList), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then do:
            <I-14 {bFcCloseInstance
            &CLASS           = "BJournalEntry"}>
            assign vcMessage = trim(substitute(#T-60'Internal error. The system was unable to set property '&1' in the journal entry component.':150(375)T-60#, "vlPostingMustBeBalanced":U)).
            <M-15 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-834':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
            return.
        end. /* if oiReturnStatus < 0 */
        <M-16 run ValidateBCAndAdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>       
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then do:
            assign vcMessage = trim(substitute(#T-61'Error &1 occurred when validating the journal entry.':150(376)T-61#, string(viFcReturnSuper))).
            <M-28 run SetPublicData (input  'vlPostingMustBeBalanced':U (icDataList), 
                                    input  'false':U (icValueList), 
                                    output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
            <I-29 {bFcCloseInstance
            &CLASS           = "BJournalEntry"}>
            <M-30 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-1331':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
            <M-69 run StopExternalInstances
               (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
            Return.
        end. /* if oiReturnStatus < 0 */

    end. /* if vlPostingValidationsNeeded = true */
    

    if vlCreateBEFromBankImpLineBatch then
    do:
        <M-41 run AdditionalUpdatesBankImpLine  (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 then  return.   
    end.

    /* ========================================================================================================= */
    /* Normally we would here close BJournalEntry but we will not do it for performance                          */
    /* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it.     */
    /* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the  */
    /* appserver that is executed after each call to the appserver                                               */
    /* ========================================================================================================= */
              
         
<ANCESTOR-CODE>