Description
This method gets BankImpLine records by input filters and merges them into tBankImpLineRef; duplicate records are excluded
Parameters
icFileName | input | character | Bank Import File Name |
icDiretion | input | character | Transaction Direction: IN or OUT |
icBankNumber | input | character | Own Bank Number |
icActions | input | character | Actions |
itTransFrom | input | date | Transaction Date from |
itTransTo | input | date | Transaction Date to |
itUploadFrom | input | date | Upload Date from |
itUploadTo | input | date | Upload Date to |
tBankImpLineRef | output | temp-table | Referenced Bank Import Line |
tBankImpLineLogRef | output | temp-table | Referenced Bank Import Line Log |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bbankimportline.p)
/* =================================================================================================== */
/* Method : GetBankImpLineByFilter */
/* Desc : This method gets BankImpLine records by input filters and merges them into */
/* tBankImpLineRef; duplicate records are excluded */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) icFileName File Name of Bank Import */
/* (I) icDirection Transaction Direction */
/* (I) icBankNumber Own Bank Number */
/* (I) icActions Actions */
/* (I) itTransFrom Transaction Date from */
/* (I) itTransTo Transaction Date to */
/* (I) itUploadFrom Upload Date from */
/* (I) itUploadTo UPload Date to */
/* (O) BankImpLineRef Bank Import Line */
/* (O) BankImpLineLogRef Bank Import Line Log */
/* =================================================================================================== */
/* Validation for action */
if icActions = "":U
then do:
assign vcMessage = trim(#T-8'You must select at least one action type to retrieve imported bank transactions.':255(68546)t-8#).
<M-7 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-7683':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
return.
end. /* end of if icActions = "":U */
/* ============================================================================================ */
/* Set proper value for TRANSDIRECTION-ALL when user choose "All" */
/* The reason why not set empty string value for it in pre-preprocessors is if we do that, */
/* A UI error message pops up when swithch to it in the drop down list (#Defect ID: 10249-0117 */
/* ============================================================================================ */
if icDiretion = {&TRANSDIRECTION-ALL} then assign icDiretion = "":U.
/* call query to get Bank Import Line by filters */
<Q-1 run BankImpLineByBankImp (all) (Read) (NoCache)
(input icFileName, (FileName)
input icDiretion, (TransDirection)
input icBankNumber, (OwnBankNumber)
input icActions, (Actions)
input itTransFrom, (TransFromDate)
input itUploadFrom, (UploadFromDate)
input itTransTo, (TransToDate)
input itUploadTo, (UploadToDate)
output dataset tqBankImpLineByBankImp) in BBankImportLine >
assign viCnt = 0.
for each tqBankImpLineByBankImp:
/* only create new record for those line record that not exist in ref table */
find first tBankImpLineRef where tBankImpLineRef.BankImpLine_ID = tqBankImpLineByBankImp.tiBankImpLine_ID
no-error.
if not available tBankImpLineRef
then do:
create tBankImpLineRef.
<M-2 run BufferCopy
(input buffer tqBankImpLineByBankImp:handle (ihFrom),
input buffer tBankImpLineRef:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
/* get the correct row_id for tBankImpLineRef; this helps to establish correct relationship on UI grid */
assign tBankImpLineRef.tc_ParentRowid = entry(2, tBankImpLineRef.tc_Rowid)
tBankImpLineRef.tc_Rowid = entry(1, tBankImpLineRef.tc_Rowid).
/* save the line ID to list for getting log */
if lookup(string(tqBankImpLineByBankImp.tiBankImpLine_ID), vcBankImpLineIDList, ',':U) = 0
then do :
assign vcBankImpLineIDList = if vcBankImpLineIDList = "":U
then string(tqBankImpLineByBankImp.tiBankImpLine_ID)
else vcBankImpLineIDList + ',':U + string(tqBankImpLineByBankImp.tiBankImpLine_ID)
viCnt = viCnt + 1.
if viCnt > 100
then do:
/* now load log record by imp line id list */
<Q-26 run BankImpLineLogByImpLine (all) (Read) (NoCache)
(input vcBankImpLineIDList, (BankImpLineIdList)
output dataset tqBankImpLineLogByImpLine) in BBankImportLine>
for each tqBankImpLineLogByImpLine:
/* only buffer copy those log record not in ref table */
find first tBankImpLineLogRef where
tBankImpLineLogRef.BankImpLineLog_ID = tqBankImpLineLogByImpLine.tiBankImpLineLog_ID
no-error.
if not available tBankImpLineLogRef
then do:
create tBankImpLineLogRef.
<M-92 run BufferCopy
(input buffer tqBankImpLineLogByImpLine:handle (ihFrom),
input buffer tBankImpLineLogRef:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign tBankImpLineLogRef.tc_ParentRowid = entry(2, tqBankImpLineLogByImpLine.tc_rowid)
tBankImpLineLogRef.tc_Rowid = entry(1, tqBankImpLineLogByImpLine.tc_rowid).
end. /* end of if not available tBankImpLineLogRef */
end. /* for each tqBankImpLineLogByImpLine */
assign viCnt = 0
vcBankImpLineIDList = ''.
end. /* if viCnt > 100 */
end. /* lookup(string(tqBankImpLineByBankImp.tiBankImpLine_ID), vcBankImpLineIDList, ',':U) = 0 */
end. /* end of if not available */
end. /* end of for each tqBankImpLineByBankImp */
/* Read the remaining Log Lines */
if viCnt > 0
then do:
/* now load log record by imp line id list */
<Q-9 run BankImpLineLogByImpLine (all) (Read) (NoCache)
(input vcBankImpLineIDList, (BankImpLineIdList)
output dataset tqBankImpLineLogByImpLine) in BBankImportLine >
for each tqBankImpLineLogByImpLine:
/* only buffer copy those log record not in ref table */
find first tBankImpLineLogRef where
tBankImpLineLogRef.BankImpLineLog_ID = tqBankImpLineLogByImpLine.tiBankImpLineLog_ID
no-error.
if not available tBankImpLineLogRef
then do:
create tBankImpLineLogRef.
<M-6 run BufferCopy
(input buffer tqBankImpLineLogByImpLine:handle (ihFrom),
input buffer tBankImpLineLogRef:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign tBankImpLineLogRef.tc_ParentRowid = entry(2, tqBankImpLineLogByImpLine.tc_rowid)
tBankImpLineLogRef.tc_Rowid = entry(1, tqBankImpLineLogByImpLine.tc_rowid).
end. /* end of if not available tBankImpLineLogRef */
end. /* for each tqBankImpLineLogByImpLine */
end. /* if viCnt > 0 */