Parameters
oiCreditorID | output | integer | A "Creditor" in the sense that this is the beneficiary of a payment transaction, but in case of a Debtor creditnote, this is in fact a Debtor_ID. |
ocCreditorName1 | output | character | |
ocCreditorStreet1 | output | character | |
ocCreditorStreet2 | output | character | |
ocCreditorStreet3 | output | character | |
ocCreditorZip | output | character | |
ocCreditorCity | output | character | |
ocCreditorCountryCode | output | character | |
ocCreditorCountryDescr | output | character | |
ocBankNumberParentType | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bpaymentselection.p)
/********************************************************************************************/
/* Prerequisite ; available records: */
/* - tPaySelLine */
/********************************************************************************************/
assign oiReturnStatus = -98.
assign vcPaySelMsg = "":U.
if tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-INVOICE} or
tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-INVOICECORR} or
tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-CREDITNOTE} or
tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-CREDITNOTECORR} or
tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV}
then do:
<Q-1 run CreditorPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (CreditorId)
input tPaySelLine.tcCreditorCode, (CreditorCode)
output dataset tqCreditorPrim) in BCreditor >
find first tqCreditorPrim where
tqCreditorPrim.tcCreditorCode = tPaySelLine.tcCreditorCode
no-lock no-error.
if not available(tqCreditorPrim)
then assign vcPaySelMsg = substitute(#T-2'Supplier (&1) is not defined in the system.':200(15791)t-2#,
trim(tPaySelLine.tcCreditorCode) ).
else assign oiCreditorID = tqCreditorPrim.tiCreditor_ID
ocBankNumberParentType = {&BANKNUMBERPARENTTYPE-CREDITOR}.
end.
else do:
<Q-3 run DebtorPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tPaySelLine.tcDebtorCode, (DebtorCode)
input ?, (Debtor_ID)
output dataset tqDebtorPrim) in BDebtor >
find first tqDebtorPrim where
tqDebtorPrim.tcDebtorCode = tPaySelLine.tcDebtorCode
no-lock no-error.
if not available(tqDebtorPrim)
then assign vcPaySelMsg = substitute(#T-4'Customer (&1) is not defined in the system.':200(15792)t-4#,
trim(tPaySelLine.tcDebtorCode) ).
else assign oiCreditorID = tqDebtorPrim.tiDebtor_ID
ocBankNumberParentType = {&BANKNUMBERPARENTTYPE-DEBTOR}.
end.
if (vcPaySelMsg <> "":U)
then do:
assign oiReturnStatus = -1.
<M-5 run SetMessage (input trim(vcPaySelMsg) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3800':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
return.
end.
/* Get the BusinessRelation Address */
<Q-6 run AddressByAddressBusRelType (all) (Read) (NoCache)
(input ?, (AddressTypeId)
input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
input ?, (BusinessRelationId)
input tPaySelLine.tcBusinessRelationCode, (BusinessRelationCode)
input ?, (AddressId)
output dataset tqAddressByAddressBusRelType) in BBusinessRelation >
find first tqAddressByAddressBusRelType no-error.
if not available(tqAddressByAddressBusRelType)
then do:
oiReturnStatus = -1.
<M-8 run SetMessage (input trim(vcPaySelMsg) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3801':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
return.
end.
/* Get Country description */
<Q-9 run CountryByCode (all) (Read) (NoCache)
(input tqAddressByAddressBusRelType.tcCountryCode, (CountryCode)
output dataset tqCountryByCode) in BCountry >
find first tqCountryByCode where
tqCountryByCode.tcCountryCode = tqAddressByAddressBusRelType.tcCountryCode
no-lock no-error.
if not available(tqCountryByCode)
then do:
oiReturnStatus = -1.
<M-11 run SetMessage (input trim(vcPaySelMsg) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3802':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
return.
end.
assign ocCreditorName1 = tqAddressByAddressBusRelType.tcBusinessRelationName1
ocCreditorStreet1 = tqAddressByAddressBusRelType.tcAddressStreet1
ocCreditorStreet2 = tqAddressByAddressBusRelType.tcAddressStreet2
ocCreditorStreet3 = tqAddressByAddressBusRelType.tcAddressStreet3
ocCreditorZip = tqAddressByAddressBusRelType.tcAddressZip
ocCreditorCity = tqAddressByAddressBusRelType.tcAddressCity
ocCreditorCountryCode = tqAddressByAddressBusRelType.tcCountryCode
ocCreditorCountryDescr = tqCountryByCode.tcCountryDescription.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.