project QadFinancials > class BBankImportLine > method GetOwnBankNumberByBankImpLine

Description

This method gets own bank number based on information of Bank Import Line.


Parameters


oiBankNumberIdoutputintegerBank Number ID
ocBankNumberNumberoutputcharacterBank Number
oiGLIdoutputintegerOwn bank account ID
ocGLCodeoutputcharacterGL Code
oiBankPaymentFormatIdoutputintegerBank Payment Format ID
ocPaymentFormatCodeoutputcharacterPayment Format Code
oiCurrencyIdoutputintegerOwn Bank Account Currency ID
ocCurrencyCodeoutputcharacterOwn Bank Account Currency Code
oiTransactionCompanyIdoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankImportLine.ProcessBankImpLineCDocStatusChg
method BBankImportLine.ProcessBankImpLineDDocStatusChg
method BBankImportLine.ProcessBankImpLineNewBankEntry
method BBankImportLine.ProcessBankImpLineNewDDocument


program code (program6/bbankimportline.p)

/* =================================================================================================== */
/* Method      : GetOwnBankNumberByBankImpLine                                                         */
/* Desc        : This method gets information about own bank number                                    */
/*               !!! This method has to be in the same segment as parent methods (expects correct      */
/*                   record in table tBankImpLine)  - segment 6                                        */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (0)  BankNumberId         ID of the bank number                                            */
/*          (O)  BankNumberNumber     Number of the bank number                                        */
/*          (O)  GLId                 ID of the GL accouunt, own bank is defined for                   */
/*          (O)  GLCode               Code of the GL account of own bank number                        */
/*          (O)  BankPaymentFormatId  ID of the bank payment format                                    */
/*          (O)  PaymentFormatCode    Code of payment format                                           */
/*          (O)  CurrencyId           ID of the currency of own bank account                           */
/*          (O)  CurrencyCode         Code of currency of own bank account                             */
/* =================================================================================================== */

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0
       vcParam             = '':U
       vcCriteria          = '':U.

/* =================================================================================================== */
/* Default output values                                                                               */
/* =================================================================================================== */
assign oiBankNumberId        = ?
       ocBankNumberNumber    = ?
       oiGLId                = ?
       ocGLCode              = ?
       oiBankPaymentFormatId = ?
       ocPaymentFormatCode   = ?.

/* =================================================================================================== */
/* Validate input parameters                                                                           */
/* =================================================================================================== */

if not available tBankImpLine
then do:
    assign vcMessage = #T-2'Missing definition of imported bank line.':255(67965)T-2#.
    <M-1 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-7560':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
    assign oiReturnStatus = -1.
    return.
end.

if tBankImpLine.BankImpLineOwnBankNumber = ? or
   tBankImpLine.BankImpLineOwnBankNumber = '':U
then do:
    assign vcMessage = #T-5'The own bank account number is missing from the transaction line.':255(68528)T-5#.
    <M-4 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  tBankImpLine.tc_Rowid (icRowid), 
        input  'QadFin-7561':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
    assign oiReturnStatus = -1.
    return.
end.

/* Check if bank file format code is defined - it is mandatory field */
if tBankImpLine.BankImpLineFileFormatCode = ? or
   tBankImpLine.BankImpLineFileFormatCode = '':U
then do:
    assign vcMessage = #T-7'The own bank file format is missing from the transaction line.':255(68529)T-7#.
    <M-6 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  tBankImpLine.tc_Rowid (icRowid), 
        input  'QadFin-7660':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
    assign oiReturnStatus = -1.
    return.
end.

