| iiPostingId | input | integer | Posting ID |
| odPostingAmountDebitLC | output | decimal | PostingAmountDebitLC |
| odPostingAmountCreditLC | output | decimal | Posting Amount in CreditLC; |
| odPostingAmountCreditTC | output | decimal | Posting Amount in CreditTC |
| odPostingAmountCreditCC | output | decimal | Posting Amount in CreditCC |
| odPostingAmountDebitTC | output | decimal | PostingAmountDebitTC |
| odPostingAmountDebitCC | output | decimal | PostingAmountDebitCC |
| ocCurrencyCode | output | character | Currency code of the posting. This parameter is filled in only when all posting lines have the same currencly. Otherwise it is blank. |
| oiReturnStatus | output | integer | Return status of the method. |
QadFinancials
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.