Description
This method get the currency based on the information of Bank Import Line.
Parameters
oiCurrencyId | output | integer | Currency ID |
ocCurrencyCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bbankimportline.p)
/* =================================================================================================== */
/* Method : GetCurrencyByBankImpLine */
/* Desc : This method get the currency based on the information of BankImpLine */
/* !!! This method has to be in the same segment as parent methods (expects correct */
/* record in table tBankImpLine) - segment 6 */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) Name Description */
/* (O) Name Description */
/* =================================================================================================== */
assign oiReturnStatus = -98.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not available tBankImpLine
then do:
assign vcMessage = trim(#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-7574':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
return.
end.
/* If original currency defined in the bank import line then get currency by code */
if tBankImpLine.BankImpLineOrigCurrCode <> "":U and tBankImpLine.BankImpLineOrigCurrCode <> ?
then do:
if tBankImpLine.BankImpLineOrigCurrCode = vcCompanyLC
then assign oiCurrencyId = viCompanyLCId
ocCurrencyCode = vcCompanyLC.
else
if tBankImpLine.BankImpLineOrigCurrCode = vcCompanyCC
then assign oiCurrencyId = viCompanyCCId
ocCurrencyCode = vcCompanyCC.
else do:
<Q-5 run CurrencyByCode (all) (Read) (NoCache)
(input tBankImpLine.BankImpLineOrigCurrCode, (CurrencyCode)
output dataset tqCurrencyByCode) in BCurrency>
find first tqCurrencyByCode no-error.
if not available tqCurrencyByCode
then do:
assign vcMessage = trim(substitute( #T-6'The currency code &1 cannot be found.':255(68523)t-6#,
trim(tBankImpLine.BankImpLineOrigCurrCode))).
<M-7 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBankImpLine.BankImpLineOrigCurrCode':U (icFieldName),
input tBankImpLine.BankImpLineOrigCurrCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7576':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
return.
end.
assign oiCurrencyId = tqCurrencyByCode.tiCurrency_ID
ocCurrencyCode = tqCurrencyByCode.tcCurrencyCode.
end.
end. /* if tBankImpLine.BankImpLineOrigCurrCode <> "":U and tBankImpLine.BankImpLineOrigCurrCode <> ? */
/* Get currency by own bank number */
else do:
/* Create processing info */
<M-82 run CreateBankImpLineProcessInfo
(input 'GetBankNumberByNumber':U (icProcessName),
input #T-82'Get bank number':255(151076041)T-82# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'GetCurrencyByBankImpLine':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-12 run GetBankNumberByNumber
(input {&BANKNUMBERPARENTTYPE-GL} (icBankNumberParentType),
input tBankImpLine.BankImpLineOwnBankNumber (icBankNumber),
output viDummy (oiBankNumberId),
output vcDummy (ocBankNumber),
output viDummy (oiParentObjectId),
output vcDummy (ocParentObjectCode),
output vilCurrencyId (oiCurrencyId),
output vclCurrencyCode (ocCurrencyCode),
output viTransactionCompanyId (oiTransactionCompanyId),
input ? (icBankImpCurrencyCode),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper
oiReturnStatus = viLocalReturn.
<M-55 run UpdateBankImpLineProcessResult
(input 'GetBankNumberByNumber':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then return.
assign oiCurrencyId = vilCurrencyId
ocCurrencyCode = vclCurrencyCode.
end.
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.