project QadFinancials > class BPaymentSelection > method GetBankCntryByGL

Description

Gets bank country and currency code based on bank GL account. It can also handle IBAN.


Parameters


iiBankGL_Idinputinteger
ocCurrencyoutputcharacter
ocBankCountryoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.StoreSelectedObjects


program code (program6/bpaymentselection.p)

/* get bank number */
<Q-1 run BankNumberByParentID (all) (Read) (NoCache)
   (input iiBankGL_ID, (ParentObjectId)
    input {&BANKNUMBERPARENTTYPE-GL}, (BankNumberParentType)
    input ?, (BankNumberIsDefault)
    input viCompanyId, (CompanyId)
    output dataset tqBankNumberByParentID) in BBankNumber >

find first tqBankNumberByParentID where 
           tqBankNumberByParentID.tiParentObject_ID = iiBankGL_ID and
           tqBankNumberByParentID.tiCompany_ID = viCompanyID  and 
           tqBankNumberByParentID.tlBankNumberIsDefault = true no-error.
if not available tqBankNumberByParentID
then find first tqBankNumberByParentID where 
           tqBankNumberByParentID.tiParentObject_ID = iiBankGL_ID and
           tqBankNumberByParentID.tiCompany_ID = viCompanyID no-error.

if not available tqBankNumberByParentID
then do:
    <M-2 run SetMessage
       (input  #T-3'The bank account number specified is not defined in the system.':80(999890832)T-3# (icMessage), 
        input  '':U (icArguments), 
        input  'BankGL_ID':U (icFieldName), 
        input  string(iiBankGL_ID) (icFieldValue), 
        input  'D':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QADFIN-1342':U (icFcMsgNumber), 
        input  '' (icFcExplanation), 
        input  '' (icFcIdentification), 
        input  '' (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
    
    assign oiReturnStatus = min(-1, viFcReturnSuper).
    return.
end.

assign ocBankCountry      = tqBankNumberByParentID.tcBankNumberValidation
       ocCurrency         = tqBankNumberByParentID.tcCurrencyCode.
/*       
       ocIntPaymentFormat = tqBankNumberByParentID.tcIntPayFormatTypeCode
       ocExtPaymentFormat = tqBankNumberByParentID.tcExtPayFormatTypeCode.
*/

if ocBankCountry = {&BANKNUMBERVALIDATION-IBAN}
then assign ocBankCountry = substring(tqBankNumberByParentID.tcBankNumber,1,2,"CHARACTER":U).