Description
Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bdpaymentselection.p)
<ANCESTOR-CODE>
for each tDPaySel:
/* bank details */
<Q-83 run GLPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ' ':U, (GLCode)
input tDPaySel.GL_ID, (GLId)
output dataset tqGLPrim) in BGL>
find first tqGLPrim no-error.
if not available tqGLPrim
then do:
<M-36 run SetMessage
(input '$1 is not a valid GL code':U (icMessage),
input tDPaySel.GL_ID (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-272546':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
else assign tDPaySel.tcGLCode = tqGLPrim.tcGLCode.
<Q-2 run BankPayFormatByID (all) (Read) (NoCache)
(input tDPaySel.BankPayFormat_ID, (BankPayFormatId)
input '', (CompanyId)
output dataset tqBankPayFormatByID) in BBankPayFormat>
for each tqBankPayFormatByID where
tqBankPayFormatByID.tiBankPayFormat_ID = tDPaySel.BankPayFormat_ID
no-lock:
assign tDPaySel.tcPayFormatTypeCode = tqBankPayFormatByID.tcPayFormatTypeCode
tDPaySel.tcBankNumber = tqBankPayFormatByID.tcBankNumber
tDPaySel.tcPayFormatTypePayInstrument = tqBankPayFormatByID.tcPayFormatTypePayInstrument.
end.
/* Get GL Currency */
<Q-60 run GLForCurrency (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tDPaySel.GL_ID, (GLId)
input ' ':U, (GLCode)
output dataset tqGLForCurrency) in BGL>
find first tqGLForCurrency where
tqGLForCurrency.tcGLCode = tDPaySel.tcGLCode
no-error.
if available tqGLForCurrency
then assign tDPaySel.tcBankCurrencyCode = if tqGLForCurrency.tlGLIsLocalCurrency
then vcCompanyLC
else tqGLForCurrency.tcCurrencyCode.
/* status */
assign vcTranslatedStatus = "":U.
if tDPaySel.DPaySelStatus <> "":U
then do:
do viCounter = num-entries({&DOCUMENTSTATUSS},chr(2)) to 1 by -2 :
if entry(viCounter,{&DOCUMENTSTATUSS},chr(2)) = tDPaySel.DPaySelStatus
then assign vcTranslatedStatus = entry(viCounter - 1,{&DOCUMENTSTATUSS},chr(2)) no-error.
end. /* do */
end. /* if available */
assign tDPaySel.tcDPaySelStatusTR = vcTranslatedStatus.
/* fill the calc fields of the PaySelLines */
<M-93 run CalculateDPaySelLine
(input no (ilPrepaymentOnly),
output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>
if viFcReturnSuper < 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
/* Fill in calculated fields for PaySelPayCode */
<M-85 run CalculateHeaderPayAttributes (output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>
if viFcReturnSuper < 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
for each tDPaySelPayCode
where tDPaySelPayCode.DPaySel_ID = tDPaySel.DPaySel_ID no-lock:
find first tDPaySelPayCodeRef where
tDPaySelPayCodeRef.tc_Rowid = tDPaySelPayCode.tc_Rowid
no-error.
if not available tDPaySelPayCodeRef
then do:
create tDPaySelPayCodeRef.
buffer-copy tDPaySelPayCode to tDPaySelPayCodeRef.
end.
end. /* for each tDPaySelPayCode */
/* Check to see if this payment selection has been executed. */
<Q-41 assign vlFcQueryRecordsAvailable = DCollectionByPaySel (NoCache)
(input tDPaySel.Company_ID, (CompanyId)
input tDPaySel.DPaySel_ID, (PaySelId)
input true, (Executed)) in BDCollection>
if vlFcQueryRecordsAvailable <> false
then assign tDPaySel.tlPaySelIsExecuted = true.
end. /* for each tDPaySel */