project QadFinancials > class BBankEntry > method AdditionalUpdatesInvRounding
Description
If the Banking Entry results in rounding differences, we add the necessary lines in this method. We do this because not all roundings are covered in the Posting component (f.e. when there are multiple currencies used in one posting)
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bbankentry.p)
/* ================================ */
/* Check if the posting is balanced */
/* ================================ */
<M-32 run GetPostingAmount
(input tBankStateLine.Posting_ID (iiPostingId),
output vdDebitLC (odPostingAmountDebitLC),
output vdCreditLC (odPostingAmountCreditLC),
output vdCreditTC (odPostingAmountCreditTC),
output vdCreditCC (odPostingAmountCreditCC),
output vdDebitTC (odPostingAmountDebitTC),
output vdDebitCC (odPostingAmountDebitCC),
output vcPostingCurrency (ocCurrencyCode),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* ================================== */
/* Leave method when nothing to round */
/* ================================== */
assign vdDebitBalanceLC = 0
vdCreditBalanceLC = 0
vdDebitBalanceCC = 0
vdCreditBalanceCC = 0.
if vdDebitLC - vdCreditLC > 0
then assign vdDebitBalanceLC = vdDebitLC - vdCreditLC.
if vdDebitLC - vdCreditLC < 0
then assign vdCreditBalanceLC = vdCreditLC - vdDebitLC.
if vdDebitCC - vdCreditCC > 0
then assign vdDebitBalanceCC = vdDebitCC - vdCreditCC.
if vdDebitCC - vdCreditCC < 0
then assign vdCreditBalanceCC = vdCreditCC - vdDebitCC.
if vdDebitBalanceLC = 0 and vdCreditBalanceLC = 0 and
vdDebitBalanceCC = 0 and vdCreditBalanceCC = 0
then return.
/* ======================== */
/* Get the Rounding Account */
/* ======================== */
<Q-66 run GLByGLSystemType (all) (Read) (Cache)
(input tBankStateLine.Company_ID, (CompanyId)
input {&GLSYSTEMTYPE-ROUND}, (GLSystemTypeCode)
input {&GLTYPECODE-SYST}, (GlTypeCode)
input ?, (GlIsDivisionAccount)
output dataset tqGLByGLSystemType) in BGL >
find first tqGLByGLSystemType where
tqGLByGLSystemType.tcGLSystemTypeCode = {&GLSYSTEMTYPE-ROUND} and
tqGLByGLSystemType.tcGLTypeCode = {&GLTYPECODE-SYST}
no-error.
if not available tqGLByGLSystemType
then do :
assign oiReturnStatus = -1
vcMessage = trim(#T-41'The system account for rounding differences has not been defined.':255(733756123)T-41#).
<M-20 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-333930':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
return.
end. /* if not available tqGLByGLSystemType */
/* ====================== */
/* Balance the LC amounts */
/* ====================== */
if vdDebitBalanceLC <> 0 or vdCreditBalanceLC <> 0
then do:
empty temp-table tBankDefaultSafs.
<M-42 run AddStandardPosting
(input tBankStateLine.tcPostingRowId (icPostingtcRowid),
input tqGLByGLSystemType.tcGLCode (icGLCode),
input '':U (icDivisionCode),
input '':U (icCostCentreCode),
input '':U (icCostCentreText),
input '':U (icProjectCode),
input '':U (icProjectText),
input '':U (icIntercoBusinessRelationCode),
input vcCompanyLC (icCurrencyCode),
input 0 (idDebitTC),
input vdCreditBalanceLC (idDebitLC),
input 0 (idDebitCC),
input ? (idDebitPC),
input 0 (idCreditTC),
input vdDebitBalanceLC (idCreditLC),
input 0 (idCreditCC),
input ? (idCreditPC),
input 0 (idQty),
input '':U (icLineText),
input '':U (icSafText),
input tBankDefaultSafs (tDefaultSafs),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType),
input 1 (idExchangeRate),
input 1 (idExchangeRateScale),
input 0 (idPostingLineCCRate),
input 0 (idPostingLineCCScale),
output viDummyPostingLineId (oiPostingLineId),
input ? (iiSafStructureId),
input ? (icSafStructureCode),
input ? (icAllocationKey),
input false (ilLinkedCrCyDaemonReqExists),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if vdBalanceLC <> 0 */
/* ====================== */
/* Balance the CC amounts */
/* ====================== */
if vdDebitBalanceCC <> 0 or vdCreditBalanceCC <> 0
then do:
empty temp-table tBankDefaultSafs.
<M-68 run AddStandardPosting
(input tBankStateLine.tcPostingRowId (icPostingtcRowid),
input tqGLByGLSystemType.tcGLCode (icGLCode),
input '':U (icDivisionCode),
input '':U (icCostCentreCode),
input '':U (icCostCentreText),
input '':U (icProjectCode),
input '':U (icProjectText),
input '':U (icIntercoBusinessRelationCode),
input vcCompanyCC (icCurrencyCode),
input 0 (idDebitTC),
input 0 (idDebitLC),
input vdCreditBalanceCC (idDebitCC),
input ? (idDebitPC),
input 0 (idCreditTC),
input 0 (idCreditLC),
input vdDebitBalanceCC (idCreditCC),
input ? (idCreditPC),
input 0 (idQty),
input '':U (icLineText),
input '':U (icSafText),
input tBankDefaultSafs (tDefaultSafs),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType),
input 1 (idExchangeRate),
input 1 (idExchangeRateScale),
input 0 (idPostingLineCCRate),
input 0 (idPostingLineCCScale),
output viDummyPostingLineId (oiPostingLineId),
input ? (iiSafStructureId),
input ? (icSafStructureCode),
input ? (icAllocationKey),
input false (ilLinkedCrCyDaemonReqExists),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if vdBalanceCC <> 0 */