project QadFinancials > class BDPaymentSelection > method CalculateStagedLineAmounts


Parameters


iiDPaySelLineIDinputinteger
icBankCurrencyCodeinputcharacter
idBankExchangeRateinputdecimal
idBankExchangeRateScaleinputdecimal
odTotalLineAmountBCoutputdecimal
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDPaymentSelection.StoreSelectedObjects


program code (program4/bdpaymentselection.p)

find first tDPaySelLine where tDPaySelLine.DPaySelLine_ID = iiDPaySelLineID.
if available tDPaySelLine
then do:
    assign
        vdLinePaymentAmount  = 0
        vdLineDiscountAmount = 0.
    for each tDPaySelLineStg where tDPaySelLineStg.DPaySelLine_ID = tDPaySelLine.DPaySelLine_ID:
        assign 
            vdLinePaymentAmount  =  vdLinePaymentAmount + tDPaySelLineStg.DPaySelLineStgPaymAmtTC
            vdLineDiscountAmount =  vdLineDiscountAmount + tDPaySelLineStg.DPaySelLineStgDiscAmtTC.                        
    end. /* for each tDPaySelLineStg */ 
    assign 
        tDPaySelLine.DPaySelLineAmountTC    = vdLinePaymentAmount
        tDPaySelLine.DPaySelLineDiscountTC  = vdLineDiscountAmount.
        odTotalLineAmountBC   = <M-12 RoundAmount
                               (input  vdLinePaymentAmount * tDPaySelLine.tdInvoiceRate * tDPaySelLine.tdInvoiceRateScale / (idBankExchangeRate * idBankExchangeRateScale) (idUnroundedAmount), 
                                input  '':U (iiCurrencyID), 
                                input  icBankCurrencyCode (icCurrencyCode)) in BApplicationProperty>.     
end. /* for each tDPaySelLine */