/* =================================================================================================== */
/* Get Own bank number                                                                                 */
/* =================================================================================================== */
/* Create processing info */
<M-95 run CreateBankImpLineProcessInfo
   (input  'GetBankNumberByNumber':U (icProcessName), 
    input  #T-40'Get own bank number':255(242707683)T-40# (icProcessDesc), 
    input  ? (icProcessResult), 
    input  ? (icProcessParam), 
    input  'GetOwnBankNumberByBankImpLine':U (icParentRowName), 
    input  0 (iiProcessStatus), 
    output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>

    <M-59 run GetBankNumberByNumber
       (input  {&BANKNUMBERPARENTTYPE-GL} (icBankNumberParentType), 
        input  tBankImpLine.BankImpLineOwnBankNumber (icBankNumber), 
        output oiBankNumberId (oiBankNumberId), 
        output ocBankNumberNumber (ocBankNumber), 
        output oiGLId (oiParentObjectId), 
        output ocGLCode (ocParentObjectCode), 
        output oiCurrencyId (oiCurrencyId), 
        output ocCurrencyCode (ocCurrencyCode), 
    output oiTransactionCompanyId (oiTransactionCompanyId), 
        input  ? (icBankImpCurrencyCode), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper     <> 0 then assign viLocalReturnStatus = viFcReturnSuper.

assign vcParam = "BankNumberNumber = " + ocBankNumberNumber + 
                 ";GLCode = " + ocGLCode + 
                 ";CurrencyCode = " + ocCurrencyCode.
<M-46 run UpdateBankImpLineProcessResult
   (input  'GetBankNumberByNumber':U (icProcessName), 
    input  viLocalReturnStatus (iiProcessStatus), 
    input  vcParam (icProcessResult), 
    output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>

if viLocalReturnStatus < 0 
then do: 
     assign oiReturnStatus = -1.
     return.
end.

/* =================================================================================================== */
/* Get bank payment format                                                                             */
/* (there should be exactly one record)                                                                */
/* =================================================================================================== */
assign vcPaymentModule = (if tbankimpline.bankimplineInOut = {&TRANSDIRECTION-IN}
                          then {&PAYFORMATMODULE-AR}
                          else {&PAYFORMATMODULE-AP}).

if vcPaymentModule <> {&PAYFORMATMODULE-AP}
then do:
    <Q-12 run BankPayFormatForBankImp (all) (Read) (NoCache)
       (input oiBankNumberId, (BankNumberId)
        input tBankImpLine.BankImpLineFileFormatCode, (BankFileFormatCode)
        input vcPaymentModule, (PaymentModule)
        output dataset tqBankPayFormatForBankImp) in BBankPayFormat >
    find first tqBankPayFormatForBankImp no-error.
    
    if not available tqBankPayFormatForBankImp
    then do:
    
        assign vcMessage = #T-14'The combination of own bank account number &1 and bank file format for module &2 cannot be found.':255(68530)T-14# + " ":U
               vcMessage = vcMessage + #T-15'You define this combination in Bank Payment Format Link.':255(68531)t-15#
               vcMessage = substitute(vcMessage, ocBankNumberNumber, 
                                      if tbankimpline.bankimplineInOut = {&TRANSDIRECTION-IN}
                                      then {&PAYFORMATMODULE-AR-TR}
                                      else {&PAYFORMATMODULE-AP-TR}).
        <M-13 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  tBankImpLine.tc_Rowid (icRowid), 
            input  'QadFin-7661':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
        assign oiReturnStatus = -1.
    end.
    /* Create processing info */
    else assign vcCriteria = "BankNumber = " + tqBankPayFormatForBankImp.tcBankNumber + 
                             ";BankFileFormatCode = " + tBankImpLine.BankImpLineFileFormatCode + 
                             ";PaymentModule = " + vcPaymentModule
                vcParam = "PaymentFormatCode = " + tqBankPayFormatForBankImp.tcPayFormatTypeCode.
    <M-65 run CreateBankImpLineProcessInfo
       (input  'BankPayFormatForBankImp':U (icProcessName), 
        input  #T-58'Get bank payment format':255(271580318)T-58# (icProcessDesc), 
        input  vcParam (icProcessResult), 
        input  vcCriteria (icProcessParam), 
        input  'GetOwnBankNumberByBankImpLine':U (icParentRowName), 
        input  oiReturnStatus (iiProcessStatus), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
    
    if oiReturnStatus = -1 then return.
    
    /* =================================================================================================== */
    /* Return                                                                                              */
    /* =================================================================================================== */
    assign oiBankPaymentFormatId = tqBankPayFormatForBankImp.tiBankPayFormat_ID
           ocPaymentFormatCode   = tqBankPayFormatForBankImp.tcPayFormatTypeCode.
end.       
if oiReturnStatus = -98 then assign oiReturnStatus = 0.