project QadFinancials > class BPosting > method AdditionalUpdatesPreAddGLNumber

Description

Additional Updates Pre: Additional GL Number


Parameters


blStartQueryCompPropyIDAllInfoinput-outputlogicalIs Query tqCompanyPropertyByIDAllInfo already started or not ?
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.AdditionalUpdatesPre


program code (program5/bposting.p)

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

ADDGLNUMBERBLOCK: DO :

    /* ===================================================================================================== */
    /* Call subnmethod that will check if additional-numbering is needed and if so, return all required info */
    /* ===================================================================================================== */
    <M-3 run AdditionalUpdatesPreAddGLNumberDet
       (input  tPosting.Company_ID (iiCompanyId), 
        input  tPosting.PostingYear (iiPostingYear), 
        input  tPosting.tcJournalCode (icJournalCode), 
        output tPosting.tiSharedCompanyId (oiSharedCompanyId), 
        output tPosting.tiYearForNbr (oiNumberYear), 
        output tPosting.tlIsAddGLNbr (olIsAddNbr), 
        input-output blStartQueryCompPropyIDAllInfo (blStartQueryCompPropByIDAllInfo), 
        output viFcReturnSuper (oiReturnStatus)) in BPosting>

    if viFcReturnSuper <> 0
    then viLocalReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then leave ADDGLNUMBERBLOCK.
    
    /* ===================================================================================================== */
    /* Take additional-numbering when needed                                                                 */
    /* ===================================================================================================== */
    if tPosting.tlIsAddGLNbr       = true and
       tPosting.tiSharedCompanyId <> 0    and
       tPosting.tiSharedCompanyId <> ?    and
       tPosting.tiYearForNbr      <> 0    and
       tPosting.tiYearForNbr      <> ?
    then do: 
        
        /* =============================================================================================== */
        /* Start&Open BNumber (AddToTrx=false) as we are in a loop here and will thus be calling BNumber   */
        /* repetively and this is more performing then using vhFcComponent=?. BNumber will be closed and   */
        /* stopped after the loop (see parent methods)                                                     */
        /* =============================================================================================== */
        if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ?
        then do :
            <I-70 {bFcStartAndOpenInstance
                 &ADD-TO-TRANSACTION   = "false"
                 &CLASS                = "BNumber"}>
        end. /* if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ? */
        
        /* =============================================================================================== */
        /* Call BNumber:GteNumber and add the rowid of the posting to tCommitNumber                        */
        /* =============================================================================================== */
        <M-2 run GetNumber
            (input  tPosting.tiSharedCompanyId (iiCompanyId), 
             input  tPosting.tiYearForNbr (iiNumbrYear), 
             input  {&FIXEDJOURNALTYPE} (icNumbrType), 
             output tPosting.PostingAddGLNbr (oiNumber), 
             input  viFcCurrentInstanceId (iiInstanceId), 
             input  vcFcComponentName (icClassName), 
             output viFcReturnSuper (oiReturnStatus)) in BNumber>

         if viFcReturnSuper <> 0
         then viLocalReturnStatus = viFcReturnSuper.
         if viFcReturnSuper < 0
         then leave ADDGLNUMBERBLOCK.

         if not can-find (tCommitNumber where
                          tCommitNumber.tcNumberType   = {&COMMITNUMBERTYPE-POSTINGADDGLNBR} and
                          tCommitNumber.tcPostingRowID = tPosting.tc_Rowid)
         then do :
             create tCommitNumber.
             assign tCommitNumber.tcNumberType   = {&COMMITNUMBERTYPE-POSTINGADDGLNBR}
                    tCommitNumber.tcPostingRowID = tPosting.tc_Rowid.             
         end.
     end. /* if tPosting.tlIsAddGLNbr       = true and */
     
END. /* ADDGLNUMBERBLOCK */

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