project QadFinancials > class BJournalEntry > method UpdatePostinglineCCAmts

Description

Method to update the postingline CC amounts.


Parameters


tPostingPostingLineInfoinput-outputtemp-tableInput-output parameter for the PostingPostingLineInfo table
idRateCCinputdecimalExchangte rate.
idRateScaleCCinputdecimalExchange rate scale
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.AdditionalUpdatesAllAssignments
method BDInvoice.AdditionalUpdatesAllAssignments


program code (program5/bjournalentry.p)

assign oiReturnStatus       = -98
       viLocalReturnStatus  = 0.

for each tPosting
no-lock:

    assign  vlUpdatePostings = FALSE.
    
    FIRSTLOOP:
    for each tPostingLine where
             tPostingLine.Posting_ID = tPosting.Posting_ID
    no-lock:
        if can-find(first tPostingPostingLineInfo where
                          tPostingPostingLineInfo.tiPostingLine_ID = tPostingLine.PostingLine_ID)
        then do:
            assign vlUpdatePostings = TRUE.
                   leave FIRSTLOOP.
        end. /* if can-find...*/
    
    end. /* for each tPostingline */

    if vlUpdatePostings = TRUE
    then do:
        for each tPostingLine where
             tPostingLine.Posting_ID = tPosting.Posting_ID
        exclusive-lock:
            assign vlCurrencyFetched = TRUE.

            <M-75 run CalculateCCAmount
               (input  tPosting.Company_ID (iiCompanyID), 
                input  tPostingLine.PostingLineCreditLC (idPostingLineCreditLC), 
                input  tPostingLine.PostingLineCreditTC (idPostingLineCreditTC), 
                input  tPostingLine.PostingLineDebitLC (idPostingLineDebitLC), 
                input  tPostingLine.PostingLineDebitTC (idPostingLineDebitTC), 
                input  tPosting.PostingDate (itPostingDate), 
                input  tPostingLine.tcCurrencyCode (icCurrencyCode), 
                input  tPosting.PostingDate (itInvoiceExchangeRateDate), 
                input-output idRatecc (bdCCExchangeRate), 
                input-output idRateScaleCC (bdCCExchangeRateScale), 
                input-output vlCurrencyFetched (blCurrencyFetched), 
                output tPostingLine.PostingLineCreditCC (odPostingLineCreditCC), 
                output tPostingLine.PostingLineDebitCC (odPostingLineDebitCC), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>.
            if viFcReturnSuper <> 0 
            then assign viLocalReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0 then leave. 
        
            Assign tPostingLine.PostingLineCCRate                = idRatecc
                   tPostingLine.PostingLineCCScale               = idRateScaleCC.

            find first tPostingPostingLineInfo where
                       tPostingPostingLineInfo.tiPostingLine_ID = tPostingLine.PostingLine_ID
            exclusive-lock no-error.
            if available tPostingPostingLineInfo
            then do:
                assign tPostingPostingLineInfo.tcJournalCode         = tPosting.tcJournalCode
                       tPostingPostingLineInfo.tcLayerTypeCode       = tPosting.tcLayerTypeCode
                       tPostingPostingLineInfo.tdPostingLineCreditLC = tPostingLine.PostingLineCreditLC
                       tPostingPostingLineInfo.tdPostingLineCreditTC = tPostingLine.PostingLineCreditTC
                       tPostingPostingLineInfo.tdPostingLineCreditCC = tPostingLine.PostingLineCreditCC
                       tPostingPostingLineInfo.tdPostingLineDebitLC  = tPostingLine.PostingLineDebitLC
                       tPostingPostingLineInfo.tdPostingLineDebitTC  = tPostingLine.PostingLineDebitTC
                       tPostingPostingLineInfo.tdPostingLineDebitCC  = tPostingLine.PostingLineDebitCC.
            end. /* if available tPostingPostingLineInfo */
        end.     /* for each tPostingLine */
    end.         /* if vlUpdatePostings = TRUE */
end.             /* For each tPosting */



assign oiReturnStatus = viLocalReturnStatus.