project QadFinancials > class BBankEntry > method GetPossibleCollAllocations

Description

GetPossibleCollAllocations; this method returns a temp-table containing all collections for allocation possibilities that fit the input criteria of this method.
called by UI when pressing Apply on the search criteria window for collections


Parameters


iiCompanyIDinputintegerEntity ID
iiBankStateLineIDinputintegerBankStateLineID wherefor the allocations need to be proposed
icBankStateLineTcRowidinputcharacterBankStateLine TcRowid wherefor the allocations need to be proposed
itFromRequestedDateinputdateFromRequestedDate
idTotalCollectionAmountTCinputdecimalCollectionOriginalAmountTC (Credit or Debit)
ilIncludeDebtorinputlogicalInlcudeDebtor
ilIncludeCreditorinputlogicalInlcudeCreditor
icBankCurrencyCodeinputcharacterBank Currency Code
icGLCodeinputcharacterGL code
itBankStateLineValueDateinputdateBank State Line Value Date
iiDocumentYearinputintegerDocument Year
icDocumentTypeinputcharacterdocument type
iiDocumentNumberinputintegerDocument Number
iiCDocumentPrePrintedNumberinputinteger
icDocumentReferenceinputcharacter
icSelectionCodeinputcharacter
tPossibleBankStateAllocoutputtemp-tablePossible records for BankStateAlloc
tPossibleBankStateCollAllocoutputtemp-tablePossible records for BankStateAllocColl
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.AddBankEntryAllocateDocument


program code (program6/bbankentry.p)

/*JBA BTS 4906 use the correct exchange rate type*/
assign vcExchangeRateType = <M-36 GetExchangeRateType () in BBankEntry>.

if icBankCurrencyCode          = ? then assign icBankCurrencyCode          = "":U.
if icDocumentReference         = ? then assign icDocumentReference         = "":U.
if icDocumentType              = ? then assign icDocumentType              = "":U.
if icSelectionCode             = ? then assign icSelectionCode             = "":U.
if idTotalCollectionAmountTC   = ? then assign idTotalCollectionAmountTC   = 0.
if iiCDocumentPrePrintedNumber = ? then assign iiCDocumentPrePrintedNumber = 0.
if iiCompanyID                 = ? then assign iiCompanyID                 = 0.
if iiDocumentNumber            = ? then assign iiDocumentNumber            = 0.
if iiDocumentYear              = ? then assign iiDocumentYear              = 0.
if ilIncludeCreditor           = ? then assign ilIncludeCreditor           = false.
if ilIncludeDebtor             = ? then assign ilIncludeDebtor             = false.

if not ilIncludeCreditor and
   not ilIncludeDebtor
then do:
    <M-1 run SetMessage
          (input  trim(#T-35'You must select at least one of the following options: Supplier or Customer.':200(321)T-35#) (icMessage), 
           input  '':U (icArguments), 
           input  '':U (icFieldName), 
           input  '':U (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  '':U (icRowid), 
           input  'QADFIN-628':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BBankEntry>

    assign oiReturnStatus = -3.
    return.
end.

/* Fill the bankrate so it can be used on UI to calculate lc amounts */
if icBankCurrencyCode = vcCompanyLC
then assign vdBankRate      = 1
            vdBankRateScale = 1.
else do:
    <M-76 run GetExchangeRate
       (input  iiCompanyID (iiCompanyID), 
        input  ? (iiFromCurrencyID), 
        input  icBankCurrencyCode (icFromCurrencyCode), 
        input  viCompanyLCId (iiToCurrencyID), 
        input  ? (icToCurrencyCode), 
        input  ? (iiExchangeRateTypeID), 
        input  vcExchangeRateType (icExchangeRateTypeCode), 
        input  itBankStateLineValueDate (itValidityDate), 
        output vdBankRate (odExchangeRate), 
        output vdBankRateScale (odExchangeScaleFactor), 
        output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        
    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.
end.

empty temp-table tPossibleBankStateAlloc.
empty temp-table tPossibleBankStateCollAlloc.

/* Creditor Document / Collection */
if ilIncludeCreditor
then do:
    <M-33 run GetPossibleCollAllocationsCreditor
       (input  iiCompanyID (iiCompanyID), 
        input  iiBankStateLineID (iiBankStateLineID), 
        input  icBankStateLineTcRowid (icBankStateLineTcRowid), 
        input  itFromRequestedDate (itFromRequestedDate), 
        input  idTotalCollectionAmountTC (idTotalCollectionAmountTC), 
        input  ilIncludeDebtor (ilIncludeDebtor), 
        input  ilIncludeCreditor (ilIncludeCreditor), 
        input  icBankCurrencyCode (icBankCurrencyCode), 
        input  icGLCode (icGLCode), 
        input  itBankStateLineValueDate (itBankStateLineValueDate), 
        input  iiDocumentYear (iiDocumentYear), 
        input  icDocumentType (icDocumentType), 
        input  iiDocumentNumber (iiDocumentNumber), 
        input  vdBankRate (idBankRate), 
        input  vdBankRateScale (idBankRateScale), 
        input  iiCDocumentPrePrintedNumber (iiCDocumentPrePrintedNumber), 
        input  icDocumentReference (icDocumentReference), 
        input  icSelectionCode (icSelectionCode), 
        output tPossibleBankStateAlloc (tPossibleBankStateAlloc), 
        output tPossibleBankStateCollAlloc (tPossibleBankStateCollAlloc), 
        output viFcReturnSuper (oiReturnStatus)) in BBankEntry>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.
end.

/* Debtor Document / Collection */
if ilIncludeDebtor
then do:
    <M-34 run GetPossibleCollAllocationsDebtor
       (input  iiCompanyID (iiCompanyID), 
        input  iiBankStateLineID (iiBankStateLineID), 
        input  icBankStateLineTcRowid (icBankStateLineTcRowid), 
        input  itFromRequestedDate (itFromRequestedDate), 
        input  idTotalCollectionAmountTC (idTotalCollectionAmountTC), 
        input  ilIncludeDebtor (ilIncludeDebtor), 
        input  ilIncludeCreditor (ilIncludeCreditor), 
        input  icBankCurrencyCode (icBankCurrencyCode), 
        input  icGLCode (icGLCode), 
        input  itBankStateLineValueDate (itBankStateLineValueDate), 
        input  iiDocumentYear (iiDocumentYear), 
        input  icDocumentType (icDocumentType), 
        input  iiDocumentNumber (iiDocumentNumber), 
        input  vdBankRate (idBankRate), 
        input  vdBankRateScale (idBankRateScale), 
        input  icDocumentReference (icDocumentReference), 
        input  icSelectionCode (icSelectionCode), 
        output tPossibleBankStateAlloc (tPossibleBankStateAlloc), 
        output tPossibleBankStateCollAlloc (tPossibleBankStateCollAlloc), 
        output viFcReturnSuper (oiReturnStatus)) in BBankEntry>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.
end.