Description
this method give the amount of the posting nl sum of the posting lines
=> called by UI when closing GL&O/I GL, and when allocating a line
Parameters
| iiBJournalEntryId | input | integer | Instance of BJournalEntry |
| iiPostingId | input | integer | Posting ID |
| odPostingAmountLC | output | decimal | Posting Amount in LC |
| odPostingAmountTC | output | decimal | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bbankentry.p)
/* ======================================================================================== */
/* If an instance of BJournalEntry is started, then the instance contains all information */
/* If no instance of BJournalEntry is started yet, then we retrieve the information from db */
/* Only 1 of both options can be used at the same time! */
/* ======================================================================================== */
/* ====================== */
/* replace unknown values */
/* ====================== */
if iiBJournalEntryId = ? then assign iiBJournalEntryId = 0.
if iiPostingId = ? then assign iiPostingId = 0.
assign viBJournalEntryBEID = iiBJournalEntryId.
/* =========================== */
/* if no posting id, then zero */
/* =========================== */
if iiPostingId = 0
then do:
assign odPostingAmountLC = 0
odPostingAmountTC = 0.
return.
end.
/* ================= */
/* Get info from DB */
/* ================= */
if viBJournalEntryBEID = 0
then do :
<Q-1 run PostingLineByPostingId (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiPostingId, (PostingId)
input ?, (GLSystemTypeCode)
input ?, (GLTypeCode)
output dataset tqPostingLineByPostingId) in BPosting >
for each tqPostingLineByPostingId :
accumulate tqPostingLineByPostingId.tdPostingLineDebitLC(TOTAL).
accumulate tqPostingLineByPostingId.tdPostingLineCreditLC(TOTAL).
accumulate tqPostingLineByPostingId.tdPostingLineDebitTC(TOTAL).
accumulate tqPostingLineByPostingId.tdPostingLineCreditTC(TOTAL).
end.
assign odPostingAmountLC = (accum total tqPostingLineByPostingId.tdPostingLineDebitLC) - (accum total tqPostingLineByPostingId.tdPostingLineCreditLC)
odPostingAmountTC = (accum total tqPostingLineByPostingId.tdPostingLineDebitTC) - (accum total tqPostingLineByPostingId.tdPostingLineCreditTC).
return.
end. /* if viBJournalEntryBEID = 0 */
/* ======================= */
/* Get info from Instance */
/* ======================= */
<I-2 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
<M-3 run GetPostingAmount
(input iiPostingId (iiPostingId),
output vdPostingAmountDebitLC (odPostingAmountDebitLC),
output vdPostingAmountCreditLC (odPostingAmountCreditLC),
output vdPostingAmountCreditTC (odPostingAmountCreditTC),
output vdDummy (odPostingAmountCreditCC),
output vdPostingAmountDebitTC (odPostingAmountDebitTC),
output vdDummy (odPostingAmountDebitCC),
output vcDummy (ocCurrencyCode),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
<I-4 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
assign vcMessage = trim(substitute(#T-6'An error occurred when retrieving the posting amount: &1.':200(323)t-6#, string(viFcReturnSuper)))
oiReturnStatus = -1.
<M-5 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-756':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
return.
end.
if vdPostingAmountCreditLC <> ? and
vdPostingAmountDebitLC <> ? and
vdPostingAmountCreditTC <> ? and
vdPostingAmountDebitTC <> ?
then assign odPostingAmountLC = vdPostingAmountDebitLC - vdPostingAmountCreditLC
odPostingAmountTC = vdPostingAmountDebitTC - vdPostingAmountCreditTC.