project QadFinancials > class BDInvoice > method GetDeductionPaymentByDInvoiceId
Description
Get customer payment id or bankentry id or pettycash id.
Parameters
iiDInvoiceId | input | integer | |
ocPaymentType | output | character | |
oiPaymentId | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bdinvoice.p)
/*********************************************************************************/
/* This mehtod will get the payment type and payment id by deduction invoice id */
/*********************************************************************************/
assign oiReturnStatus = -98.
if iiDInvoiceId =? or iiDInvoiceId <= 0
then do:
assign oiPaymentId = 0
ocPaymentType = '':U
oiReturnStatus = 0.
return.
end.
assign ocPaymentType = '':U.
/* check if the dinvoice id is customer payment */
<Q-81 run DDocumentInvoiceXrefByDInvId (all) (Read) (NoCache)
(input iiDInvoiceId, (DInvoiceId)
output dataset tqDDocumentInvoiceXrefByDInvId) in BDDocument>
find first tqDDocumentInvoiceXrefByDInvId no-error.
if available tqDDocumentInvoiceXrefByDInvId
then do:
assign oiPaymentId = tqDDocumentInvoiceXrefByDInvId.tiDDocument_ID
ocPaymentType = {&JOURNALTYPE-DEBTORPAYMENT}
oiReturnStatus = 0.
return.
end.
/* check if the dinvoice id is banking entry or pettycash */
<Q-70 run BankStateInfoByDInvoiceId (all) (Read) (NoCache)
(input ?, (CompanyId)
input iiDInvoiceId, (DInvoiceId)
output dataset tqBankStateInfoByDInvoiceId) in BBankEntry>
find first tqBankStateInfoByDInvoiceId no-error.
if available tqBankStateInfoByDInvoiceId
then do:
if tqBankStateInfoByDInvoiceId.tcBankStateTransactionType = {&BANKSTATETRANSTYPE-BANK}
then do:
assign oiPaymentId = tqBankStateInfoByDInvoiceId.tiBankState_ID
ocPaymentType = {&BANKSTATETRANSTYPE-BANK}
oiReturnStatus = 0.
end.
else if tqBankStateInfoByDInvoiceId.tcBankStateTransactionType = {&BANKSTATETRANSTYPE-CASH}
then do:
assign oiPaymentId = tqBankStateInfoByDInvoiceId.tiBankState_ID
ocPaymentType = {&BANKSTATETRANSTYPE-CASH}
oiReturnStatus = 0.
end.
end.
assign oiReturnStatus = 0.