project QadFinancials > class BPosting > method AdditionalUpdatesPre

Description

Additional Updates before ANCESTOR Code.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.AdditionalUpdates


program code (program5/bposting.p)

/* ================== */
/* Exception Handling */
/* ================== */
assign oiReturnStatus      = -98
       viLocalReturnStatus = 0
       viBlockReturnStatus = 0.

/* ================= */
/* Empty Temp-tables */
/* ================= */
empty temp-table tPostingGLOpenItemMov.
empty temp-table tApiQPostingSaf.
empty temp-table tApiQPostingLineBank.
empty temp-table tApiQPostingSafBank.


/* ================================ */
/* Start block                      */
/* ================================ */
ADDUPDPREBLOCK : DO :

    /* ================================ */
    /* Start block                      */
    /* Loop through all posting records */
    /* ================================ */
    for each tPosting:

        /* ================================================================================================================================================== */
        /* Additional GL Number                                                                                                                               */
        /* Note that in here class BPosting might be Started&Opened with AddToTrx=-false and that the class will be stopped after the main loop in this class */
        /* ================================================================================================================================================== */
        if (tPosting.tc_Status = "N":U or tPosting.tc_Status = "C":U) and
           (tPosting.PostingAddGLNbr <= 0 or tPosting.PostingAddGLNbr = ?) and
           (tPosting.tcLayerTypeCode = {&LAYERTYPECODE-OFFICIAL} or
            tPosting.tcLayerTypeCode = {&LAYERTYPECODE-MANAGEMENT})
        then do:
            <M-1 run AdditionalUpdatesPreAddGLNumber
               (input-output vlStartQueryCompPropByIDAllInfo (blStartQueryCompPropyIDAllInfo), 
                output viFcReturnSuper (oiReturnStatus)) in BPosting>
            if viFcReturnSuper <> 0
            then assign viBlockReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then leave ADDUPDPREBLOCK.
        end. /* if tPosting.tc_status = "N":U and  */
    
        /* ======================================== */
        /* Check if header-information was modified */
        /* ======================================== */
        assign vlPostingChanged = false.
        find t_iPosting where
             t_iPosting.tc_Rowid = tPosting.tc_Rowid
             no-error.
        if tPosting.tc_Status   = "C":U                 and
           available t_iPosting                         and
          (tPosting.Journal_ID <> t_iPosting.Journal_ID or
           tPosting.Period_ID  <> t_iPosting.Period_ID)
        then assign vlPostingChanged = true.
        
        /* ======================================================== */
        /* Create the temp-tables used to pass to other components. */
        /* ======================================================== */
        <M-2 run AdditionalUpdatesPreCreateTempTables
           (input  vlPostingChanged (ilPostingChanged), 
            output viFcReturnSuper (oiReturnStatus)) in BPosting>
        if viFcReturnSuper <> 0
        then assign viBlockReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then leave ADDUPDPREBLOCK.
        
    end. /* for each tPosting */

END. /* ADDUPDPREBLOCK */

/* ========================================================================================== */
/* Capture returnstatus of within the block                                                   */
/* Stop query that might be started in the previous loop                                      */
/* Close&Stop BNumber that might be started with a different transaction in the previous loop */
/* ========================================================================================== */
assign viLocalReturnStatus = viBlockReturnStatus.
if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ?
then do :
    <I-83 {bFcCloseAndStopInstance
         &CLASS           = "BNumber"}>
end. /* if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ? */
if vlStartQueryCompPropByIDAllInfo
then do:
    <Q-67 run CompanyPropertyByIDAllInfo  (Stop) in BCompanyProperty >
end. /* if vlStartQueryCompPropByIDAllInfo */

/* ================== */
/* Exception Handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.