Description
This method performs processing of the imported line records, first of all it updates records based on the changes on the UI and if required also processing of the records is done.
All data for processing has be already passed to BL by method SaveAndProcessInit. This method passes to UI number of processed records.
Processing of the imported records is done in separate transactions. One processed record is one transactions.
In the case of 1 check to pay multiple invoices, if there is already 1 invoice of them be processed, the method will skip to process the record but copy processed log to non-processed record directly.
Parameters
| tBankImpLineRef | input-output | temp-table | Referenced Bank Import Line |
| tBankImpLineLogRef | input-output | temp-table | Referenced Bank Import Line Log |
| icTransactionAction | input | character | Transaction Action |
| icSubmitAction | input | character | Submit Action |
| ilIsCreateNewDocInPaid | input | logical | whether to create paid document |
| ilIsCreateBankEntryForPaid | input | logical | whether to create BankEntry for paid document |
| ilIsAllocateOtherEntity | input | logical | AllocateOtherEntity |
| ilExistProcessedBankImpLineDet | input | logical | Exist Processed BankImpLineDet |
| tBankImpLineDetRef | input | temp-table | Referenced Bank Import Line Details |
| ocRefList | output | character | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bbankimportline.p)
/* =================================================================================================== */
/* Method : SaveAndProcess */
/* Desc : This method performs processing of the imported line records, first of all it updates */
/* records based on the changes on the UI and if required also processing of the records */
/* is done. */
/* All data for processing has be already passed to BL by method SaveAndProcessInit */
/* This method passes to UI number of processed records */
/* Processing of the imported records is done in separate transactions. One processed */
/* record is one transactions */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (O) ocRefList List of References which are processed */
/* =================================================================================================== */
assign oiReturnStatus = -98.
if not vlIsStartFromSaveAndProcess
then assign vlIsStartFromSaveAndProcess = true
vlIsBankProcessLogOpen = false.
/* =============================================================================================== */
/* Clear data in the instance */
/* =============================================================================================== */
/*
<M-35 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viExternalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
*/
empty temp-table tBankImpLineDet.
empty temp-table tBankImpLineDetLog.
/* =============================================================================================== */
/* Load all records to component instance */
/* =============================================================================================== */
assign vcIdList = "":U
vcRefList = ''.
for each tBankImpLineRef:
if vcIdList = "":U
then assign vcIdList = string (tBankImpLineRef.BankImpLine_ID).
else if lookup (string(tBankImpLineRef.BankImpLine_ID), vcIdList, chr(4)) = 0
then assign vcIdList = vcIdList + chr(4) + string (tBankImpLineRef.BankImpLine_ID).
if tBankImpLineRef.BankImpLinePaymentRef <> '' and length (vcRefList + chr(4) + tBankImpLineRef.BankImpLinePaymentRef,"CHARACTER") < 30000
then do:
if vcRefList = "":U
then assign vcRefList = tBankImpLineRef.BankImpLinePaymentRef.
else
if lookup (tBankImpLineRef.BankImpLinePaymentRef, vcRefList, chr(4)) = 0
then assign vcRefList = vcRefList + chr(4) + tBankImpLineRef.BankImpLinePaymentRef.
end.
end. /* for each tBankImpLineRef */
for each tBankImpLineDetRef:
if vcIdList = "":U
then assign vcIdList = string (tBankImpLineDetRef.BankImpLine_ID).
else if lookup (string(tBankImpLineDetRef.BankImpLine_ID), vcIdList, chr(4)) = 0
then assign vcIdList = vcIdList + chr(4) + string (tBankImpLineDetRef.BankImpLine_ID).
if tBankImpLineDetRef.BankImpLinePaymentRef <> '' and length (vcRefList + chr(4) + tBankImpLineDetRef.BankImpLinePaymentRef,"CHARACTER") < 30000
then do:
if vcRefList = "":U
then assign vcRefList = tBankImpLineDetRef.BankImpLinePaymentRef.
else
if lookup (tBankImpLineDetRef.BankImpLinePaymentRef, vcRefList, chr(4)) = 0
then assign vcRefList = vcRefList + chr(4) + tBankImpLineDetRef.BankImpLinePaymentRef.
end.
end. /* for each tBankImpLineDetRef */
assign ocRefList = vcRefList.
<M-36 run DataLoad
(input '':U (icRowids),
input vcIdList (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viExternalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
for each tBankImpLineDetRef:
find first tBankImpLine where
tBankImpLine.BankImpLine_ID = tBankImpLineDetRef.BankImpLine_ID no-error.
if available tBankImpLine
then do:
create tBankImpLineDet.
buffer-copy tBankImpLine to tBankImpLineDet.
end.
find first tBankImpLineLog where
tBankImpLineLog.BankImpLine_ID = tBankImpLineDetRef.BankImpLine_ID no-error.
if available tBankImpLineLog
then do:
create tBankImpLineDetLog.
buffer-copy tBankImpLineLog to tBankImpLineDetLog.
end.
end.
/* Get Bank log open*/
<Q-83 run DomainPropertyByDomain (all) (Read) (NoCache)
(input viDomainID, (DomainID)
output dataset tqDomainPropertyByDomain) in BDomainProperty>
find first tqDomainPropertyByDomain no-error.
if available tqDomainPropertyByDomain then assign vlIsBankProcessLogOpen = tqDomainPropertyByDomain.tlDomainPropertyIsPIBFLogEnabled.
/* =============================================================================================== */
/* Save and Process data */
/* =============================================================================================== */
for each tBankImpLineRef:
find tBankImpLine where
tBankImpLine.BankImpLine_ID = tBankImpLineRef.BankImpLine_ID no-error.
if not available tBankImpLine
then do:
assign vcMessage = trim(substitute(#T-15'Data could not be loaded: cannot load Bank Import Line':255(68387)t-15#, replace(vcListBankImpLineIds, chr(4), ",":U))).
<M-14 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7645':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
return.
end. /* if viFcReturnSuper < 0 */
/* =============================================================================================== */
/* Copy values from Ref file to component data, and copy tBankImpLine to original table for */
/* Comparing Debtor/Creditor code and name */
/* =============================================================================================== */
buffer-copy tBankImpLine to tBankImpLineOrig.
buffer-copy tBankImpLineRef except tc_Status tc_Rowid tc_ParentRowid to tBankImpLine.
assign tBankImpLine.tc_Status = 'C':U.
/* =============================================================================================== */
/* Delete all previous errors (only when record will be processed) */
/* =============================================================================================== */
if icSubmitAction = {&BANKIMPSUBMIT-SAVEPROCESS} /* and icTransactionAction <> {&BANKIMPORTACTION-CREATEDDOCUMENT} */
then do:
for each tBankImpLineLog where
tBankImpLineLog.tc_ParentRowid = tBankImpLine.tc_Rowid:
/* Skip warning message for create-prepayment */
if tBankImpLine.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEPREPAY} and
tBankImpLineLog.BankImpLineLogType = "I":U
then next.
assign tBankImpLineLog.tc_Status = 'D':U.
end.
for each tBankImpLineLogRef where
tBankImpLineLogRef.tc_ParentRowid = tBankImpLineRef.tc_Rowid:
/* Skip warning message for create-prepayment */
if tBankImpLineRef.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEPREPAY} and
tBankImpLineLog.BankImpLineLogType = "I":U
then next.
delete tBankImpLineLogRef.
end.
end.
/* =============================================================================================== */
/* Process activity linked to the record */
/* =============================================================================================== */
if icSubmitAction = {&BANKIMPSUBMIT-SAVEPROCESS}
then do:
assign tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-OK}.
<M-16 run ProcessBankImpLineAction
(input icTransactionAction (icTransactionAction),
input ilIsCreateNewDocInPaid (ilCreateToPaid),
input ilIsCreateBankEntryForPaid (ilCreateBankEntry),
input ilIsAllocateOtherEntity (ilIncludeAllEntities),
input ilExistProcessedBankImpLineDet (ilExistProcessedBankImpLine),
input vlIsBankProcessLogOpen (ilIsBankProcessLogOpen),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
/*Store the Process User and Process Date to DB whatever process fail or success */
assign tBankImpLine.BankImpLineProcessDate = today
tBankImpLine.ProcessByUsr_ID = viUsrId
tBankImpLine.ProcessInCompany_ID = viCompanyId
tBankImpLine.BankImpLineIsCreateBE = ilIsCreateBankEntryForPaid
tBankImpLine.BankImpLineIsPayDDoc = ilIsCreateNewDocInPaid.
if viFcReturnSuper < 0
then do:
/* if there was error, some values of tbankimpline was updated, but they become invalid */
buffer-copy tBankImpLineRef except tc_Status tc_Rowid tc_ParentRowid to tBankImpLine.
/* store this error on the imported line also */
assign tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-ERROR}
tBankImpLineRef.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-ERROR}.
/* if there is error, stop all external instances */
/*
<M-38 run StopAndCloseExternalInstances
(input false (ilIsCloseOnly),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
*/
end.
else do:
/* During processing some values could be changed, we have to update ref data back */
buffer-copy tBankImpLine except tc_Status tc_Rowid tc_ParentRowid to tBankImpLineRef.
end.
assign tBankImpLine.tlIsProcessed = true.
for each tBankImpLineLogRef where
tBankImpLineLogRef.tc_ParentRowid = tBankImpLineRef.tc_Rowid:
delete tBankImpLineLogRef.
end.
/* Copy all errors to ref file */
for each tBankImpLineLog where
tBankImpLineLog.tc_ParentRowid = tBankImpLine.tc_Rowid and
tBankImpLineLog.tc_Status <> 'D':U:
create tBankImpLineLogRef.
buffer-copy tBankImpLineLog to tBankImpLineLogRef.
end.
end. /* if icSubmitAction = {&BANKIMPSUBMIT-SAVEPROCESS} */
end. /* for each tBankImpLineRef: */
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.