Parameters
| iiBankGL_ID | input | integer | |
| ilisIndividualInvoices | input | logical | |
| ilisRepetitiveTransfer | input | logical | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bpaymentselection.p)
/* Generate files */
for each tCCollectionPaySel where
tCCollectionPaySel.tc_Status <> "D":U
break by tCCollectionPaySel.CCollection_ID:
if not ilisRepetitiveTransfer and
tCCollectionPaySel.tc_Status = "":U
then next.
if first-of(tCCollectionPaySel.CCollection_ID)
then do:
/* comment by Shuhang Xie(shx), we don't use this old formats in Early adaopter */
/*
case tCCollectionPaySel.tcPayFormatType:
when {&PAYMENTFORMAT-UNIFI}
then do:
<M-11 run ExportUNIFI (input tCCollectionPaySel.CCollection_ID (iiCCollection_ID),
input not ilisIndividualInvoices (ilGroupingAllowed),
input tCCollectionPaySel.tcOutputFileName (icOutputFileName),
input ? (itPayDate),
input iiBankGL_ID (iiGL_ID),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end.
when {&PAYMENTFORMAT-BE1}
then do:
<M-1 run ExportBEInland (input tCCollectionPaySel.CCollection_ID (iiCCollection_ID),
input not ilisindividualInvoices (ilGroupingAllowed),
input tCCollectionPaySel.tcOutputFileName (icOutputFileName),
input ? (itPayDate),
input iiBankGL_ID (iiGL_ID),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end.
when {&PAYMENTFORMAT-BE2}
then do:
<M-2 run ExportBEAbroad (input tCCollectionPaySel.CCollection_ID (iiCCollection_ID),
input not ilisindividualInvoices (ilGroupingAllowed),
input tCCollectionPaySel.tcOutputFileName (icOutputFilename),
input ? (itPayDate),
input iiBankGL_ID (iiGL_ID),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end.
when {&PAYMENTFORMAT-NL1}
then do:
<M-9 run ExportNLInland (input tCCollectionPaySel.CCollection_ID (iiCCollection_ID),
input not ilisIndividualInvoices (ilGroupingAllowed),
input tCCollectionPaySel.tcOutputFileName (icOutputFileName),
input ? (itPayDate),
input iiBankGL_ID (iiGL_ID),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end.
otherwise do:
assign oiReturnStatus = -1.
return.
end.
end case.
*/
if tCCollectionPaySel.CCollectionIsAutomatic <> true
then do:
<M-24 run SetMessage
(input #T-11'Only Electronic Transfer Automatic could be Executed or Re-Executed':255(65000)T-11# (icMessage),
input '':U (icArguments),
input 'CCollectionIsAutomatic':U (icFieldName),
input tCCollectionPaySel.CCollectionIsAutomatic (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6880':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
if tCCollectionPaySel.tiPaySel_ID = 0 or tCCollectionPaySel.tiPaySel_ID = ?
then do:
<Q-25 run CCollectionByIDAllInfo (all) (Read) (NoCache)
(input ?, (CompanyId)
input tCCollectionPaySel.CCollection_ID, (CCollection_Id)
output dataset tqCCollectionByIDAllInfo) in BCCollection >
find first tqCCollectionByIDAllInfo where
tqCCollectionByIDAllInfo.tiCCollection_ID = tCCollectionPaySel.CCollection_ID
no-error.
if available tqCCollectionByIDAllInfo
then assign tCCollectionPaySel.tiPaySel_ID = tqCCollectionByIDAllInfo.tiPaySel_ID.
end.
<M-18 run BuildProDataSet
(input tCCollectionPaySel.tiPaySel_ID (iiPaySel_ID),
output vhProdataSet (ohDSet),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper>0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 or not valid-handle(vhProdataSet)
then do:
<M-20 run SetMessage
(input #T-8'ProdataSet of the BankFormat Built Failed':100(59546)T-8# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'QadFin-6019':U (icFcMsgNumber),
input 'Check the PaymentSelection':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
find first tPaySel where tPaySel.PaySel_ID = tCCollectionPaySel.tiPaySel_ID no-error.
if not available tPaySel
then do:
<M-17 run DataLoad
(input '':U (icRowids),
input string(tCCollectionPaySel.tiPaySel_ID) (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
end.
if available tPaySel
then do:
<Q-19 run BankPayFormatByID (all) (Read) (NoCache)
(input tPaySel.BankPayFormat_ID, (BankPayFormatId)
input ?, (CompanyId)
output dataset tqBankPayFormatByID) in BBankPayFormat >
find first tqBankPayFormatByID no-error.
if not available tqBankPayFormatByID
then do:
<M-23 run SetMessage
(input #T-10'The bank file format specified is not defined in the system.':100(999890611)T-10# (icMessage),
input '':U (icArguments),
input 'tPaySel.BankPayFormat_ID':U (icFieldName),
input tPaySel.BankPayFormat_ID (icFieldValue),
input 'S':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6042':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
end.
if viPEDIID = 0 or viPEDIID = ?
then do:
<I-13 {bFcStartAndOpenInstance
&CLASS = "PEDI"}>
end.
else do:
<I-14 {bFcOpenInstance
&CLASS = "PEDI"}>
end.
<M-15 run ExecuteEDI
(input-output vhProdataSet (bzProDataSet),
input 'APBankPayment':U (icSubSystemName),
output viFcReturnSuper (oiReturnStatus)) in PEDI>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper = 1
then do:
<M-26 run SetMessage
(input #T-12'The output file has been created, regardless the option you choose for this Warning. You can use the Supplier Payment Selection Re-Execute function to create a new file':255(999890767)T-12# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 4 (iiSeverity),
input ? (icRowid),
input 'QadFin-9294':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
end.
if viFcReturnSuper < 0
then do:
<M-21 run SetMessage
(input #T-9'An error occurred when processing EDI. Ensure that the bank file format is supported and that the mapping is correct.':200(999890612)T-9# (icMessage),
input tqBankPayFormatByID.tcPayFormatTypeCode (icArguments),
input 'tqBankPayFormatByID.tcPayFormatTypeCode':U (icFieldName),
input tqBankPayFormatByID.tcPayFormatTypeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'QadFin-6021':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
<I-22 {bFcCloseAndStopInstance
&CLASS = "PEDI"}>
if valid-handle(vhProdataSet)
then do:
delete object vhProdataSet.
end.
assign oiReturnStatus = -1.
return.
end.
if valid-handle(vhProdataSet)
then do:
delete object vhProdataSet.
end.
<I-16 {bFcCloseAndStopInstance
&CLASS = "PEDI"}>
/* create history record */
for each tPaySel where tPaySel.tc_Status = "C":U and
vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTE} or
vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN}:
<M-4 run AddDetailLine (input 'PaySelHistory':U (icTable),
input tPaySel.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign tPaySelHistory.PaySelHistoryDate = today
tPaySelHistory.Usr_ID = viUsrId
tPaySelHistory.tcUsrLogin = vcUserLogin
tPaySelHistory.PaySelHistoryDescription = substring((if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN} then #T-27'Re-executed':40(413930550)T-27# else #T-28'Executed':40(4423)T-28#),1,40,'CHARACTER':U)
tPaySelHistory.PaySelHistoryOutFileName = tCCollectionPaySel.tcOutputFileName
tPaySelHistory.PaySelStatus = {&PAYMENTSELECTIONSTATUS-TRANSFERRED}.
end.
end.
end.