project QadFinancials > class BBankEntry > method CalculateBankStateAllocColl

Description

CalculateBankStateAllocColl; Fill in the calculated fields in this table field


Parameters


iiCDocumentIDinputinteger
iiDDocumentIDinputinteger
ocDocBusinessRelationCodeoutputcharacterDocBusinessRelationCode
ocDocNumberReferenceoutputcharacterDocNumberReference
ocDocTypeoutputcharacterDocType
odDocAmountoutputdecimalDocAmount
ocDocAmountCrDtoutputcharacterCredit or Debit
ocDocCurrencyCodeoutputcharacter
oiPrePrintedNumberoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.CalculateAll


program code (program4/bbankentry.p)

if iiCDocumentID <> 0 and iiCDocumentID <> ?
    then do :
        assign vcDocumentStatus = {&DOCUMENTSTATUS-INCASSO} + ",":U + {&DOCUMENTSTATUS-DISCONT} + ",":U + {&DOCUMENTSTATUS-PAID} + ",":U + {&DOCUMENTSTATUS-PAIDCON} + ",":U + {&DOCUMENTSTATUS-BOUNCED}.
        <Q-1 run CDocumentByCollectionID (all) (Read) (NoCache)
           (input ?, (CompanyId)
            input iiCDocumentID, (CDocumentID)
            input ?, (CCollectionID)
            input vcDocumentStatus, (CDocumentStatus)
            output dataset tqCDocumentByCollectionID) in BCDocument >
        find first tqCDocumentByCollectionID no-lock no-error.
        if not available tqCDocumentByCollectionID
        then return.
        assign ocDocBusinessRelationCode = tqCDocumentByCollectionID.tcBusinessRelationCode
               ocDocType                 = if tqCDocumentByCollectionID.tcCDocumentType = ? then tqCDocumentByCollectionID.tcCDocumentSubType else tqCDocumentByCollectionID.tcCDocumentType
               odDocAmount               = tqCDocumentByCollectionID.tdCDocumentOriginalCreditTC
               ocDocAmountCrDt           = {&CREDITDEBITABBREVIATION-CREDIT}
               ocDocCurrencyCode         = tqCDocumentByCollectionID.tcCurrencyCode
               ocDocNumberReference      = trim(string(tqCDocumentByCollectionID.tiCDocumentYear)) + "/":U + trim(string(tqCDocumentByCollectionID.tiCDocumentNumber)) + "/":U + string(tqCDocumentByCollectionID.tcCDocumentReference)
               oiPrePrintedNumber        = tqCDocumentByCollectionID.tiCDocumentPrePrintedNumber.
        Return.
    end. /* if iiCDocumentID <> 0 and iiCDocumentID <> ? */
    if iiDDocumentID <> 0 and iiDDocumentID <> ?
    then do :
        assign vcDocumentStatus = {&DOCUMENTSTATUS-INCASSO} + ",":U + {&DOCUMENTSTATUS-DISCONT} + ",":U + {&DOCUMENTSTATUS-PAID} + ",":U + {&DOCUMENTSTATUS-PAIDCON} + ",":U + {&DOCUMENTSTATUS-BOUNCED}.
        <Q-3 run DDocumentByCollectionID (all) (Read) (NoCache)
           (input ?, (CompanyId)
            input ?, (DCollectionID)
            input iiDDocumentID, (DDocumentID)
            input vcDocumentStatus, (DDocumentStatus)
            output dataset tqDDocumentByCollectionID) in BDDocument >
        find first tqDDocumentByCollectionID no-lock no-error.
        if not available tqDDocumentByCollectionID
        then return.
        assign ocDocBusinessRelationCode = tqDDocumentByCollectionID.tcBusinessRelationCode
               ocDocType                 = if tqDDocumentByCollectionID.tcDDocumentType = ? then tqDDocumentByCollectionID.tcDDocumentSubType else tqDDocumentByCollectionID.tcDDocumentType
               odDocAmount               = tqDDocumentByCollectionID.tdDDocumentOriginalDebitTC
               ocDocAmountCrDt           = {&CREDITDEBITABBREVIATION-DEBIT}
               ocDocCurrencyCode         = tqDDocumentByCollectionID.tcCurrencyCode.
               ocDocNumberReference      = trim(string(tqDDocumentByCollectionID.tiDDocumentYear)) + "/":U + trim(string(tqDDocumentByCollectionID.tiDDocumentNumber)) + "/":U + string(tqDDocumentByCollectionID.tcDDocumentReference).
        Return.
    end. /* if iiDDocumentID <> 0 and iiDDocumentID <> ? */