project QadFinancials > class BDebtor > method GetDebtorPaymentData
Description
This method is used to retrieve the data for the 'Payments' tab of Customer Activity Dashboard.
The main logic will execute three queries.
The first query is used to get all the customer payments created via the Payments menus.
The second query is used to get all the movements created outside the Payments menus.
The third query is used to get the Prepayments data created in Banking Entry. And this query will only be executed when the status filter is not 'Closed'.
Parameters
icCompanyListID | input | character | the list of the selected entities |
iiDebtorID | input | integer | the id of the current customer |
itDInvoiceStartDate | input | date | start date filter |
itDInvoiceEndDate | input | date | end date filter |
ilDInvoiceIsOpen | input | logical | the status of customer payment/customer prepayment |
tDInvoicePayment | output | temp-table | result temp-table of all the retrieved data |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bdebtor.p)
/* Get some translations upfront */
if vcDocumentStatusDebtors = ? or
vcDocumentStatusDebtors = '':U
then assign vcDocumentStatusDebtors = {&DOCUMENTSTATUSDEBTORS}.
assign vcDocumentStatusPaidTr = {&DOCUMENTSTATUS-PAID-TR}
vcAllJournalTypeCodes = {&JOURNALTYPES}
vcJournalTypeCodeTr = '':U.
empty temp-table tDInvoicePayment.
if iiDebtorID <> ? and iiDebtorID <> 0 and
icCompanyListID <> ? and icCompanyListID <> '':U
then do:
<Q-7 run DDocumentByDebtor (Start) in BDDocument >
<Q-77 run DDocumentInvoiceXrefByDInvId (Start) in BDDocument >
/* For each on company list to improve performance */
COMPANYBLOCK:
do viCompanyCnt = num-entries(icCompanyListID, ',':U) to 1 by -1:
assign viTempCompanyID = integer(entry(viCompanyCnt, icCompanyListID)) no-error.
if error-status:error
then do:
assign vcMessage = trim(#T-8'Could not retrieve the company ID from the company ID list.':255(65177)T-8#)
oiReturnStatus = -3.
<M-9 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-6953':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
leave COMPANYBLOCK.
end.
<Q-11 run DDocumentByDebtor (all) (Read) (NoCache)
(input viTempCompanyID, (CompanyId)
input iiDebtorID, (DebtorID)
input itDInvoiceStartDate, (PaymentStartDate)
input itDInvoiceEndDate, (PaymentEndDate)
input ilDInvoiceIsOpen, (DocumentIsOpen)
output dataset tqDDocumentByDebtor) in BDDocument>
/* get all record from tqDDocumentByDebtor and put it into tDInoivcePayment.*/
for each tqDDocumentByDebtor:
/* Get document status translation */
assign vcDocumentStatusTr = "":U.
do viA = num-entries(vcDocumentStatusDebtors, chr(2)) to 1 by -2:
if entry(viA, vcDocumentStatusDebtors, chr(2)) = tqDDocumentByDebtor.tcDDocumentStatus
then do:
assign vcDocumentStatusTr = entry(viA - 1, vcDocumentStatusDebtors, chr(2)).
leave.
end.
end.
/* Get journal type code translation */
assign vcJournalTypeCodeTr = '':U.
do viA = num-entries(vcAllJournalTypeCodes, chr(2)) to 1 by -2:
if entry(viA, vcAllJournalTypeCodes, chr(2)) = tqDDocumentByDebtor.tcJournalTypeCode
then do:
assign vcJournalTypeCodeTr = entry(viA - 1, vcAllJournalTypeCodes, chr(2)).
leave.
end.
end.
create tDInvoicePayment.
assign tDInvoicePayment.tcDocumentNumber = tqDDocumentByDebtor.tcDocumentNumber
tDInvoicePayment.tcDDocumentReference = tqDDocumentByDebtor.tcDDocumentReference
tDInvoicePayment.tcDDocumentStatus = vcDocumentStatusTr
tDInvoicePayment.ttDDocumentCreationDate = tqDDocumentByDebtor.ttDDocumentCreationDate
tDInvoicePayment.ttDDocumentDueDate = tqDDocumentByDebtor.ttDDocumentDueDate
tDInvoicePayment.tdPaymentOriginalAmountTC = tqDDocumentByDebtor.tdPaymentOriginalAmountTC
tDInvoicePayment.tcCurrencyCode = tqDDocumentByDebtor.tcCurrencyCode
tDInvoicePayment.tdOriginalAmountLC = tqDDocumentByDebtor.tdOriginalAmountLC
tDInvoicePayment.tdOriginalAmountTC = tqDDocumentByDebtor.tdOriginalAmountTC
tDInvoicePayment.tdOriginalAmountCC = tqDDocumentByDebtor.tdOriginalAmountCC
tDInvoicePayment.tdOpenAmountLC = tqDDocumentByDebtor.tdOpenAmountLC
tDInvoicePayment.tdOpenAmountTC = tqDDocumentByDebtor.tdOpenAmountTC
tDInvoicePayment.tdOpenAmountCC = tqDDocumentByDebtor.tdOpenAmountCC
tDInvoicePayment.tiOverdueDays = tqDDocumentByDebtor.tiOverdueDays
tDInvoicePayment.tiWeekNumbers = tqDDocumentByDebtor.tiWeekNumbers
tDInvoicePayment.tdPaymentAmountTC = tqDDocumentByDebtor.tdDDocumentInvoiceXrefAlloTC
tDInvoicePayment.tdDiscountAmountTC = tqDDocumentByDebtor.tdDDocumentInvoiceXrefDiscTC
tDInvoicePayment.tdInterestAmount = tqDDocumentByDebtor.tdDDocumentInvoiceXrefIntTC
tDInvoicePayment.tcDInvoiceNumber = if tqDDocumentByDebtor.tcDInvoiceDIText = "" or tqDDocumentByDebtor.tcDInvoiceDIText = ?
then tqDDocumentByDebtor.tcDInvoiceNumber
else tqDDocumentByDebtor.tcDInvoiceDIText
tDInvoicePayment.tiDInvoicePostingYear = tqDDocumentByDebtor.tiDInvoicePostingYear
tDInvoicePayment.tcJournalCode = tqDDocumentByDebtor.tcJournalCode
tDInvoicePayment.tiDInvoiceVoucher = tqDDocumentByDebtor.tiDInvoiceVoucher
tDInvoicePayment.tiDInvoice_ID = tqDDocumentByDebtor.tiDInvoice_ID
tDInvoicePayment.ttDInvoicePaymentDate = tqDDocumentByDebtor.ttDInvoicePaymentDate
tDInvoicePayment.tcDPaySelCode = tqDDocumentByDebtor.tcDPaySelCode
tDInvoicePayment.tcDDocumentSubType = tqDDocumentByDebtor.tcDDocumentSubType
tDInvoicePayment.tiDDocument_ID = tqDDocumentByDebtor.tiDDocument_ID
tDInvoicePayment.tcDInvoiceDIText = tqDDocumentByDebtor.tcDInvoiceDIText
tDInvoicePayment.tcBaseCurrencyCode = tqDDocumentByDebtor.tcBaseCurrencyCode
tDInvoicePayment.tcJournalTypeCode = tqDDocumentByDebtor.tcJournalTypeCode
tDInvoicePayment.tcJournalTypeCodeTr = vcJournalTypeCodeTr
tDInvoicePayment.tcDDocumentBankImpRef = tqDDocumentByDebtor.tcDDocumentBankImpRef
tDInvoicePayment.tdDDocumentExchangeRate = tqDDocumentByDebtor.tdDDocumentExchangeRate
tDInvoicePayment.tcCurrCompanyCode = tqDDocumentByDebtor.tcCompanyCode.
end. /* for each tqDDocumentByDebtor. */
<Q-6 run DInvoiceMovementByDebtorPm (all) (Read) (NoCache)
(input viTempCompanyID, (CompanyId)
input itDInvoiceStartDate, (FromPostingDate)
input itDInvoiceEndDate, (ToPostingDate)
input iiDebtorID, (DebtorID)
output dataset tqDInvoiceMovementByDebtorPm) in BDInvoice>
/* get all record from tqDInvoiceMovementByDebtorPm and append them into tDInvoicePayment. */
for each tqDInvoiceMovementByDebtorPm:
/* skip the deduction journal type */
/* if tqDInvoiceMovementByDebtorPm.tcJournalTypeCode = {&JOURNALTYPE-DEDUCTION} then next. */
/* Get journal type code translation */
assign vcJournalTypeCodeTr = '':U.
do viA = num-entries(vcAllJournalTypeCodes, chr(2)) to 1 by -2:
if entry(viA, vcAllJournalTypeCodes, chr(2)) = tqDInvoiceMovementByDebtorPm.tcJournalTypeCode
then do:
assign vcJournalTypeCodeTr = entry(viA - 1, vcAllJournalTypeCodes, chr(2)).
leave.
end.
end.
if (ilDInvoiceIsOpen <> true and tqDInvoiceMovementByDebtorPm.tlDInvoiceIsOpen = false) or
(ilDInvoiceIsOpen <> false and tqDInvoiceMovementByDebtorPm.tlDInvoiceIsOpen = true)
then do:
create tDInvoicePayment.
assign tDInvoicePayment.tcDocumentNumber = tqDInvoiceMovementByDebtorPm.tcDocumentNumber
tDInvoicePayment.tcDDocumentReference = tqDInvoiceMovementByDebtorPm.tcPostingText
tDInvoicePayment.tcDDocumentStatus = vcDocumentStatusPaidTr
tDInvoicePayment.ttDDocumentCreationDate = tqDInvoiceMovementByDebtorPm.ttPostingDate
tDInvoicePayment.ttDDocumentDueDate = tqDInvoiceMovementByDebtorPm.ttDInvoiceDueDate
tDInvoicePayment.tdPaymentOriginalAmountTC = 0 - (tqDInvoiceMovementByDebtorPm.tdPaymentAmountTC + tqDInvoiceMovementByDebtorPm.tdDinvoiceMovementDiscountTC)
tDInvoicePayment.tcCurrencyCode = tqDInvoiceMovementByDebtorPm.tcCurrencyCode
tDInvoicePayment.tdOriginalAmountLC = tqDInvoiceMovementByDebtorPm.tdOriginalAmountLC
tDInvoicePayment.tdOriginalAmountTC = tqDInvoiceMovementByDebtorPm.tdOriginalAmountTC
tDInvoicePayment.tdOriginalAmountCC = tqDInvoiceMovementByDebtorPm.tdOriginalAmountCC
tDInvoicePayment.tdOpenAmountLC = tqDInvoiceMovementByDebtorPm.tdOpenAmountLC
tDInvoicePayment.tdOpenAmountTC = tqDInvoiceMovementByDebtorPm.tdOpenAmountTC
tDInvoicePayment.tdOpenAmountCC = tqDInvoiceMovementByDebtorPm.tdOpenAmountCC
tDInvoicePayment.tiOverdueDays = tqDInvoiceMovementByDebtorPm.tiOverdueDays
tDInvoicePayment.tiWeekNumbers = tqDInvoiceMovementByDebtorPm.tiWeekNumbers
tDInvoicePayment.tdPaymentAmountTC = tqDInvoiceMovementByDebtorPm.tdPaymentAmountTC
tDInvoicePayment.tdDiscountAmountTC = tqDInvoiceMovementByDebtorPm.tdDinvoiceMovementDiscountTC
tDInvoicePayment.tcDInvoiceNumber = if tqDInvoiceMovementByDebtorPm.tcDInvoiceDIText = "" or
tqDInvoiceMovementByDebtorPm.tcDInvoiceDIText = ?
then tqDInvoiceMovementByDebtorPm.tcDInvoiceNumber
else tqDInvoiceMovementByDebtorPm.tcDInvoiceDIText
tDInvoicePayment.tiDInvoicePostingYear = tqDInvoiceMovementByDebtorPm.tiDInvoicePostingYear
tDInvoicePayment.tcJournalCode = tqDInvoiceMovementByDebtorPm.tcJournalCode
tDInvoicePayment.tiDInvoiceVoucher = tqDInvoiceMovementByDebtorPm.tiDInvoiceVoucher
tDInvoicePayment.ttDInvoicePaymentDate = tqDInvoiceMovementByDebtorPm.ttDInvoicePaymentDate
tDInvoicePayment.tcDPaySelCode = ""
tDInvoicePayment.tcJournalTypeCode = tqDInvoiceMovementByDebtorPm.tcJournalTypeCode
tDInvoicePayment.tcJournalTypeCodeTr = vcJournalTypeCodeTr
tDInvoicePayment.tiPosting_ID = tqDInvoiceMovementByDebtorPm.tiPosting_ID
tDInvoicePayment.tcDInvoiceDIText = tqDInvoiceMovementByDebtorPm.tcDInvoiceDIText
tDInvoicePayment.tcBaseCurrencyCode = tqDInvoiceMovementByDebtorPm.tcBaseCurrencyCode
tDInvoicePayment.tdDDocumentExchangeRate = tqDInvoiceMovementByDebtorPm.tdPostingLineExchangeRate
tDInvoicePayment.tiDInvoice_ID = tqDInvoiceMovementByDebtorPm.tiDInvoice_ID
tDInvoicePayment.tcCurrCompanyCode = tqDInvoiceMovementByDebtorPm.tcCompanyCode.
end.
if tqDInvoiceMovementByDebtorPm.tcJournalTypeCode = {&JOURNALTYPE-DEBTORADJUSTMENT}
then do:
<Q-95 run OIAdjustByPosting (all) (Read) (NoCache)
(input ?, (CompanyId)
input tqDInvoiceMovementByDebtorPm.tiPosting_ID, (PostingID)
output dataset tqOIAdjustByPosting) in BOpenItemAdjustment>
find first tqOIAdjustByPosting
where tqOIAdjustByPosting.tiPosting_ID = tqDInvoiceMovementByDebtorPm.tiPosting_ID no-error.
if available tqOIAdjustByPosting and available tDInvoicePayment
then assign tDInvoicePayment.tcOIAdjustDescription = tqOIAdjustByPosting.tcOIAdjustDescription.
end. /* if icJournalTypeCode = {&JOURNALTYPE-DEBTORADJUSTMENT} */
end. /* for each tqDInvoiceMovementByDebtorPm. */
/* Get all Bounced Payment records from using query DInvoiceMovementForBounced and
Assign to tDInvoicePayment with OpenAmount 0 since the payment is Bounced */
<Q-42 run DInvoiceMovementForBounced (all) (Read) (NoCache)
(input viTempCompanyID, (CompanyId)
input iiDebtorID, (DebtorID)
input itDInvoiceStartDate, (FromPostingDate)
input itDInvoiceEndDate, (ToPostingDate)
output dataset tqDInvoiceMovementForBounced) in BDInvoice>
for each tqDInvoiceMovementForBounced:
if ilDInvoiceIsOpen <> true
then do:
create tDInvoicePayment.
assign tDInvoicePayment.tcDocumentNumber = tqDInvoiceMovementForBounced.tcDocumentNumber
tDInvoicePayment.tcDDocumentReference = tqDInvoiceMovementForBounced.tcPostingText
tDInvoicePayment.tcDDocumentStatus = {&DOCUMENTSTATUS-BOUNCED}
tDInvoicePayment.ttDDocumentCreationDate = tqDInvoiceMovementForBounced.ttPostingDate
tDInvoicePayment.ttDDocumentDueDate = tqDInvoiceMovementForBounced.ttDInvoiceDueDate
tDInvoicePayment.tdPaymentOriginalAmountTC = tqDInvoiceMovementForBounced.tdPaymentAmountTC + tqDInvoiceMovementForBounced.tdDinvoiceMovementDiscountTC
tDInvoicePayment.tcCurrencyCode = tqDInvoiceMovementForBounced.tcCurrencyCode
tDInvoicePayment.tdOriginalAmountLC = tqDInvoiceMovementForBounced.tdOriginalAmountLC
tDInvoicePayment.tdOriginalAmountTC = tqDInvoiceMovementForBounced.tdOriginalAmountTC
tDInvoicePayment.tdOriginalAmountCC = tqDInvoiceMovementForBounced.tdOriginalAmountCC
tDInvoicePayment.tdOpenAmountLC = 0
tDInvoicePayment.tdOpenAmountTC = 0
tDInvoicePayment.tdOpenAmountCC = 0
tDInvoicePayment.tiOverdueDays = tqDInvoiceMovementForBounced.tiOverdueDays
tDInvoicePayment.tiWeekNumbers = tqDInvoiceMovementForBounced.tiWeekNumbers
tDInvoicePayment.tdPaymentAmountTC = 0 - tqDInvoiceMovementForBounced.tdPaymentAmountTC
tDInvoicePayment.tdDiscountAmountTC = 0 - tqDInvoiceMovementForBounced.tdDinvoiceMovementDiscountTC
tDInvoicePayment.tcDInvoiceNumber = if tqDInvoiceMovementForBounced.tcDInvoiceDIText = "" or
tqDInvoiceMovementForBounced.tcDInvoiceDIText = ?
then tqDInvoiceMovementForBounced.tcDInvoiceNumber
else tqDInvoiceMovementForBounced.tcDInvoiceDIText
tDInvoicePayment.tiDInvoicePostingYear = tqDInvoiceMovementForBounced.tiDInvoicePostingYear
tDInvoicePayment.tcJournalCode = tqDInvoiceMovementForBounced.tcJournalCode
tDInvoicePayment.tiDInvoiceVoucher = tqDInvoiceMovementForBounced.tiDInvoiceVoucher
tDInvoicePayment.ttDInvoicePaymentDate = tqDInvoiceMovementForBounced.ttDInvoicePaymentDate
tDInvoicePayment.tcDPaySelCode = ""
tDInvoicePayment.tcJournalTypeCode = tqDInvoiceMovementForBounced.tcJournalTypeCode
tDInvoicePayment.tiPosting_ID = tqDInvoiceMovementForBounced.tiPosting_ID
tDInvoicePayment.tcDInvoiceDIText = tqDInvoiceMovementForBounced.tcDInvoiceDIText
tDInvoicePayment.tcBaseCurrencyCode = tqDInvoiceMovementForBounced.tcBaseCurrencyCod
tDInvoicePayment.tdDDocumentExchangeRate = tqDInvoiceMovementForBounced.tdPostingLineExchangeRate
tDInvoicePayment.tcCurrCompanyCode = tqDInvoiceMovementForBounced.tcCompanyCode.
end.
end.
if ilDInvoiceIsOpen <> false
then do:
/* Read the open Prepayments that do not link to any payment. */
<Q-46 run DInvoiceGetPrepaymentByDebtor (all) (Read) (NoCache)
(input viTempCompanyID, (CompanyId)
input itDInvoiceStartDate, (FromPostingDate)
input itDInvoiceEndDate, (ToPostingDate)
input iiDebtorID, (DebtorID)
input true, (InvoiceIsOpen)
output dataset tqDInvoiceGetPrepaymentByDebtor) in BDInvoice >
/* Get all record from tqDInvoiceGetPrepaymentByDebtor and append them into tDInvoicePayment. */
for each tqDInvoiceGetPrepaymentByDebtor:
/* skip the deduction journal type */
/* if tqDInvoiceGetPrepaymentByDebtor.tcJournalTypeCode = {&JOURNALTYPE-DEDUCTION} then next. */
/* If it is linked to the payment, then skip this record. */
<Q-39 run DDocumentInvoiceXrefByDInvId (all) (Read) (NoCache)
(input tqDInvoiceGetPrepaymentByDebtor.tiDInvoice_ID, (DInvoiceId)
output dataset tqDDocumentInvoiceXrefByDInvId) in BDDocument >
find first tqDDocumentInvoiceXrefByDInvId where
tqDDocumentInvoiceXrefByDInvId.tiDInvoice_ID = tqDInvoiceGetPrepaymentByDebtor.tiDInvoice_ID
no-error.
if available tqDDocumentInvoiceXrefByDInvId
then next.
/* Get journal type code translation */
assign vcJournalTypeCodeTr = '':U.
do viA = num-entries(vcAllJournalTypeCodes, chr(2)) to 1 by -2:
if entry(viA, vcAllJournalTypeCodes, chr(2)) = tqDInvoiceGetPrepaymentByDebtor.tcJournalTypeCode
then do:
assign vcJournalTypeCodeTr = entry(viA - 1, vcAllJournalTypeCodes, chr(2)).
leave.
end.
end.
create tDInvoicePayment.
assign tDInvoicePayment.tcDocumentNumber = tqDInvoiceGetPrepaymentByDebtor.tcDocumentNumber
tDInvoicePayment.tcDDocumentReference = tqDInvoiceGetPrepaymentByDebtor.tcPostingText
tDInvoicePayment.tcDDocumentStatus = vcDocumentStatusPaidTr
tDInvoicePayment.ttDDocumentCreationDate = tqDInvoiceGetPrepaymentByDebtor.ttPostingDate
tDInvoicePayment.ttDDocumentDueDate = tqDInvoiceGetPrepaymentByDebtor.ttDInvoiceDueDate
tDInvoicePayment.tdPaymentOriginalAmountTC = 0 - (tqDInvoiceGetPrepaymentByDebtor.tdPaymentAmountTC + tqDInvoiceGetPrepaymentByDebtor.tdDinvoiceMovementDiscountTC)
tDInvoicePayment.tcCurrencyCode = tqDInvoiceGetPrepaymentByDebtor.tcCurrencyCode
tDInvoicePayment.tdOriginalAmountLC = tqDInvoiceGetPrepaymentByDebtor.tdOriginalAmountLC
tDInvoicePayment.tdOriginalAmountTC = tqDInvoiceGetPrepaymentByDebtor.tdOriginalAmountTC
tDInvoicePayment.tdOriginalAmountCC = tqDInvoiceGetPrepaymentByDebtor.tdOriginalAmountCC
tDInvoicePayment.tdOpenAmountLC = tqDInvoiceGetPrepaymentByDebtor.tdOpenAmountLC
tDInvoicePayment.tdOpenAmountTC = tqDInvoiceGetPrepaymentByDebtor.tdOpenAmountTC
tDInvoicePayment.tdOpenAmountCC = tqDInvoiceGetPrepaymentByDebtor.tdOpenAmountCC
tDInvoicePayment.tiOverdueDays = tqDInvoiceGetPrepaymentByDebtor.tiOverdueDays
tDInvoicePayment.tiWeekNumbers = tqDInvoiceGetPrepaymentByDebtor.tiWeekNumbers
tDInvoicePayment.tdPaymentAmountTC = tqDInvoiceGetPrepaymentByDebtor.tdPaymentAmountTC
tDInvoicePayment.tdDiscountAmountTC = tqDInvoiceGetPrepaymentByDebtor.tdDinvoiceMovementDiscountTC
tDInvoicePayment.tcDInvoiceNumber = if tqDInvoiceGetPrepaymentByDebtor.tcDInvoiceDIText = "" or
tqDInvoiceGetPrepaymentByDebtor.tcDInvoiceDIText = ?
then tqDInvoiceGetPrepaymentByDebtor.tcDInvoiceNumber
else tqDInvoiceGetPrepaymentByDebtor.tcDInvoiceDIText
tDInvoicePayment.tiDInvoicePostingYear = tqDInvoiceGetPrepaymentByDebtor.tiDInvoicePostingYear
tDInvoicePayment.tcJournalCode = tqDInvoiceGetPrepaymentByDebtor.tcJournalCode
tDInvoicePayment.tiDInvoiceVoucher = tqDInvoiceGetPrepaymentByDebtor.tiDInvoiceVoucher
tDInvoicePayment.ttDInvoicePaymentDate = tqDInvoiceGetPrepaymentByDebtor.ttDInvoicePaymentDate
tDInvoicePayment.tcDPaySelCode = ""
tDInvoicePayment.tcJournalTypeCode = tqDInvoiceGetPrepaymentByDebtor.tcJournalTypeCode
tDInvoicePayment.tcJournalTypeCodeTr = vcJournalTypeCodeTr
tDInvoicePayment.tiPosting_ID = tqDInvoiceGetPrepaymentByDebtor.tiPosting_ID
tDInvoicePayment.tcDInvoiceDIText = tqDInvoiceGetPrepaymentByDebtor.tcDInvoiceDIText
tDInvoicePayment.tcBaseCurrencyCode = tqDInvoiceGetPrepaymentByDebtor.tcBaseCurrencyCode
tDInvoicePayment.tdDDocumentExchangeRate = tqDInvoiceGetPrepaymentByDebtor.tdPostingLineExchangeRate
tDInvoicePayment.tiDInvoice_ID = tqDInvoiceGetPrepaymentByDebtor.tiDInvoice_ID
tDInvoicePayment.tcCurrCompanyCode = tqDInvoiceGetPrepaymentByDebtor.tcCompanyCode.
end. /* for each tqDInvoiceGetPrepaymentByDebtor. */
end. /* if ilDInvoiceIsOpen <> false */
end. /* do viCompanyCnt = num-entries(icCompanyListID, ',':U) to 1 by -1: */
<Q-12 run DDocumentByDebtor (Stop) in BDDocument >
<Q-38 run DDocumentInvoiceXrefByDInvId (Stop) in BDDocument >
end. /* if iiDebtorID <> ? and iiDebtorID <> 0. */