iiCompanyID | input | integer | Entity ID |
ilIncludeAllCompanies | input | logical | IncludeAllCompanies |
iiBankStateLineID | input | integer | BankStateLine ID wherefor the allocations need to be proposed |
icBankStateLineTcRowid | input | character | BankStateLine TcRowid wherefor the allocations need to be proposed |
icBusinessRelationCode | input | character | |
icCode | input | character | DebtorCreditorEmployeeCode Code of the debtor/creditor/employee |
icReference | input | character | Reference of the debtor/creditor/employee |
idAmount | input | decimal | Amount that should fit the Invoice/Collection/Document |
idAmountMargin | input | decimal | Margin on the Amount that should fit the Invoice/Collection/Document |
icAmountOperator | input | character | Operator that will be used to check the input-amount against the amounts on invoices |
icCurrencyCode | input | character | CurrencyCode that should fit the Invoice/Collection/Document. This is not used in case iiCurrencyID is passed |
icBankAccountNumber | input | character | BankAccountNumber that should fit the Creditor-Invoice or the Debtor |
ilIncludeDebtor | input | logical | IncludeDebtor |
ilIncludeCreditor | input | logical | IncludeCreditor |
ilIncludeInvoices | input | logical | IncludeInvoices |
iiPeriodYear | input | integer | |
icJournalCode | input | character | Daybook Code |
iiVoucher | input | integer | Voucher |
icBankCurrencyCode | input | character | Bank Currency Code |
icBankGLCode | input | character | Bank GL Account |
itBankStateLineValueDate | input | date | Value Date of the Bank State Line |
icShipperCode | input | character | |
tPossibleBankStateAlloc | output | temp-table | Table containing all possibilities that fit the selection critaria. |
tPossibleBankStateStageAlloc | output | temp-table | |
icTSMNumber | input | character | TSMNumber |
iiBillYear | input | integer | |
iiBillNumber | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
assign oiReturnStatus = -98 vcExchangeRateType = <M-26 GetExchangeRateType () in BBankEntry>. /* Replace unknown values and return if no selection has been made */ if iiCompanyID = ? then assign iiCompanyID = 0. if ilIncludeAllCompanies = ? then assign ilIncludeAllCompanies = false. if icBusinessRelationCode = ? then assign icBusinessRelationCode = "":U. if icCode = ? then assign icCode = "":U. if icReference = ? then assign icReference = "":U. if idAmount = ? then assign idAmount = 0. if icCurrencyCode = ? then assign icCurrencyCode = "":U. if idAmountMargin = ? then assign idAmountMargin = 0. if icAmountOperator = ? then assign icAmountOperator = "":U. if icBankAccountNumber = ? then assign icBankAccountNumber = "":U. if ilIncludeDebtor = ? then assign ilIncludeDebtor = false. if ilIncludeCreditor = ? then assign ilIncludeCreditor = false. if ilIncludeInvoices = ? then assign ilIncludeInvoices = false. if icBankCurrencyCode = ? then assign icBankCurrencyCode = "":U. if icBankGLCode = ? then assign icBankGLCode = "":U. if icShipperCode = ? then assign icShipperCode = "". if ilIncludeDebtor = FALSE and ilIncludeCreditor = FALSE then do : assign vcMessage = trim(#T-18'You must select at least one of the following options: Supplier, Customer, Employee.':255(17424)T-18#) oiReturnStatus = -3. <M-1 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-617':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> Return. end. /* if ilIncludeDebtor = FALSE and */ if ilIncludeInvoices = false then do : assign vcMessage = trim(#T-19'You must select invoices.':255(268)T-19#) oiReturnStatus = -3. <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-618':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> return. end. /* if ilIncludeInvoices = FALSE */ if icAmountOperator <> "=":U and icAmountOperator <> "<=":U and icAmountOperator <> ">=":U then do : assign vcMessage = trim(substitute(#T-20'You must select one of the following options for the operator on the amount: '&1', '&2' or '&3'.':255(269)T-20#,"=":U,">=":U,"<=":U)) oiReturnStatus = -3. <M-12 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-669':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> Return. end. /* if icAmountOperator <> "=":U and */ /* check if the bankgl is filled */ if icBankGLCode = "":U then do: assign vcMessage = trim(#T-21'You must enter the GL bank account.':150(270)T-21#) oiReturnStatus = -1. <M-16 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-2125':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> Return. end. /* Caluclate the minimum and maximum amount */ if icAmountOperator = "=":U then assign vdMinimumAmount = idAmount - abs(idAmountMargin) vdMaximumAmount = idAmount + abs(idAmountMargin). else if icAmountOperator = "<=":U then assign vdMinimumAmount = 0.01 /* not 0 because then the condition is removed from the query */ vdMaximumAmount = idAmount. else assign vdMinimumAmount = idAmount vdMaximumAmount = 9999999999 /* not ? because then the condition is removed from the query */. /* 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-24 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 then do: assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return. end. end. /* Empty the output */ empty temp-table tPossibleBankStateAlloc. empty temp-table tPossibleBankStateStageAlloc. if icBankAccountNumber <> "":U then assign icBankAccountNumber = replace(icBankAccountNumber," ":U,"":U) icBankAccountNumber = replace(icBankAccountNumber,".":U,"":U) icBankAccountNumber = replace(icBankAccountNumber,"/":U,"":U) icBankAccountNumber = replace(icBankAccountNumber,"-":U,"":U). /* Creditor Invoice */ assign vcInvoiceTypes = {&INVOICETYPES}. if ilIncludeCreditor and ilIncludeInvoices then do : <M-35 run GetPossibleAllocationsCInvoice (input iiCompanyID (iiCompanyID), input iiBankStateLineID (iiBankStateLineID), input icBankStateLineTcRowid (icBankStateLineTcRowid), input icBusinessRelationCode (icBusinessRelationCode), input icCode (icCode), input icReference (icReference), input icCurrencyCode (icCurrencyCode), input icBankAccountNumber (icBankAccountNumber), input ilIncludeAllCompanies (ilIncludeAllCompanies), input iiPeriodYear (iiPeriodYear), input icJournalCode (icJournalCode), input iiVoucher (iiVoucher), input icBankCurrencyCode (icBankCurrencyCode), input itBankStateLineValueDate (itBankStateLineValueDate), input icTSMNumber (icTSMNumber), output tPossibleBankStateAlloc (tPossibleBankStateAlloc), output tPossibleBankStateStageAlloc (tPossibleBankStateStageAlloc), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> if viFcReturnSuper <> 0 then do: assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return. end. end. /* if ilIncludeCreditor and ilIncludeInvoices */ /* Debtor Invoice */ if ilIncludeDebtor and ilIncludeInvoices then do : <M-36 run GetPossibleAllocationsDInvoice (input iiCompanyID (iiCompanyID), input ilIncludeAllCompanies (ilIncludeAllCompanies), input iiBankStateLineID (iiBankStateLineID), input icBankStateLineTcRowid (icBankStateLineTcRowid), input icBusinessRelationCode (icBusinessRelationCode), input icCode (icCode), input icReference (icReference), input icCurrencyCode (icCurrencyCode), input icBankAccountNumber (icBankAccountNumber), input iiPeriodYear (iiPeriodYear), input icJournalCode (icJournalCode), input iiVoucher (iiVoucher), input icBankCurrencyCode (icBankCurrencyCode), input itBankStateLineValueDate (itBankStateLineValueDate), input icTSMNumber (icTSMNumber), input icShipperCode (icShipperCode), output tPossibleBankStateAlloc (tPossibleBankStateAlloc), output tPossibleBankStateStageAlloc (tPossibleBankStateStageAlloc), input iiBillYear (iiBillYear), input iiBillNumber (iiBillNumber), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> if viFcReturnSuper <> 0 then do: assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return. end. end. /* if ilIncludeDebtor and ilIncludeInvoices */ if oiReturnStatus = -98 then assign oiReturnStatus = 0.