project QadFinancials > class BJournalEntry > method GetPostingAmount

Description

this method will look in the instance tables for a posting and return the amounts of all his posting lines


Parameters


iiPostingIdinputintegerPosting ID
odPostingAmountDebitLCoutputdecimalPostingAmountDebitLC
odPostingAmountCreditLCoutputdecimalPosting Amount in CreditLC;
odPostingAmountCreditTCoutputdecimalPosting Amount in CreditTC
odPostingAmountCreditCCoutputdecimalPosting Amount in CreditCC
odPostingAmountDebitTCoutputdecimalPostingAmountDebitTC
odPostingAmountDebitCCoutputdecimalPostingAmountDebitCC
ocCurrencyCodeoutputcharacterCurrency code of the posting. This parameter is filled in only when all posting lines have the same currencly. Otherwise it is blank.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.UpdateCInvoiceFromUIAPM
method BAPMatching.ValidateComponentPost
method BBankEntry.AdditionalUpdatesInvRounding
method BBankEntry.GetJournalEntryBalance
method BBankEntry.GetPostingAmount
method BBankEntry.GetPostingAmountLC
method BCDocument.AdditionalUpdatesPostingRounding
method BDDocument.AdditionalUpdatesPostingRounding
method BOpenItemAdjustment.OIAdjJournalEntryBalance


program code (program7/bjournalentry.p)

assign oiReturnStatus = -98
       viLocalReturn  = 0.
       
MAINBLOCK:
do on error undo, leave:

    /* ======================================================= *
     * Default values of output parameters                     *
     * ======================================================= */
    assign ocCurrencyCode    = ?
           vlIsMultiCurrency = false.

    /* =============== */
    /* get the posting */
    /* =============== */
    find first tPosting where
               tPosting.Posting_ID = iiPostingId
               no-error.
    if not available tPosting or
       tPosting.tc_Status = "D":U
    then leave MAINBLOCK.

    /* ========================================= */
    /* search the lines and calculate the amount */
    /* ========================================= */
    for each tPostingLine where
             tPostingLine.tc_ParentRowid  = tPosting.tc_Rowid and
             tPostingLine.tc_Status      <> "D":U :
        
        /* ======================================================= */
        /* Check, if the posting contains only one currency or not */
        /* ======================================================= */
        if ocCurrencyCode <> ? and
           ocCurrencyCode <> tPostingLine.tcCurrencyCode
        then assign vlIsMultiCurrency = true.
        assign ocCurrencyCode = tPostingLine.tcCurrencyCode.
                
        /* ================================================================ */
        /* Cumulate posting amounts                                         */
        /* ================================================================ */
        accumulate tPostingLine.PostingLineDebitTC(TOTAL).
        accumulate tPostingLine.PostingLineCreditTC(TOTAL).
        accumulate tPostingLine.PostingLineDebitLC(TOTAL).
        accumulate tPostingLine.PostingLineCreditLC(TOTAL).
        accumulate tPostingLine.PostingLineDebitCC(TOTAL).
        accumulate tPostingLine.PostingLineCreditCC(TOTAL).
        
    end. /* for each tPostingLine where */
  
    /* ============================= */
    /* Output parameters assignment  */
    /* ============================= */
    assign odPostingAmountCreditLC = accum total tPostingLine.PostingLineCreditLC
           odPostingAmountCreditTC = accum total tPostingLine.PostingLineCreditTC
           odPostingAmountCreditCC = accum total tPostingLine.PostingLineCreditCC
           odPostingAmountDebitLC  = accum total tPostingLine.PostingLineDebitLC
           odPostingAmountDebitTC  = accum total tPostingLine.PostingLineDebitTC
           odPostingAmountDebitCC  = accum total tPostingLine.PostingLineDebitCC.
    if vlIsMultiCurrency
    then assign ocCurrencyCode = ?.
    
end. /* of MAINBLOCK */

assign oiReturnStatus = viLocalReturn.