project QadFinancials > class BBankImportLine > method ProcessBankImpLineNewBankEntry
Description
This method creates new banking entry record and allocates it.
Parameters
ilIsBatchProcessing | input | logical | the method is called by mulitple places. we need to identify them. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bbankimportline.p)
/* =================================================================================================== */
/* Method : ProcessBankImpLineNewBankEntry */
/* Desc : This method creates new banking entry and alloctes it */
/* !!! This method has to be in the same segment as parent methods (expects correct */
/* record in table tBankImpLine) - segment 6 */
/* --------------------------------------------------------------------------------------------------- */
/* =================================================================================================== */
assign oiReturnStatus = -98
vcParam = '':U
vcCriteria = '':U.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not available tBankImpLine
then do:
assign vcMessage = #T-1'Missing definition of imported bank line.':255(67965)T-1#.
<M-2 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-7537':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
return.
end.
/* =================================================================================================== */
/* Open communication with BankEntry component */
/* =================================================================================================== */
if viBBankEntryID = 0 or viBBankEntryID = ?
then do:
<I-3 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BBankEntry"}>
end.
else if not valid-handle(vhBBankEntryInst)
then do:
<I-4 {bFcOpenInstance
&CLASS = "BBankEntry"}>
end.
assign viLocalReturn = 0.
/*Enable to use BankImportLine.tc_rowid to call SetMessage in BBankEntry*/
<M-90 run SetExternalUniqueIDForSetMessage
(input true (ilUseExternalUID),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
CREATE_BANK_STATEMENT:
do:
/* =================================================================================================== */
/* Get definition of own bank number */
/* =================================================================================================== */
<Q-90 run GetBankImpByLineID (all) (Read) (NoCache)
(input tBankImpLine.BankImpLine_ID, (BankImpLineID)
output dataset tqGetBankImpByLineID) in BBankImportLine>
find first tqGetBankImpByLineID where
tqGetBankImpByLineID.tiBankImpLine_ID = tBankImpLine.BankImpLine_ID
no-error.
if available tqGetBankImpByLineID
then assign vcBankImpCurrencyCode = tqGetBankImpByLineID.tcBankImpCurrencyCode.
/* Create Processing Info */
<M-84 run CreateBankImpLineProcessInfo
(input 'GetBankNumberByNumber':U (icProcessName),
input #T-29'Get Own bank number':255(242707683)T-29# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign viOriginalCompanyId = viCompanyId.
<M-17 run GetBankNumberByNumber
(input {&BANKNUMBERPARENTTYPE-GL} (icBankNumberParentType),
input tBankImpLine.BankImpLineOwnBankNumber (icBankNumber),
output tBankImpLine.tiOwnBankNumber_ID (oiBankNumberId),
output vcDummy (ocBankNumber),
output viDummy (oiParentObjectId),
output vcBankGLCode (ocParentObjectCode),
output viCurrencyId (oiCurrencyId),
output vcDummy (ocCurrencyCode),
output viTransactionCompanyId (oiTransactionCompanyId),
input vcBankImpCurrencyCode (icBankImpCurrencyCode),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-44 run UpdateBankImpLineProcessResult
(input 'GetBankNumberByNumber':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* check if CompanyId of OwnBankNumber is different from viCompanyId */
if viTransactionCompanyId <> vicompanyid
then do:
<Q-15 run ResourceByURIUsr (all) (Read) (Cache)
(input viTransactionCompanyId, (CompanyId)
input 'urn:cbf:BBankImportLineProcess.BankImportProcess', (ResourceURI)
input viUsrId, (UsrId)
input true, (CompanyIsActive)
output dataset tqResourceByURIUsr) in BResource>
find first tqResourceByURIUsr where
tqResourceByURIUsr.tiCompany_ID = viTransactionCompanyId
no-error.
if not available tqResourceByURIUsr
then do:
<Q-33 run CompanyPrim (all) (Read) (Cache)
(input viTransactionCompanyId, (LookupCompanyId)
input ?, (CompanyCode)
output dataset tqCompanyPrim) in BCompany>
find first tqCompanyPrim where
tqCompanyPrim.tiCompany_ID = viTransactionCompanyId
no-error.
assign vcMessage = trim(#T-40'You are not allowed to run this function for the entity:':255(31244017)T-40#) +
(if available tqCompanyPrim then tqCompanyPrim.tcCompanyCode else '').
<M-995 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-306294':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
leave CREATE_BANK_STATEMENT.
end.
/* Change the ViCompanyId to CompanyId of OwnBankNumber */
<I-21 {bFcOpenInstance
&CLASS = "Session"}>
<M-57 run SwitchCompany
(input ? (icCompanyCode),
input viTransactionCompanyId (iiCompanyId),
output viFcReturnSuper (oiReturnStatus)) in Session>
<I-59 {bFcCloseInstance
&CLASS = "Session"}>
if viFcReturnSuper < 0
then do:
assign vcMessage =trim(#T-79'The system failed to switch the entity.':255(334825313)T-79#).
<M-37 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-735086':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave CREATE_BANK_STATEMENT.
end.
/* Keep the instance in local variables, so that you can set them back after everything is done in other instance */
assign vhBBETemp = vhBBankEntryInst
viBBETemp = viBBankEntryID.
/* Opening Instance of class BBankEntry for new entity */
<I-42 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BBankEntry"}>
/*Enable to use BankImportLine.tc_rowid to call SetMessage in BBankEntry*/
<M-56 run SetExternalUniqueIDForSetMessage
(input true (ilUseExternalUID),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
end. /*if viTransactionCompanyId <> vicompanyid*/
/* =================================================================================================== */
/* Create header of the bank statement */
/* =================================================================================================== */
if ilIsBatchProcessing = false then
do:
<M-5 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave CREATE_BANK_STATEMENT.
end.
if tBankImpLine.BankImpLineOrigTransDate = ?
then assign tBankImpLine.BankImpLineOrigTransDate = tBankImpLine.BankImpLineValueDate.
if tBankImpLine.BankImpLineBatchNbr <> 0 and
tBankImpLine.BankImpLineBatchNbr <> ?
then do:
assign vcBankImpLineRef = string(tBankImpLine.BankImpLineBatchNbr).
end.
else do:
if available tqGetBankImpByLineID
then assign vcBankImpLineRef = tqGetBankImpByLineID.tcBankImpFileName.
end.
<M-6 run AddBankEntryHeader
(input vcBankGLCode (icBankGLCode),
input-output tBankImpLine.BankImpLineStatNumber (bcStatementNumber),
input tBankImpLine.BankImpLineOrigTransDate (itTransactionDate),
input tBankImpLine.BankImpLineInfo (icInfo),
input vcBankImpLineRef (icBankImpLineRef),
output tBankImpLine.BankState_ID (oiBankStateId),
output vcBankStateRowId (ocBankStateRowId),
output viBankStateYear (oiBankStateYear),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
/* Create Processing Info */
<M-53 run CreateBankImpLineProcessInfo
(input 'AddBankEntryHeader':U (icProcessName),
input #T-42'Create bank entry header info':255(74266279)T-42# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input viLocalReturn (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Create bank statement line */
/* =================================================================================================== */
assign vcBankLineInOut = (if tBankImpLine.BankImpLineInOut = {&TRANSDIRECTION-IN}
then {&BANKSTATELINEINOUT-IN}
else {&BANKSTATELINEINOUT-OUT})
vcBankStateLineDesc = tBankImpLine.BankImpLineDescription.
/* Make sure that the BankStateLineDescription is filled with value */
if vcBankStateLineDesc = '':U or vcBankStateLineDesc = ?
then assign vcBankStateLineDesc = tBankImpLine.BankImpLinePaymentRef.
if vcBankStateLineDesc = '':U or vcBankStateLineDesc = ?
then assign vcBankStateLineDesc = tBankImpLine.BankImpLineOwnBankNumber + 'Statement':U.
assign vlIsUnAllocateStatement = if tBankImpLine.BankImpLineAction = {&BANKIMPORTACTION-CREATEBE}
then true
else false
vcBankStateLineReferenceExt = substring(tBankImpLine.BankImpLineInvRefList,1,40,"CHARACTER")
vcBankStateLineDebCredExt = if (tBankImpLine.BankImpLineDebtorCode <> "":U and
tBankImpLine.BankImpLineDebtorCode <> ?)
then tBankImpLine.BankImpLineDebtorCode
else tBankImpLine.BankImpLineCreditorCode.
for each tBankImpLineDet no-lock:
assign vdBankImpLineAmountSumTC = vdBankImpLineAmountSumTC + tBankImpLineDet.BankImpLineAmountTC.
end.
<M-9 run AddBankEntryLine
(input vcBankStateRowId (icBankEntryRowId),
input tBankImpLine.BankImpLineOrigTransDate (itTransactionDate),
input tBankImpLine.BankImpLineValueDate (itValueDate),
input vcBankStateLineDesc (icDescription),
input vdBankImpLineAmountSumTC (idTransactionAmountTC),
input vcBankLineInOut (icTransactionInOut),
input tBankImpLine.BankImpLinePaymentRef (icReference),
input vcBankStateLineReferenceExt (icReferenceExt),
input tBankImpLine.BankImpLineInfo (icInfo),
input tBankImpLine.BankImpLineDebtorName (icPartnerName),
input tBankImpLine.BankImpLineAddressLine (icAddressLine),
input tBankImpLine.BankImpLineAddressCity (icAddressCity),
input tBankImpLine.BankImpLineAddressZip (icAddressZip),
input tBankImpLine.BankImpLineAddressCountry (icAddressCountry),
input tBankImpLine.BankImpLineBankNumber (icPartnerBankNumber),
input vcBankStateLineDebCredExt (icPartnerDebCred),
input tBankImpLine.BankImpLineOrigAmountTC (idOrigAmountTC),
input tBankImpLine.BankImpLineOrigCurrCode (icOrigCurrCode),
input tBankImpLine.BankImpLineExchangeRate (idBankExchangeRate),
input tBankImpLine.BankImpLineRateScale (idBankRateScale),
input tBankImpLine.BankImpLineCost (icCost),
input tBankImpLine.tc_Rowid (icBankImportLineRowID),
output vcBankStateLineRowId (ocBankStateLineRowId),
input vlIsUnAllocateStatement (ilIsUnAllocatedStatement),
input vcBankImpLineRef (icBankImpLineRef),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
/* Create Processing Info */
<M-46 run CreateBankImpLineProcessInfo
(input 'AddBankEntryLine':U (icProcessName),
input #T-88'Create bank entry line data':255(677416537)T-88# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input viLocalReturn (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Allocate payment */
/* =================================================================================================== */
if tBankImpLine.BankImpLineAction <> {&BANKIMPORTACTION-CREATEBE}
then do:
if tBankImpLine.BankImpLineInOut = {&TRANSDIRECTION-IN}
then do:
/* =================================================================================================== */
/* Get the PIBF Configuration properties */
/* =================================================================================================== */
if tBankImpLine.tiOwnBankNumber_ID <> 0 and
tBankImpLine.tiOwnBankNumber_ID <> ?
then do:
<Q-330 run PAYConfByBankNumberID (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tBankImpLine.tiOwnBankNumber_ID, (BankNumberId)
output dataset tqPayConfByBankNumberID) in BPayConf>
find first tqPayConfByBankNumberID no-error.
if available tqPayConfByBankNumberID
then assign vlIsNewBEForPayCheck = if tqPayConfByBankNumberID.tcPayConfPIBFNoCustOrDDocAction = {&PAYCONFNOCUSTOMERACT-NEW-BE} then yes
else no.
end.
/* =================================================================================================== */
/* Get definition of debtor */
/* =================================================================================================== */
/* Create Processing Info */
<M-47 run CreateBankImpLineProcessInfo
(input 'GetDebtorByBankImpLine':U (icProcessName),
input #T-23'Get customer info':255(989613730)T-23# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-18 run GetDebtorByBankImpLine
(input vlIsNewBEForPayCheck (ilIsClearErrMsg),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-50 run UpdateBankImpLineProcessResult
(input 'GetDebtorByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0
then do:
<M-63 run MarkAllBankEntryLinesAsUnallocated
(input tBankImpLine.BankState_ID (iiBankStateID),
input vcBankStateLineRowId (icBankStateLineRowId),
input not vlIsNewBEForPayCheck (ilRemoveBankState),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if vlIsNewBEForPayCheck then
do:
/*=========================================================================================== */
/* Unallocated banking entry information message */
/* ========================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0
tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-OK}
tBankImpLine.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEUNBE}
tBankImpLine.tlIsDifferentAction = true
vcMessageReference = string(viBankStateYear) + "/" +
tBankImpLine.BankImpLineStatNumber + "/" +
vcBankImpLineRef
vcMessage = trim(substitute(#T-86'Please allocate bank entry later. (Year/Number/BankImportReference : &1)':255(297808028)T-86#,
vcMessageReference)).
<M-513 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'I':U (icType),
input 4 (iiSeverity),
input tBankImpLine.tc_Rowid (icRowid),
input 'qadfin-283326':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
end.
leave CREATE_BANK_STATEMENT.
end.
/* =================================================================================================== */
/* Get the own banknumber and PayformatType base on the Bank Import Line information */
/* =================================================================================================== */
/* Create Processing Info */
<M-77 run CreateBankImpLineProcessInfo
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input #T-60'Get own bank number':255(242707683)T-60# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-25 run GetOwnBankNumberByBankImpLine
(output viDummy (oiBankNumberId),
output vcOwnBankNumber (ocBankNumberNumber),
output viDummy (oiGLId),
output vcDummy (ocGLCode),
output viDummy (oiBankPaymentFormatId),
output vcPayFormatTypeCode (ocPaymentFormatCode),
output viDummy (oiCurrencyId),
output vcDummy (ocCurrencyCode),
output viDummy (oiTransactionCompanyId),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-45 run UpdateBankImpLineProcessResult
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Get the Debtor BankNumber_ID base on the Bank Import Line information */
/* =================================================================================================== */
<Q-26 run BankNumberByBankFileFormat (all) (Read) (NoCache)
(input tBankImpLine.Debtor_ID, (ParentObjectId)
input tBankImpLine.BankImpLineFileFormatCode, (BankFileFormat)
input vcOwnBankNumber, (ownBankNumber)
input {&PAYFORMATMODULE-AR}, (PayFormatTypeModule)
input viCompanyId, (CompanyId)
output dataset tqBankNumberByBankFileFormat) in BBankNumber>
find first tqBankNumberByBankFileFormat no-error.
if available tqBankNumberByBankFileFormat
then do:
assign tBankImpLine.BankImpLineBankNumber = tqBankNumberByBankFileFormat.tcParentBankNumber.
end.
else do:
assign vcMessage = trim(substitute(#T-28'The own bank &1 for payment format &2 is not defined for this customer.':255(73464654)T-28#,
tBankImpLine.BankImpLineOwnBankNumber,vcPayFormatTypeCode)).
<M-27 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-7820':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
end.
/* Create Processing Info */
assign vcParam = "BankImpLineBankNumber = " + tqBankNumberByBankFileFormat.tcParentBankNumber
vcCriteria = "DebtorCode = " + tBankImpLine.BankImpLineDebtorCode +
";BankFileFormat = " + tBankImpLine.BankImpLineFileFormatCode +
";OwnBankNumber = " + vcOwnBankNumber +
";PayFormatTypeModule = " + {&PAYFORMATMODULE-AR}.
<M-32 run CreateBankImpLineProcessInfo
(input 'BankNumberByBankFileFormat':U (icProcessName),
input #T-51'Get customer bank info':255(810157487)T-51# (icProcessDesc),
input if oiReturnStatus = -1 then '':U else vcParam (icProcessResult),
input if oiReturnStatus = -1 then '':U else vcCriteria (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input oiReturnStatus (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if oiReturnStatus = -1 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Try to find debtor document of this payment transaction */
/* =================================================================================================== */
/* Create Processing Info */
<M-67 run CreateBankImpLineProcessInfo
(input 'GetDDocumentByBankImpLine':U (icProcessName),
input #T-10'Get customer payment info':255(35347084)T-10# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-10 run GetDDocumentByBankImpLine
(output tBankImpLine.DDocument_ID (oiDDocumentId),
output viDocumentYear (oiDDocumentYear),
output vcDocumentType (ocDDocumentType),
output viDocumentNumber (oiDDocumentNumber),
input viCurrencyId (iiCurrencyID),
input vlIsNewBEForPayCheck (ilIsClearErrMsg),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-93 run UpdateBankImpLineProcessResult
(input 'GetDDocumentByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0
then do:
<M-39 run MarkAllBankEntryLinesAsUnallocated
(input tBankImpLine.BankState_ID (iiBankStateID),
input vcBankStateLineRowId (icBankStateLineRowId),
input not vlIsNewBEForPayCheck (ilRemoveBankState),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if vlIsNewBEForPayCheck then
do:
/*=========================================================================================== */
/* Create unallocated banking entry if ddoc doesn't exist */
/* ========================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0
tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-OK}
tBankImpLine.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEUNBE}
tBankImpLine.tlIsDifferentAction = true
vcMessageReference = string(viBankStateYear) + "/" +
tBankImpLine.BankImpLineStatNumber + "/" +
vcBankImpLineRef
vcMessage = trim(substitute(#T-35'Please allocate bank entry later. (Year/Number/BankImportReference : &1)':255(297808028)T-35#,
vcMessageReference)).
<M-76 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'I':U (icType),
input 4 (iiSeverity),
input tBankImpLine.tc_Rowid (icRowid),
input 'qadfin-796473':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
end.
leave CREATE_BANK_STATEMENT.
end.
/* =================================================================================================== */
/* Allocate debtor document to bank entry line */
/* =================================================================================================== */
<M-14 run AddBankEntryAllocateDocument
(input vcBankStateLineRowId (icBankStateLineRowId),
input viDocumentYear (iiDDocumentYear),
input vcDocumentType (icDDocumentType),
input viDocumentNumber (iiDDocumentNumber),
input ? (iiCDocumentYear),
input ? (icCDocumentType),
input ? (iiCDocumentNumber),
input vcBankImpLineRef (icBankImpLineRef),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
/* Create Processing Info */
<M-863 run CreateBankImpLineProcessInfo
(input 'AddbankEntryAllocateDocument':U (icProcessName),
input #T-67'Allocate customer payment to bank entry line':255(988295214)T-67# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input viLocalReturn (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
end. /* of if tBankImpLine.BankImpLineInOut = {&TRANSDIRECTION-IN} */
else do:
/* =================================================================================================== */
/* Get definition of creditor */
/* =================================================================================================== */
/* Create Processing Info */
<M-69 run CreateBankImpLineProcessInfo
(input 'GetCreditorByBankImpLine':U (icProcessName),
input #T-9'Get supplier info':255(959221706)T-9# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-24 run GetCreditorByBankImpLine (output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-767 run UpdateBankImpLineProcessResult
(input 'GetCreditorByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Get the own banknumber and PayformatType base on the Bank Import Line information */
/* =================================================================================================== */
<M-87 run CreateBankImpLineProcessInfo
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input #T-64'Get own bank number and payment format type':255(932355768)T-64# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-29 run GetOwnBankNumberByBankImpLine
(output viDummy (oiBankNumberId),
output vcOwnBankNumber (ocBankNumberNumber),
output viDummy (oiGLId),
output vcDummy (ocGLCode),
output viDummy (oiBankPaymentFormatId),
output vcPayFormatTypeCode (ocPaymentFormatCode),
output viDummy (oiCurrencyId),
output vcDummy (ocCurrencyCode),
output viDummy (oiTransactionCompanyId),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-214 run UpdateBankImpLineProcessResult
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Try to find creditor document of this payment transaction */
/* =================================================================================================== */
<M-74 run CreateBankImpLineProcessInfo
(input 'GetCDocumentByBankImpLine':U (icProcessName),
input #T-75'Get supplier payment info':255(327330528)T-75# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-23 run GetCDocumentByBankImpLine
(output tBankImpLine.CDocument_ID (oiCDocumentId),
output viDocumentYear (oiCDocumentYear),
output vcDocumentType (ocCDocumentType),
output viDocumentNumber (oiCDocumentNumber),
input viCurrencyId (iiCurrencyID),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-71 run UpdateBankImpLineProcessResult
(input 'GetCDocumentByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
/* =================================================================================================== */
/* Allocate Creditor document to bank entry line */
/* =================================================================================================== */
<M-22 run AddBankEntryAllocateDocument
(input vcBankStateLineRowId (icBankStateLineRowId),
input ? (iiDDocumentYear),
input ? (icDDocumentType),
input ? (iiDDocumentNumber),
input viDocumentYear (iiCDocumentYear),
input vcDocumentType (icCDocumentType),
input viDocumentNumber (iiCDocumentNumber),
input vcBankImpLineRef (icBankImpLineRef),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
/* Create Processing Info */
<M-54 run CreateBankImpLineProcessInfo
(input 'AddbankEntryAllocateDocument':U (icProcessName),
input #T-50'Allocate supplier payment to bank entry line':255(162980507)T-50# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineNewBankEntry':U (icParentRowName),
input viLocalReturn (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CREATE_BANK_STATEMENT.
end.
end.
/* =================================================================================================== */
/* Validate component and Additional Updates */
/* =================================================================================================== */
if ilIsBatchProcessing = false then
do:
<M-16 run ValidateBCAndAdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
end.
if viOriginalCompanyId <> viTransactionCompanyId
then do:
<I-36 {bFcCloseInstance
&CLASS = "BBankEntry"}>
assign vhBBankEntryInst = vhBBETemp.
viBBankEntryID = viBBETemp.
<I-75 {bFcOpenInstance
&CLASS = "Session"}>
<M-88 run SwitchCompany
(input ? (icCompanyCode),
input viOriginalCompanyId (iiCompanyId),
output viFcReturnSuper (oiReturnStatus)) in Session>
<I-43 {bFcCloseInstance
&CLASS = "Session"}>
if viFcReturnSuper < 0
then do:
assign vcMessage =trim( #T-73'The system failed to switch the entity.':255(334825313)T-73# ).
<M-38 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-502124':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viReturnStatus (oiReturnStatus)) in BBankImportLine>
if viReturnStatus <> 0 then assign viLocalReturn = viReturnStatus.
if viReturnStatus < 0 then leave CREATE_BANK_STATEMENT.
end.
end. /* if viOriginalCompanyId <> viTransactionCompanyId */
if viFcReturnSuper < 0 then leave CREATE_BANK_STATEMENT.
end. /* of CREATE_BANK_STATEMENT: */
/* ========================================================================================================= */
/* This method simply marks all banking-entry lines as unallocated; the idea behind this is that this method */
/* gets called from within the BankImport-classes in case something goes wrong. */
/* Once all BankingEntry lines are marked as Unallocated, the associated postings will be removed from the */
/* JournalEntry-instance and thus the JournalEntry-instance will be stopped. These JournalEntry-related */
/* actions are done in BBankEntry:StopExternalInstances */
/* Do not catch the return-status of this method as this is only called when a previous error occured */
/* ========================================================================================================= */
if viLocalReturn < 0
then do :
<M-98 run MarkAllBankEntryLinesAsUnallocated
(input tBankImpLine.BankState_ID (iiBankStateID),
input vcBankStateLineRowId (icBankStateLineRowId),
input true (ilRemoveBankState),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
end. /* if viLocalReturn < 0 */
/* =================================================================================================== */
/* Close instance communication with BankEntry component */
/* =================================================================================================== */
if ilIsBatchProcessing = false then
do:
<I-19 {bFcCloseInstance
&CLASS = "BBankEntry"}>
end.
/* ====== */
/* Return */
/* ====== */
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.