project QadFinancials > class BBankEntry > method AdditionalUpdatesInvDocuments
Description
method that takes the required actions for Collections/Documents
Parameters
iiBJournalEntryId | input | integer | instance of bjournal entry |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bbankentry.p)
/* ======================================================= */
/* Set default return-status */
/* Empty temp-table that is passed to a BCI-method */
/* ======================================================= */
assign oiReturnStatus = -98.
empty temp-table tCDocsToPayOrBounce.
empty temp-table tDDocsToPayOrBounce.
/* ================================================== */
/* Go through the already existing Documents that are */
/* allocated and create a temp-table record for it */
/* ================================================== */
for each tBankStateAlloc where
tBankStateAlloc.tc_ParentRowid = tBankStateLine.tc_Rowid and
(tBankStateAlloc.tc_Status = "N":U or
tBankStateAlloc.tc_Status = "C":U) and
(tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-CCOLL} or
tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-DCOLL}):
/* creditor collections */
if tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-CCOLL}
then do:
/* payed */
for each tBankStateAllocColl where
tBankStateAllocColl.tc_ParentRowid = tBankStateAlloc.tc_Rowid and
tBankStateAllocColl.BankStateAllocCollIsAlloc = true
no-lock :
create tCDocsToPayOrBounce.
assign tCDocsToPayOrBounce.tiCDocumentId = tBankStateAllocColl.CDocument_ID
tCDocsToPayOrBounce.tlCDocumentIsBounced = false
tCDocsToPayOrBounce.ttPostingDate = tBankStateLine.BankStateLinePostingDate
tCDocsToPayOrBounce.tcPostingRowidCDoc = tBankStateLine.tcPostingRowId
tCDocsToPayOrBounce.tcBankImpLineRowIDForCD = tBankStateLine.tcExternalUniqueIdentifier.
end. /* for each tBankStateAllocColl where */
/* bounced */
for each tBankStateAllocColl where
tBankStateAllocColl.tc_ParentRowid = tBankStateAlloc.tc_Rowid and
tBankStateAllocColl.BankStateAllocCollIsAlloc = false and
tBankStateAllocColl.tlDocIsBounced = true
no-lock:
create tCDocsToPayOrBounce.
assign tCDocsToPayOrBounce.tiCDocumentId = tBankStateAllocColl.CDocument_ID
tCDocsToPayOrBounce.tlCDocumentIsBounced = true
tCDocsToPayOrBounce.ttPostingDate = tBankStateLine.BankStateLinePostingDate
tCDocsToPayOrBounce.tcPostingRowidCDoc = tBankStateLine.tcPostingRowId
tCDocsToPayOrBounce.tcBankImpLineRowIDForCD = tBankStateLine.tcExternalUniqueIdentifier.
end. /* for each tBankStateAllocColl where */
end. /* if tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-CCOLL} */
/* debtor collections */
if tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-DCOLL}
then do:
/* payed */
for each tBankStateAllocColl where
tBankStateAllocColl.tc_ParentRowid = tBankStateAlloc.tc_Rowid and
tBankStateAllocColl.BankStateAllocCollIsAlloc = true
no-lock :
create tDDocsToPayOrBounce.
assign tDDocsToPayOrBounce.tiDDocumentId = tBankStateAllocColl.DDocument_ID
tDDocsToPayOrBounce.tlDDocumentIsBounced = false
tDDocsToPayOrBounce.ttPostingDate = tBankStateLine.BankStateLinePostingDate
tDDocsToPayOrBounce.tcPostingRowidDDoc = tBankStateLine.tcPostingRowId
tDDocsToPayOrBounce.tcBankImpLineRowID = tBankStateLine.tcExternalUniqueIdentifier.
end. /* for each tBankStateAllocColl where */
/* bounced */
for each tBankStateAllocColl where
tBankStateAllocColl.tc_ParentRowid = tBankStateAlloc.tc_Rowid and
tBankStateAllocColl.BankStateAllocCollIsAlloc = false and
tBankStateAllocColl.tlDocIsBounced = true
no-lock:
create tDDocsToPayOrBounce.
assign tDDocsToPayOrBounce.tiDDocumentId = tBankStateAllocColl.DDocument_ID
tDDocsToPayOrBounce.tlDDocumentIsBounced = true
tDDocsToPayOrBounce.ttPostingDate = tBankStateLine.BankStateLinePostingDate
tDDocsToPayOrBounce.tcPostingRowidDDoc = tBankStateLine.tcPostingRowId
tDDocsToPayOrBounce.tcBankImpLineRowID = tBankStateLine.tcExternalUniqueIdentifier.
end. /* for each tBankStateAllocColl where */
end. /* if tBankStateAlloc.BankStateAllocType = {&BANKSTATEALLOCTYPE-DCOLL} */
end. /* for each tBankStateAlloc where */
/* ============================================================================ */
/* Call methods in the Document-components to change the document-statusses etc */
/* ============================================================================ */
if can-find (first tCDocsToPayOrBounce)
then do:
/* update creditor docs/collections */
<M-25 run PayOrBounceCDocuments
(input tCDocsToPayOrBounce (tCDocumentsToPayOrBounce),
input iiBJournalEntryId (iiBJournalEntryId),
input viBCInvoiceBEID (iiBCInvoiceId),
input viBWithholdingTaxBankingEntryID (iiBWithHoldingTaxId),
input false (ilClearData),
input tBankState.tiGLBankNumberId (iiOwnBankGLNumberId),
output vlIsCDocDiffExchRateLC (olIsBEDiffExchRateLC),
output vlIsCDocDiffExchRateCC (olIsBEDiffExchRateCC),
input tBankState.tcCurrencyCode (icBnkGLCurCode),
output vlIsCDocExchRateChecked (olIsBEExchRateChecked),
output viFcReturnSuper (oiReturnStatus)) in BCDocument>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if can-find */
if can-find (first tDDocsToPayOrBounce)
then do:
/* update debtor docs/collections */
<M-41 run PayOrBounceDDocuments
(input tDDocsToPayOrBounce (tDDocumentsToPayOrBounce),
input iiBJournalEntryId (iiBJournalEntryId),
input viBDInvoiceBEID (iiBDInvoiceId),
input false (ilClearData),
output viFcReturnSuper (oiReturnStatus)) in BDDocument>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if can-find */
/* ======================================================= */
/* Set return-status = OK */
/* ======================================================= */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.