project QadFinancials > class BBankEntry > method AdditionalUpdatesValidationsLC
Description
AddtionalUpdatesValidationsLC; method that contains the validations regarding the LC-balance
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bbankentry.p)
/* ========================= */
/* Set default return-status */
/* ========================= */
assign oiReturnStatus = -98.
/* ======================================================= */
/* check the balance of the lines combined with the values */
/* of the journal entry: balance must be zero */
/* ======================================================= */
for each tBankState where
tBankState.tc_Status <> "D":U and
(tBankState.BankStateStatus = {&BANKSTATESTATUS-PARTALLOC} or
tBankState.BankStateStatus = {&BANKSTATESTATUS-ALLOC}) no-lock,
each tBankStateLine where
tBankStateLine.tc_ParentRowid = tBankState.tc_Rowid and
(tBankStateLine.tc_status = "N":U or
tBankStateLine.tc_status = "C":U) and
(tBankStateLine.BankStateLineStatus = {&BANKSTATELINESTATUS-ALLOC} or
tBankStateLine.BankStateLineStatus = {&BANKSTATELINESTATUS-ALLOCPOST})
by tBankStateLine.BankStateLineNumber :
assign vdTotalDebitLC = 0
vdTotalCreditLC = 0.
/* ===================================================================== */
/* Go through all allocations of the BE-Line and sum the posting-amounts */
/* Get the posting-amounts of the posting linked to the BE-Line */
/* Post the difference on the Bank-GL account */
/* ===================================================================== */
for each tBankStateAlloc where
tBankStateAlloc.tc_ParentRowid = tBankStateLine.tc_Rowid:
assign vdAmountTC = if tBankStateAlloc.tcAllocAmountCrDt = {&CREDITDEBITABBREVIATION-DEBIT}
then vdAmountTC + tBankStateAlloc.BankStateAllocBankAmountTC - tBankStateAlloc.BankStateAllocBankDiscTC
else vdAmountTC - (tBankStateAlloc.BankStateAllocBankAmountTC - tBankStateAlloc.BankStateAllocBankDiscTC)
vdAmountLC = if tBankStateAlloc.tcAllocAmountCrDt = {&CREDITDEBITABBREVIATION-DEBIT}
then vdAmountLC + tBankStateAlloc.BankStateAllocBankAmountLC - tBankStateAlloc.BankStateAllocBankDiscLC
else vdAmountLC - (tBankStateAlloc.BankStateAllocBankAmountLC - tBankStateAlloc.BankStateAllocBankDiscLC)
vdAmountCC = if tBankStateAlloc.tcAllocAmountCrDt = {&CREDITDEBITABBREVIATION-DEBIT}
then vdAmountCC + tBankStateAlloc.tdBankStateAllocBankAmountCC - tBankStateAlloc.tdBankStateAllocBankDiscCC
else vdAmountCC - (tBankStateAlloc.tdBankStateAllocBankAmountCC - tBankStateAlloc.tdBankStateAllocBankDiscCC).
end. /* for each tbankstatealloc where */
<M-1 run GetJournalEntryBalance
(input tBankState.tcCurrencyCode (icBankCurrencyCode),
input tBankStateLine.Posting_ID (iiPostingId),
input tBankStateLine.BankStateLineValueDate (itBankStateLineValueDate),
input false (ilCloseJournalEntryInstance),
input tBankStateLine.BankStateLineAmountTC (idBankStateLineAmountTC),
input tBankStateLine.tdBankStateLineAmountLC (idBankStateLineAmountLC),
input vdAmountTC (idAllocatedAmountTC),
input vdAmountLC (idAllocatedAmountLC),
output vdDummy (odPostingAmountDebitTC),
output vdDummy (odPostingAmountCreditTC),
output vdTotalDebitLC (odPostingAmountDebitLC),
output vdTotalCreditLC (odPostingAmountCreditLC),
output vdDummy (odPostingAmountDebitCC),
output vdDummy (odPostingAmountCreditCC),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.
if vdTotalCreditLC <> vdTotalDebitLC
then do :
assign vcMessage = trim(substitute(#T-3'The bank statement line is not balanced: debit (&1) differs from credit (&2).':150(373)T-3#, vdTotalDebitLC,vdTotalCreditLC)) + chr(10) +
trim(substitute(#T-4'Allocation line: &1.':150(368)T-4#,string(tBankStateLine.BankStateLine_ID))) + chr(10) +
trim(substitute(#T-5'Bank statement line: &1.':150(374)T-5#,string(tBankStateLine.BankStateLineNumber)))
oiReturnStatus = -1.
<M-2 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-4268':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
<I-6 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
Return.
end. /* if vdTotalCreditLC <> vdTotalDebitLC */
end. /* for each tBankState, each tBankStateLine of */
/* ========================= */
/* Set return-status = OK */
/* ========================= */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.